Unmounting Detachable devices(eSATA,USB storage) in linux
A detachable device like eSATA,USB can be abruptly removed (by simply pulling the plug).
Then, if there are open file handles on a partition , then the partitions wont unmount. i.e. the Linux "umount" command will fail, even AFTER the drive is physically detached.
And if the unmount fails, then on reattachment of the device the mount will fail. So we will have to find out which processes are using the drive and kill them or close all the handles. And if you cannot do either , then you will have to reboot the box to see your drive mounted. And I can definitely not kill the process using it.
I see no force unmount option , there is a -f option but it is only for NFS.
This sounds very strange,doesn't Linux
accommodate for this scenario where a user simply yanks a drive? Does anyone know how to handle this scenario gracefully in Linux?
Is there any way to find out what file handles are open on a particular partition/device or selectively flush and close all file handles only for a particular device ?
lsof is not available in the embedded linux that I am using. lsof is not available in busybox.