title: How to programmatically retrieve UUID of root disk partition in OS X?
body: <p>I can retrieve an OS X disk partition UUID by this code:</p>
  
  <pre><code>void PrintUUID() 
  {
      DADiskRef disk;
      CFDictionaryRef descDict;
      DASessionRef session = DASessionCreate(NULL);
      if (session) {
          disk = DADiskCreateFromBSDName(NULL, session, "/dev/disk0s2");
          if (disk) {
              descDict = DADiskCopyDescription(disk);
              if (descDict) {
                  CFTypeRef value = (CFTypeRef)CFDictionaryGetValue(descDict,
                      CFSTR("DAVolumeUUID"));
                  CFStringRef strValue = CFStringCreateWithFormat(NULL, NULL,
                      CFSTR("%@"), value);
                  print(strVal); &lt;------------- here is the output
                  CFRelease(strValue);
                  CFRelease(descDict);
              }
              CFRelease(disk);
          }
      }
  }
  </code></pre>
  
  <p>Above code retrieve UUID of disk0, I want to retrieve UUID of root disk (mount point = /),
  if I use "/" instead "/dev/disk0s2" then DADiskCopyDescription returns NULL.
  Also I know I can do it in Terminal by this command:</p>
  
  <pre><code>diskutil info /
  </code></pre>
  
  <p>Briefly how can I retrieve BSD Name of root disk? (to use it in DADiskCreateFromBSDName) </p>
  
  <p>Anybody has an idea?
  Thanks.</p>