views:

569

answers:

2

I know the UUID of a volume - as found in Disk Utility.

How can I get additional information on the volume? Most importantly, I want to know its mount point.

Looking at /etc/fstab doesn't do the trick. This does not list the root volume. I would at least need to figure out the UUID of the root volume to verify my known UUID against it.

+1  A: 

There are a couple of ways you can do it. If you want a list of all the UUIDs in your system you can typically look at /dev/disk/by-uuid/ .

This folder contains a symbolic link mapping uuids to device locations. On my system it maps as the following:

[sean@vladimir ~]$ ls -al /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 300 2010-02-02 22:42 .
drwxr-xr-x 6 root root 120 2010-02-02 22:42 ..
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 02123883-6538-4c74-bc74-362eb2588d2b -> ../../sdc4
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 1ce37cd8-52b0-4442-98b5-3702194644f2 -> ../../dm-5
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 1d718419-8175-446c-a01b-51e895d59467 -> ../../sdc7
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 382a64d7-68fe-45a3-87d3-ae7b7a861067 -> ../../dm-1
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 47ab8e51-4023-4bec-a888-576879fba2dd -> ../../sdc1
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 5b4e6b94-f7c7-40c1-a4ee-ca555efc97df -> ../../dm-4
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 6d1df3de-b408-4942-a2e3-78244a68cece -> ../../dm-0
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 c7f841db-8b38-403e-9bcc-926c18deadfc -> ../../sdc6
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 db3f2c47-e29d-4b33-a462-6230ed2bcea8 -> ../../dm-2
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 e5bd9df3-65f7-4815-839f-8b5fad82bc50 -> ../../sdc5
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 ea28833b-fa7b-465d-992b-c333b288233b -> ../../sda1
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 ebb72c56-8776-4e7d-ace9-fc727239f999 -> ../../sda2
lrwxrwxrwx 1 root root  10 2010-02-02 22:42 fd75f53b-6058-467b-9e0f-0a725e7bc83e -> ../../dm-3

Alternatively, you can run 'blkid /path/to/dev ' for each of your devices to find which is the one you are looking for. Likewise, on my system it appears as such:

[sean@vladimir ~]$ blkid /dev/sda1
/dev/sda1: LABEL="restore" UUID="ea28833b-fa7b-465d-992b-c333b288233b" TYPE="ext4" 

Hope that helps.

Sean Madden
There is neither a blkid command nor a /dev/disk/by-uuid directory on Mac OS X as of 10.6.1.
Peter Hosey
+3  A: 

You can use diskutil to look up the disk by its UUID, and the -plist option to get the output in a machine-parseable format:

diskutil info /Volumes/RAM\ Disk | grep -F UUID                                     %~(0)
   Volume UUID:              EA20BE94-5F3C-3C02-901D-A213B5AB6831

diskutil info -plist EA20BE94-5F3C-3C02-901D-A213B5AB6831                           %~(0)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
<plist version="1.0">
<dict>
    <!--snip-->
    <key>MountPoint</key>
    <string>/Volumes/RAM Disk</string>
    <!--snip-->
</dict>
</plist>

You can use NSTask and NSPipe to run diskutil from within your program and capture the output.

Peter Hosey
This does the trick.Thank you, Peter!
Pierre Bernard