System > Administration > Disk Utility
What's the difference between "Unmount Volume" and "Safe Removal"? Say you insert a flash drive and open the Disk Utility UI, if you click on "Safe Removal" you receive an "Error Detaching Drive" notification, because it's busy. You must first click the "Unmount Volume" button, and then follow it with the "Safe Removal" button.
A couple questions here: Does this mean all these times I've been "ejecting" the drive (via context menu) before removing it, I haven't been "safely" removing it? And what are the command line equivalents for the two different operations?
(This question was somewhat addressed here but the answers seem to contradict what I'm pointing out about the Disk Utility options. Thanks.)
"Unmount" unmounts a filesystem. If your USB mass storage device (e.g. USB memory sticks or USB hard disks) contains more than one partition, this will only unmount the filesystem on the currently selected partition.
"Safe removal" does the same as "eject" I suppose. In case of USB mass storage devices it powers down the device, which makes it inaccessible (it will disappear from the device list until you unplug & plug it in again). Powering down the device before unmounting would have the same result as disconnecting the usb device without unmounting: possible data loss.
From a usability point of view, it would be better if clicking the "safe removal" button for a device that still has mounted filesystems on it would just ask if it's okay to unmount those filesystems, or maybe even just do that without asking, because that's most likely what the user wants...
The commandline-equivalents of the Disk Utility buttons are:
udisks --unmount
for the "Unmount" buttonudisks --detach
for the "Safe Removal" buttonMounting a volume means putting it somewhere in the file system so that it's data becomes available. For example, mounting a flash volume named
MyFlash
usually creates to a folder named/media/MyFlash
from which it's contents can be accessed.Unmounting it means making it's data unavailable through the file system. That means either:
/media/MyFlash
does not exist any more after unmounting, or/media/MyFlash
is an empty folderAlso you unmount one partition at a time. If you have multiple volumes (partitions) on your drive, you need to unmount each one separately.
Safely removing a drive means the kernel USB module does not care about the drive any more. Any outstanding data that will be written, the device will be powered down (though there will still be voltage going out of the USB port). Only after this has finished should you remove the drive from the USB port.
Even if the kernel writes all it's data through the USB port, some devices, especially external (rotating) hard drives, may buffer this data and not write it to the disk immediately. Just unmounting all partitions and pulling away the USB cable may leave data in these buffers unwritten to disk and thus lost. However, when safely removing the drive the kernel tells the drive to make sure all data is written and waits until the drive confirms to have done so.
Technical info
The kernel associates some special files with devices. Say we have a device
/dev/sdc
with two partitions/dev/sdc1/
and/dev/sdc1
. Mounting and unmounting operations make use of these files and formatting tools use them to write data directly to the partition. But when you "safely remove" the drive the kernel no longer associates any/dev/sdc*
file with your drive.As long as the drive is not "safely removed", but just "unmounted" there is still a way for applications and the kernel to write to the disk, and there is no guarantee that the kernel has finished writing it's buffers to disk, or that the disk has finished recoding them.
If I use safe removal on a pendrive, then I'm not able to use any other pendrive. Ubuntu doesn't recognize that I have plugged a pendrive at all. (nothing shows on /var/log/messages)
This was on ubuntu version 10.04, maybe it's fixed now.