Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some OS X code that uses the volume's UUID for some calculations. I'm rewriting these calculations for Windows. I have the requirement that for a given drive, the calculations produce the exact same results on both operating systems; there's no possibility of changing the calculation to use a better piece of data, such as the disk's serial number.

Unfortunately, I can't find much information on this UUID. The closest piece of data I can find on Windows is the mounted volume name, which takes the form of a GUID; coincidentally, the volume's UUID on OS X is also a GUID.

Is the mounted volume name on Windows the same as the UUID on OS X? Does the volume even know about it's own UUID, or is this relation something held by the OS?

share|improve this question
    
Can you update your question to make clear which volume format(s) you're talking about under Windows? Or which partition table formats and volume formats you hope this will work under, for both Mac and Windows? Right now it almost seems like you might be wondering how to make a Windows box read the UUID from a Mac HFS+ volume. – Spiff Mar 17 '12 at 1:30
    
I don't think my question is file system specific, though it may be; like I said, I'm not completely sure what this UUID is. I figured the UUID wasn't specific to HFS+, but it may be. If this is the case, I don't think there's a solution. Ideally I'd like to support HFS+ and NTFS; I didn't see any notes about the UUID only existing for HFS+ volumes, so I assumed it existed for NTFS volumes as well. – dauphic Mar 17 '12 at 4:09
    
@Spiff: Adding on to that, I have existing OS X code that relies on a GUID derived from the UUID to identify a volume. We also save an identifier on the actual volume, but if the identifier is deleted or can't be saved, the code needs to be able to figure out which volume it is (regardless of which OS the drive is being used with). – dauphic Mar 17 '12 at 4:36
up vote 1 down vote accepted

After spelunking through the Darwin sources, I see that the VolumeUUID is stored in the Volume Header, under FinderInfo.
See http://www.opensource.apple.com/source/hfs/hfs-191.1/hfs_util/hfsutil_main.c
Also browse around here for more info: http://www.opensource.apple.com/source/hfs/hfs-191.1/

The HFS+ VolumeUUID does not relate to the UUID for that partition in the GPT. I just checked on my system and the "Unique partition GUID" in the GPT was completely different from the HFS+ VolumeUUID for my primary boot partition on this system.

Many other file systems also have embedded unique IDs of some sort, although not necessarily UUIDs/GUIDs.

For the record, here are the locations of the unique IDs, such as they are, on some other filesystem formats:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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