Re: looking for sample code to read UUID from a disk volume.
Re: looking for sample code to read UUID from a disk volume.
- Subject: Re: looking for sample code to read UUID from a disk volume.
- From: "Herb Petschauer" <email@hidden>
- Date: Wed, 9 Apr 2008 12:05:05 -0700
There may well be sample code to do this, but I initially learned to
do this from IORegistryExplorer.app (which is open sourced under
Darwin, IOKitTools). For all I know diskutil is in Darwin as well...
Do an "ioreg -l" in your Terminal window, search on "UUID". Note that
each volume/partition has something like :
| | | +-o Untitled@2 <class IOMedia,
registered, matched, active, busy 0, retain count 9>
| | | | | {
| | | | | "Leaf" = Yes
| | | | | "Writable" = Yes
| | | | | "BSD Minor" = 2
| | | | | "IOBusyInterest" = "IOCommand is not
serializable"
| | | | | "Partition ID" = 2
| | | | | "Preferred Block Size" = 512
| | | | | "UUID" = "some value
Now, I found the same info in IORegistryExplorer by exploring
IODeviceTree/PCI0@0/SATA (etc, etc). If IORegistryExplorer can
display it then you can find out how as well.
The IORegistryEntryXXX routines are your friends (IOKitLib.h in the
IOKit framework).
If someone posts with sample code, then bonus ;-)
And note that only a GUID partition table scheme will yield partitions
with a UUID. The old style Apple Partition Map will not (so any
legacy or even current PPC machines).
Cheers,
-H.
On 09/04/2008, Kenny Leung <email@hidden> wrote:
> Hi All.
>
> I can see from diskutil that a volume has a UUID:
>
> kenny@alumintel>diskutil info /
>
> Device Node: /dev/disk0s3
> Device Identifier: disk0s3
> Mount Point: /
> Volume Name: Tiger
>
> File System: Journaled HFS+
> Journal size 16384 k at offset 0x3e0000
> Owners: Enabled
> Partition Type: Apple_HFS
> Bootable: Is bootable
> Media Type: Generic
> Protocol: SATA
> SMART Status: Verified
> UUID: 00826A1E-B3EB-3764-8CB0-867AFBB0FF83
> Total Size: 123.7 GB
> Free Space: 9.7 GB
> Read Only: No
> Ejectable: No
>
> I am looking for sample code to obtain the UUID. Any pointers are greatly
> appreciated!
>
> -Kenny
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden