I always thought that to safely remove a device that had been mounted was to use the umount
command and until recently when I switched to Ubuntu 12.04 LTS, I noticed that there was the ability to safely remove the device which struck my curiosity.
I dug around a number of posts and found that umount
apparently doesn't mean I can safely remove the device because it doesn't power down the device. I know there is the option to eject
. Now this is my understanding after scouring the Internet. References include:
- The “Unmount”, “Eject” and “Safely Remove Drive” dilemma
"eject" / "unmount" / "safely remove drive" - which is better?
- umount only unmounts a single partition on the device
- safely remove unmounts all partitions on the device and powers down the device
- eject is used to media such as CDs, DVD, etc
I then came across an article but found the process convoluted and I think I finally hit pay dirt when I came across the command udisks
e.g. udisks --unmount /dev/sdb1 && udisks --detach /dev/sdb
What confuses me is (aside from whether umount
actually means it is safe to remove the device without data loss and whether I need to use the command sync
prior to it as well as that the device has powered down which safely remove seems to achieve) is why do I have to use /dev/sdb
followed by --detach
as opposed to /dev/sdb1