Apple - Difference between "diskutil unmount" and "diskutil unmountDisk"?

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


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.