11

Sometimes when I try to unmount a disk using the "diskutil" command I get the following message:

$ diskutil unmount /dev/disk1
disk1 was already unmounted or it has a partitioning scheme so use "diskutil unmountDisk" instead

when I replace "unmount" with "unmountDisk" it works perfectly fine.

So my question is, what's the difference between the "unmount" and "ummountDisk" commands?

2 Answers 2

16

From man diskutil:

 unmount | umount [force] device
     Unmount a single volume.  Force will force-unmount the volume (less kind to any open
     files; see also umount (8)).

 unmountDisk | umountDisk [force] device
     Unmount an entire disk (all volumes).  Force will force-unmount the volumes (less kind
     to any open files; see also umount (8)).  You should specify a whole disk, but all
     volumes of the whole disk are attempted to be unmounted even if you specify a parti-
     tion.

So diskutil unmount just ejects a single volume/partition, diskutil unmountDisk the whole disk (including all volumes/partitions).

1
  • Makes sense, the disk I was attempting to eject contained multiple volumes. Thanks! Apr 16, 2016 at 19:27
8

You are using the command incorrectly. When issuing diskutil unmount, you should refer to a partition. You are referring to an entire disk. For example disk0 refers to the entire disk, where as, disk0s1 refers to partition 1 on disk 0. The letter s stands for slice which is another word for partition.

On the other hand, it is Ok to refer to either the entire disk or just a partition when trying to unmount an entire disk. So

diskutil unmountdisk /dev/disk0s1

would be equivalent to

diskutil unmountdisk /dev/disk0

Both unmount the entire disk0.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .