Where does OSX store volume names?

1

I'm curious as to where OSX stores the names of mounted volumes. For example, if I connect my external USB hard drive, mount it and change the name to something else, how does OSX remember the name the next time I mount it? It seems like this should be stored on the volume itself, but I don't see any file that might contain this name. The only file that's created is the ".DS_Store" file, but this does not contain the volume name as far as I can tell.

If it's not store on the volume then how does the OS realize it's the same device being connected?

vonhogen

Posted 2011-12-20T10:46:54.530

Reputation: 1 949

Answers

5

This information is stored outside the file systems in the device's partition table (or equivalent data structure). That's why you don't have to mount volumes to e.g. see their names in Disk Utility.

It depends on how the disks are formatted, modern OS X uses GPT by default.

Internally, OS X also uses GUIDs/UUIDs (128 bit numbers) to identify volumes.

Use /usr/sbin/diskutil to access metadata about disks and volumes.

Daniel Beck

Posted 2011-12-20T10:46:54.530

Reputation: 98 421

Actually it may be stored on the volume itself, but not in a file. I'm not 100% certain however of where it is on the disk. I believe it is stored in what Apple calls the "Finder Info" of the volume. The volume identifier (which is not an UUID and is 64 bits only) is stored there. The UUID that Apple shows you is computed every time for display purposes using the Version 3 UUID algorithm from the volume id and a fixed "namespace" id. The UUID that is stored in the GPT is a separate thing (Apple calls it the "Media UUID"). – Analog File – 2014-12-02T22:38:03.907

0

I posted this as a comment to the accepted answer, but I think it really is an answer, so I'm reposting it.

I think it is stored on the volume itself, but not in a file. I'm not 100% certain however of where it is on the disk. I believe it is stored in what Apple calls the "Finder Info" of the volume (which, if I remember correctly, is part of the volume header data which is stored in sector 2 of the volume). Note that an HFS+ volume has a name even when it is not saved on a partition (for example if it's just a file, as is the case for so called "disk images", which really, at least in some cases, are just "partition images").

Even the volume identifier (which is not actually an UUID and is 64 bits only) is stored there.

The volume UUID that Apple shows you (which is 128 bits) is computed every time for display purposes using the Version 3 UUID algorithm from the 64 bits volume id and a fixed "namespace" id. The UUID of the partition which is stored in the GPT is a separate thing (Apple calls it the "Media UUID").

Analog File

Posted 2011-12-20T10:46:54.530

Reputation: 216