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:

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


1 Answer 1


/dev/sdb is the whole device. /dev/sdb1 is one partition on that device.

While you could use a disk without partitioning it, that's rather unusual (outside of RAID setups, but then you make the filesystems on the raid device nodes, not the physical device nodes).
It doesn't really make sense to try to detach (physically remove) a single partition – you want to remove the whole device (that can contain multiple partitions), not just one partition of that device.

Unmounting a partition will synchronize the filesystem, so calling sync before unmount is not necessary.
Calling udisks --detach on the device checks that you have no filesystems mounted on that device (you should make sure that that call does indeed succeed), and will perform an "orderly shutdown", which is always preferable to a "pull the plug" approach, regardless of whether that particular device does anything special.

  • I had no idea that just /dev/sdb represents the entire device which I presume represents all partitions. Is that correct? So I could just run the command as udisks --unmount /dev/sdb && udisks --detach /dev/sdb if I want to unmount all the partitions? Makes so sense to just unmount one partition if multiple partitions exist. May 30, 2012 at 20:45
  • How do you also make sure that the call udisks --detach does succeed? May 30, 2012 at 20:48
  • No, unmounting /dev/sdb won't work. You need to unmount each mounted partition, and look at/parse the output of the commands.
    – Mat
    May 31, 2012 at 5:52
  • Sorry, don't quite follow what you mean by look at or parse the output the commands? Shouldn't I unmount each partition and then run the command udisks --detach /dev/sdb? Jun 6, 2012 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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