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 [EMAIL PROTECTED]  <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/[EMAIL PROTECTED]/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 PROTECTED]> wrote:
> Hi All.
>
>  I can see from diskutil that a volume has a UUID:
>
>  [EMAIL PROTECTED]>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 (Cocoa-dev@lists.apple.com)
>
>  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:
> http://lists.apple.com/mailman/options/cocoa-dev/bogvardi%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to