When I umount a SD flash card in a USB card reader, and then pull the card, filesystem stays "dirty".
System:
- RPi or xubuntu 16.04.3
- The card reader is some super cheap Chinese one. I have tried a few different ones
- I have tried a bunch of different SD cards.
How to reproduce:
- connect card reader
- insert SD card with vfat on the first partition
- wait for system to detect SD card
- wait for system to automount filesystem or mount it manually
- update a random file, I do:
date >> /media/mogul/2E3E-AE54/d
- un-mount:
sudo umount /dev/sdd1
- (placeholder, do nothing here, yet)
- pull sd card from card reader
Now repeat from step 2. Keep an eye on your dmesg, it will say:
[357207.805594] FAT-fs (sdd1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
(newer linux's support dmesg -w
)
Now, if I add an additional action after the umount
- read a random byte on the SD card, like:
dd if=/dev/sdd1 skip=1000000 ibs=1 count=1 of=/dev/null
the filesystem seems to survive.
This seems a bit hackish to me, am I missing something fundamental?
Do you have more elegant solutions?
I prefer not to use eject
, but only umount, since
eject` powers down the card reader too; the system won’t detect a new SD card before I re-plug the card reader.
fdisk -l /dev/sdd
, look a little less odd in the surrounding program