Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 1 down vote accepted

As far as I can tell, the volume UUID you're referencing in Mac OS X comes from that volume's entry in the GUID Partition Table (GPT). It appears that the HFS+ volume format has no place for a 16-Byte UUID, it only has room for the traditional Mac 16-bit volume signature. But the public documentation of the HFS+ volume format hasn't been updated in quite some time, so it's possible Apple updated the format to have a place in the Volume Header (or elsewhere in the volume's data structures) for the UUID, but didn't tell anyone. Inspecting the Darwin sources might give you more information.

If I'm right that this UUID comes from the GPT, your scheme might not work on drives using the PC legacy "Master Boot Record" (MBR), or the Mac legacy "Apple Partition Map", because I doubt that those methods of tracking the locations of partitions on a disk have a standard way to store UUIDs. So HFS+ volumes on an Apple Partition Map drive might not have UUIDs.

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/

Now the piece I don't know is how an HFS+ volume's internal UUID relates to the UUID for that partition in the GPT. I don't know if they are required to be the same, or if they can be different. I have a hunch they're unrelated and can be completely different. 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.

I feel like I'm answering your question from the perspective of HFS+ volumes on GPT drives, but upon re-reading your question, I think you might be wondering if the same is true for NTFS and FAT32 volumes on MBR drives as well. If you update your question to make that clear, maybe I or someone else can help you with the Windows-MBR-NTFS/FAT side of the question.

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.