Volume was not properly unmounted ...


47 posts   Page 1 of 2   1, 2
by Richard-TX » Tue Dec 31, 2013 12:23 am
Here is the fix for this annoying message.
Code: Select all
# dmesg | grep corrupt
[   21.280705] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Code: Select all
# umount /boot
# git clone http://daniel-baumann.ch/git/software/dosfstools.git

# cd dosfstools

# make
cc -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers -Wmissing-prototypes -Wstrict-prototypes -g   -c -o fatlabel.o src/fatlabel.c
.
.
.
cc   mkfs.fat.o   -o mkfs.fat
# ./fsck.fat -V /dev/mmcblk0p1
fsck.fat 3.0.24 (2013-11-23)
0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
Starting check/repair pass.
Starting verification pass.
Leaving filesystem unchanged.
/dev/mmcblk0p1: 14 files, 2383/7161 clusters

./fsck.fat -a /dev/mmcblk0p1

#mount /boot
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
User avatar
Posts: 1544
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas
by rpdom » Tue Dec 31, 2013 6:59 am
That would work, but if you are running Raspbian it is much quicker to do
Code: Select all
sudo apt-get install dosfstools

(which only needs to be done once)
then
Code: Select all
sudo umount /boot
fsck -V /dev/mmcblk0p1
(reply to any messages as above)
mount /boot

No need to build dosfstools yourself as it has already been done for you :)
User avatar
Posts: 9274
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by funky81 » Wed Jan 01, 2014 7:54 pm
I've tried to use dosfstools taken from apt-get, but still can't remove this bug.
It seems the dosfstools package from apt-get (3.0.13-1) seems older than git files (3.0.24).
so the only solution just like @Richard-TX said, have to take the git then recompile.
Voila, the bug gone.
Posts: 4
Joined: Fri Jul 05, 2013 9:10 pm
by felisk » Sun Jan 05, 2014 9:07 am
same for me, dosfstools from apt-get did not show errors.
git cloned and built as per @Richard-TX, that fixed the problem.
Posts: 1
Joined: Sun Jan 05, 2014 9:00 am
by fookey » Sat Jan 11, 2014 6:09 pm
Exact same scenario for me. Using apt-get dosfstools did not change the corrupt notification during boot. Per this thread:

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=61879

Used this resulting in no change to the /boot corrupt message:
Code: Select all
sudo fsck.vfat -w -r -l -a -v -t /dev/mmcblk0p5


So instead followed Richard's guidance to git clone and build the source and use fsck.fat. Walla! No more corrupt message during boot.
Posts: 1
Joined: Mon Dec 16, 2013 6:21 pm
by ripat » Tue Jan 28, 2014 7:31 am
Same here.

The dosfstools from the official raspbian repo did not clear the dirty bit. I had to compile the git sources as per the above post and use:
Code: Select all
./fsck.fat -trawl /dev/mmcblk0p1
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.
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium
by Broncus » Wed Feb 12, 2014 7:29 pm
In the event the reader does not understand what they read in Richard's comments. It took me (noob) a bit of playing around to understand what I needed to do. I am only listing the steps without the feedback.

The first time ./fsck.fat is ran, it should report "dirty bit" is set. Choose number 1. When the command is ran the second time, it will show the bit as clean.

Also, I was not running as a root user so I used "sudo" for each command.

Hopefully it will help. I know Richard's work has helped me.

Thanks and best regards!
Fred

Code: Select all
   sudo umount /boot
   sudo git clone http://daniel-baumann.ch/git/software/dosfstools.git
   sudo cd dosfstools
   sudo make
   sudo ./fsck.fat -V /dev/mmcblk0p1

   sudo ./fsck.fat -a /dev/mmcblk0p1
   sudo mount /boot
Posts: 15
Joined: Thu Apr 18, 2013 5:48 pm
by DougieLawson » Wed Feb 12, 2014 7:34 pm
Broncus you missed a step.

After make you need to use sudo make install to replace any existing version of the tools.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 22623
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by sharix » Mon Feb 17, 2014 11:22 am
I got this:
Code: Select all
sudo ./fsck.fat -V /dev/mmcblk0p1
fsck.fat 3.0.25 (2014-01-17)
0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
Starting check/repair pass.
FATs differ but appear to be intact. Use which FAT ?
1) Use first FAT
2) Use second FAT
?


Which one should I choose?
Posts: 199
Joined: Thu Feb 16, 2012 11:29 am
Location: Slovenia
by ripat » Mon Feb 17, 2014 11:33 am
Option 1: Remove dirty bit

Or use this command:
Code: Select all
./fsck.fat -trawl /dev/mmcblk0p1
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.
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium
by rpdom » Mon Feb 17, 2014 12:06 pm
sharix: That's a tricky one. One of the File Allocation Tables is wrong, but you can't tell which. You'll just have to make a guess, I suppose.
User avatar
Posts: 9274
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by heatfanjohn » Tue Mar 04, 2014 7:39 pm
ripat wrote:Same here.

The dosfstools from the official raspbian repo did not clear the dirty bit. I had to compile the git sources as per the above post and use:
Code: Select all
./fsck.fat -trawl /dev/mmcblk0p1


Thank you, this worked for me ...
User avatar
Posts: 26
Joined: Fri Jun 28, 2013 5:18 pm
Location: Davie, FL
by beta-tester » Wed Mar 12, 2014 1:44 pm
i do not understand, why the official repository still contains an not working many years old outdated version of dosfstools.
isn't it possible to update that version in the repository? it is not understandable why every body who tries to fix the dirty bit, first has to run in to a not working solution, struggle around what's wrong, and has to search in the internet, to find the right working solution...
for what is the repository there, when it is not keeped up to date?!?! :x
[I only give negative feedback]
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B (1GB), 64GB microSDXC1 class 10, HDMI 1920x1080, keyboard-mouse-combo (wireless), PiCamera, ethernet-cable, 5V/1.2A power supply, Wifi dongle (rt5370)
Posts: 788
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE
by ripat » Wed Mar 12, 2014 3:55 pm
The dosfstools v. 3.0.16-2 from the Jessie repo is working fine and successfully removes the dirty bit. If you don't want to make a full dist-upgrade, you can use the handy Debian preference pinning system and pick any package from Jessie without breaking your system. Here is how to do:

In /etc/apt/sources.list add:
Code: Select all
# Jessie
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi

Create your preference file: /etc/apt/preferences and add these lines:
Code: Select all
Package: *
Pin: release n=wheezy
Pin-Priority: 800

Package: *
Pin: release n=jessie
Pin-Priority: 600

Update the packages list (it will take a while the first time!):
Code: Select all
$ sudo apt-get update

Install dosfstools from Jessie
Code: Select all
$ sudo apt-get -t jessie install dosfstools

Finaly umount /boot and run fsck:
Code: Select all
$ sudo umount /boot
$ sudo fsck.vfat -trawl /dev/mmcblk0p1
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.
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium
by chrisryall » Sun Mar 16, 2014 9:33 am
I've just seen this message appear (I'd done a simple sudo halt followed by system card backup)!

Code: Select all
[   18.356472] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.


All the above looks a bit scary. And when I run fsck as asked .. it warns of the perils of an unmounted file system!! Is this a real filesystem problem? Do I need to fix it? Is it as easy as and unmount of /boot, fsck, and remount (presumably all managed by the debian kernel)?
User avatar
Posts: 155
Joined: Wed Nov 27, 2013 11:45 am
Location: Wirral UK
by DougieLawson » Sun Mar 16, 2014 9:38 am
Two ways to fix it.
1. Follow the instructions here to fix the dosfstools package.
2. Stick your card in a windows machine and use checkdisk (which can be driven from the GUI by right click and properties from file manager).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 22623
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by chrisryall » Sun Mar 16, 2014 10:59 am
Dougie, to the rescue again! :) I chose the desktop option (easier, better understood) and I had properly ejected it after my backup (was read only anyway?)

But checkdisk finds no errors. Though (bizarrely) I get a pop up offering to fix same errors when I plug it in :shock: So I'm presently reinstalling my February image. Don't think I'll lose much beyond updates as I've been attending to "other hobby" since then.
User avatar
Posts: 155
Joined: Wed Nov 27, 2013 11:45 am
Location: Wirral UK
by safull » Sun Mar 30, 2014 12:39 am
I there I downloaded and installed the package dostools-3.0.26. Build and installed, even copied to the /sbin and still get the error:

Code: Select all
[...]
failed (code 6).
[FAIL] File system check failed. A log is being saved in /var/log/fsck/checkfs/ if that location is writable. Please repair the file system manually. ... failed!
[...]

Then on the log file I can read:

Code: Select all
[...]
fsck.fat 3.0.26 (2014-03-07)
/dev/mmcblk0p1: 15 files, 2383/7161 clusters
open: No such file or directory
[...]

From the log I can see it's now running the build version 3.0.26. I can run it when I log in and seems to correct the error bit, when i run it with -frawl options. However the message is still there on every reboot, and waiting for user input.

I read on other forums I can disable the fsck editing the /etc/fstab, however will like to keep it.

Is really broken? I'm missing something?

Thanks
Posts: 1
Joined: Sun Mar 30, 2014 12:30 am
by rtek1000 » Wed Apr 16, 2014 3:22 am
It work for me:

Code: Select all
sudo umount /boot
sudo git clone http://daniel-baumann.ch/git/software/dosfstools.git
sudo cd dosfstools
sudo make
sudo make install
sudo ./fsck.fat -V /dev/mmcblk0p1
sudo ./fsck.fat -a /dev/mmcblk0p1
sudo mount /boot


In the line: ./fsck.fat -V /dev/mmcblk0p1
I typed the number 1 and I pressed enter

Good luck! 8-)
Posts: 16
Joined: Wed Mar 12, 2014 9:21 pm
by NT4boy » Wed Apr 16, 2014 3:30 pm
One thing I'd add is that on my current noobs card, the boot drive isn't p1, but p5

sudo blkid -c /dev/null
/dev/mmcblk0p1: LABEL="RECOVERY" UUID="DB73-1078" TYPE="vfat"
/dev/mmcblk0p3: LABEL="SETTINGS" UUID="d1005177-0e28-44df-8dac-48faf7dc7c32" TYPE="ext4"
/dev/mmcblk0p5: LABEL="BOOT" UUID="039D-059C" TYPE="vfat"
/dev/mmcblk0p6: LABEL="root" UUID="2841057b-39e5-4612-87d5-c64ddea7edfb" TYPE="ext4"


sudo ./fsck.fat -V /dev/mmcblk0p5 detects the dirty bit so you say yes (1)
sudo ./fsck.fat -a /dev/mmcblk0p5 fixes the dirty bit

Otherwise, brilliant and fixed my error too. Thanks
Posts: 3
Joined: Wed Apr 16, 2014 3:20 pm
by darkform » Thu Apr 24, 2014 10:56 pm
Like most other Pi'ers, I was able to solve the problem with Richard-TX's post (The very first one)
So, installing with "sudo apt-get install dosfstools" didn't work.

And like NT4boy (First one above this post) said, try to identify the disc which gives the error. Most probably it is not p1. Mine was not P1 either, it was P5 instead. Try what he says and hopefully you'll solve this annoying error message.
Posts: 3
Joined: Sun Apr 20, 2014 2:53 am
by croston » Thu Apr 24, 2014 11:51 pm
I've built Raspbian Jessie (clean image install, not an upgrade) and confirm that it has been fixed in the next version of Raspbian.
User avatar
Posts: 645
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
by ripat » Sat May 24, 2014 4:41 pm
croston wrote:I've built Raspbian Jessie (clean image install, not an upgrade) and confirm that it has been fixed in the next version of Raspbian.


And for those who don't want to go the full dist upgrade way to Jessie I have posted here how to install only one package from Jessie using the Debian pinning system. Easy and gentle to your dependencies. Another advantage of using that method is that dosfstools will be automatically updated just like any other package from wheezy.
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.
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium
by cweveritt » Sun Aug 24, 2014 8:24 pm
DougieLawsons method 2 using windows checkdisk apparently fixed it for me. Thanks all
Posts: 5
Joined: Wed Oct 02, 2013 12:05 am
by liamkennedy » Fri Aug 29, 2014 5:41 am
ripat wrote:The dosfstools v. 3.0.16-2 from the Jessie repo is working fine and successfully removes the dirty bit. If you don't want to make a full dist-upgrade, you can use the handy Debian preference pinning system and pick any package from Jessie without breaking your system. Here is how to do:


Just wanted to add my thanks for this post. This fixed my problem and was much easier to complete than other solutions offered. Thanks so much

-Liam
User avatar
Posts: 33
Joined: Thu Dec 19, 2013 10:12 am