User avatar
DougieLawson
Posts: 36123
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

dosfsck - doesn't do what you think it should

Wed Nov 27, 2013 1:35 am

I had a corruption on the vfat /dev/mmcblk0p1 partition of my Raspbian SDCard today.

Booted and it dropped into single user mode (asked for root password) with an error on the vfat partition.
So I entered my root password and ran fsck.vfat /dev/mmcblk0p1. Rebooted and the same again.

I pulled the card from the micro SD adapter and because it was the vfat partition tried it in my Win8.1 system. Win8.1 spotted the problem and asked if I wanted to repair it. Did that, then explicitly ejected the card (to ensure everything was written back). Next go in the RPi it booted OK.

So I searched for "dos fsck doesn't fix vfat" on Google and turned up: http://askubuntu.com/questions/147228/h ... ile-system

The naïve way of running fsck.vfat (or dosfsck (which is just an alias)) didn't automatically repair the filesystem (don't know why). It looks like you need to run it with fsck.vfat -w -r -l -a -v -t /dev/mmcblk0p1 With -w being the most important flag
or it does nothing useful.

I hope that might help some folks who can't get NOOBS or Raspbian to boot.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: dosfsck - doesn't do what you think it should

Wed Nov 27, 2013 7:51 am

If any one else reading is curious about what this criptic command arg's realy mean
Here's a link
explainshell.com dosfsck -w -r -l -a -v -t /dev/mmcblk0p1

User avatar
rpdom
Posts: 15194
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: dosfsck - doesn't do what you think it should

Wed Nov 27, 2013 8:16 am

From a quick glance at the man page, the important options there appear to be -a and -r
Note: If -a and -r are absent, the filesystem is only checked, but not repaired.
They also appear to be mutually exclusive???
-a Automatically repair the filesystem. No user intervention is necessary. Whenever there is more than one method to solve a problem, the least destructive approach is used.

-r Interactively repair the filesystem. The user is asked for advice whenever there is more than one approach to fix an inconsistency.
The -w option isn't exactly clear. It seems to imply that using it will mean the filesystem is updated during the checking process, rather than at the end.

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: dosfsck - doesn't do what you think it should

Tue Jan 28, 2014 7:33 am

Using fsck.fat (dosfstools) from the official raspbian repo will not work. Please read this thread:
http://www.raspberrypi.org/phpBB3/viewt ... 56#p495156
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

Return to “Troubleshooting”