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