I am using a USB with an embedded device running linux. The issue is that in some cases when I unmount the usb by giving the command umount /media/sda1
the unmount is successful but when I proceed to remove the usb I get an error saying unable to mark fs as dirty and when I plug it back in I get the error Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Is there any other command on the linux terminal which I can use to safely eject the usb? so that the usb device is powered off before I unplug it.
Update: I tried using sync but the error is still there as shown below:
root@(none):~# sync
root@(none):~# umount /media/sda1
root@(none):~# ls /media/sda1
root@(none):~# [ 296.021241] usb 2-1: USB disconnect, device number 3
[ 296.026879] sd 1:0:0:0: [sda] Synchronizing SCSI cache
[ 296.031175] sd 1:0:0:0: [sda]
[ 296.033743] Result: hostbyte=0x01 driverbyte=0x00
[ 296.048283] FAT-fs (sda1): unable to read boot sector to mark fs as dirty
sync
. – garethTheRed Jun 17 '16 at 06:47sync
ing each time you write to the device (for example after a few minutes of editing a document) is bad as you write too many times which in theory reduces the lifetime of the device. Syncing just before youumount
is common sense as you want your data to be written to the device don't you? – garethTheRed Jun 17 '16 at 07:08sync
beforeumount
– magor Jun 17 '16 at 07:23