Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.)

share|improve this question

3 Answers 3

up vote 9 down vote accepted

"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" button
  • udisks --detach for the "Safe Removal" button
share|improve this answer
    
Thanks. Makes perfect sense. –  trench Oct 20 '10 at 0:53
1  
I believe "Safe removal" is not the same as "eject". When you eject your USB drive through your file manager, you will still see it in your Disk Utility as unmounted but not safely removed. It means "Unmount" is the same as "eject". –  user2814 Oct 20 '10 at 1:46
    
Agreed, rEnr3n. That was the only portion of the question that still remained fuzzy to me, but given the rest of the answer was precisely what I was looking for I marked it as accepted. Do you think I should reopen this? –  trench Oct 20 '10 at 5:36
    
No, "eject" is not the same as "unmount", as udisks still sees the device but doesn't see the partitions anymore after doing the eject in Nautilus. Seems more like it's somewhere in between (or a bug maybe?). –  JanC Oct 20 '10 at 9:48

Mounting 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 folder

Also 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.

share|improve this answer
    
Quality information; thank you. I'm going to be asking another question regarding –  trench Oct 20 '10 at 5:43

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.

share|improve this answer
    
Your answer doesn't really an answer to the question. –  Anwar Shah Nov 18 '12 at 6:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.