The only thing I actually need to know here, is how to force an unmount while device is busy.
umount -f doesn't work. The following description is just background for why I need to do this, in case someone manages to come up with a better solution. If there it is not possible to do this unmount, I'll gladly accept an explanation for why not as the answer.
The problem is, whenever I put my netbook on sleep mode, my mount point becomes broken. The mount does still exist, and running
mount displays it as normal:
/dev/mmcblk0p1 on /home/ilari/storage type ext4 (rw,nosuid,nodev,uhelper=hal)
However any attempt to read/write to it fails with an
If there are any programs open, attempting to unmount the device, fails with
umount: /home/ilari/storage: device is busy
The problem seems to be that the device
/dev/mmcblk0 has disappeared from the system while it was sleeping. But this is where the weird stuff happens. The previous device is still available, only it has now become
/dev/mmcblk1! And I can mount it again to the same point, which makes the output of
mount rather funny
/dev/mmcblk0p1 on /home/ilari/storage type ext4 (rw,nosuid,nodev,uhelper=hal) /dev/mmcblk1p1 on /home/ilari/storage type ext4 (rw,nosuid,nodev,uhelper=hal)
The thing is, when I do this, the mount point works just as it did before the sleep! The programs that were open are able to continue using the file system again, just as if nothing had happened.
But having the system accumulate multiple (failed) devices seems rather sketchy. So I'd like to unmount the previous mount point before remounting the "new" device to the same point.
How can I force the unmount when the device is busy? Preferably automatically at wakeup, and with automatic remount. Any help is appreciated.
(I could of course close all the open programs, and then unmount, but that pretty much defeats the purpose of the sleep mode anyway.)
EDIT: As mentioned in the comments, it's probably a good idea to unmount the system before going to sleep, then remount it at wakeup. In fact, this seems to even stop the device from changing it's index number, so it remains as
/dev/mmcblk0. The problem is I can only unmount it after closing all the programs that are using it. (Note that this works after sleep too - by closing all the programs I can always unmount the broken point.)
umount -f is of no help either, responding with an additional
umount2: Device or resource busy.
I'm using Ubuntu Netbook Remix 9.10 on Acer Aspire One. The mount point is in fstab by the UUID of the file system (which is of course why the remount works even though the device name has changed). Naturally, an alternative slution to this is to stop the device from changing it's number, but I fear that'll be a much harder problem.