Name that disk: what to call your storage

Because OS X is a hybrid operating system, a piquant mixture of Unix and NeXTSTEP, with a dash of Classic Mac OS, some parts of it offer a profusion of different naming systems. Among the most confusing are storage devices such as hard drives and SSDs.

For a start, in recent versions of OS X, we now have CoreStorage, which can group different storage devices together in logical groups. You will already have noticed this if your Mac has a Fusion Drive, and that is detailed here.

Even Macs running older versions of OS X, and those which have no CoreStorage devices, have drive naming which seems complex.

Disks and volumes

Under traditional (not CoreStorage) conventions, every physical storage device consists of a named disk, on which there are one or more volumes, its partitions. In Disk Utility, that guarantees at least two entries in the list at the left side of the main window. The upper item (with the disclose triangle beside its name) is the physical disk, and those listed below it are its volumes (partitions).

So my external (hardware) RAID drive, which is in fact four separate hard disks, is listed as one external physical disk, named Promise Pegasus R4 Media. On it is a single physical volume, named PROMISE PEGASUS, which is formatted using the standard OS X Extended (HFS+) file system.

Mount points and paths

If you want to refer to a volume in a script, for example, you need to know what is termed its mount point, and the path from there to any folder or file within the volume. Your startup volume is always mounted at the top or root level, so to refer to the Applications folder on that volume, you would use the path
/Applications

Other local storage volumes are mounted from the top-level folder /Volumes. So if you wanted to refer to the Applications folder on my PROMISE PEGASUS volume, the full path to it would be
/Volumes/PROMISE PEGASUS/Applications
Note that this contains a space, which can make its use in scripts more complex. To list the contents of that folder using Terminal, if I typed in
ls /Volumes/PROMISE PEGASUS/Applications
then the command shell would see that space as marking the end of the path, and return an error. So I have to quote the path, as
ls "/Volumes/PROMISE PEGASUS/Applications"
for the command to work properly.

A quick way to see a list of all the currently mounted volumes – except for the root volume – is to list the top-level folder /Volumes,
ls /Volumes

BSD devices

The Unix view of disks and volumes is similar, but it uses device names which are completely different. You will see these in certain errors reported in the logs in Console, for example, and they can readily confuse.

BSD classes disks and volumes as devices, and gives them terse names. Under El Capitan, your startup volume may be known as disk2, or as a volume off disk2 such as disk2s2. My external RAID drive is known as disk3, and the RAID volume is disk3s2.

Discovering and converting between names

namediskdiskutil

There are two simple places to look when you need to work out which drive or volume is which: the lower section of Disk Utility’s main window, which gives mount points and BSD device names, and the System Information window which can be shown from the About This Mac dialog, in the Apple menu. In the latter, the Storage item in the Hardware list gives the same information.

namedisksysinfo

The Classic Mac OS twist

Because Apple’s Classic Mac operating system evolved independently of Unix, MS-DOS, and everything else, it uses a colon rather than a slash to separate the elements within a path, and starts the path using just the volume name. So it would consider my main Applications folder as being at
Macintosh HD:Applications
and that on my external RAID drive as
PROMISE PEGASUS:Applications

The only time that this is likely to trip you up is when using scripting languages which still use the Classic naming system with colons, such as AppleScript. AppleScript provides the valuable POSIX file and POSIX path code to deal with that, such as when you are constructing a command to send to the shell.

This is why you cannot have a Finder file or folder name which contains a colon, nor a command-line level path which contains a slash. If you put a slash in a file or folder name in the Finder, it will be seen at the command line as using a colon instead; the reverse is also true. The best plan is not to use slashes or colons in folder or file names, and then you can’t go wrong.

Where’s the C: drive?

If you ever run an app which asks for the C: drive, you can be confident that it is a lemon, and ask for your money back. Macs have never used the MS-DOS naming convention of C: drives, although you will come across them when using PC virtualisation and similar tools.