Find device name from UUID
2008 Oct 21 at 23:17 » Tagged as :
Now that most distros, Fedora in particular insist that you use UUIDs instead of device names in the /etc/fstab file, most of us know at least two different commands which can locate the UUID for a given partition. (What's that you don't know even one? try blkid).
What if you want to do opposite; find the device name when the UUID is known? One solution is to just type 'df' and compare the mount points with the contents of the /etc/fstab - that will tell you what the device name is if your partition has been mounted. It will not work for unmounted partitions and the swap. When that happens you can try:
ls -l /dev/disk/by-uuid
On my computer it produces something like this:lrwxrwxrwx 1 root root 10 2008-10-17 15:53 01b06f7e-9dab-4ff0-9d05-b2f7d83b0cab -> ../../sdb1
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 1d5dd1c9-d924-4640-912f-d7f463293625 -> ../../sda1
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 2ccc4b5c-cac9-4479-9c37-8f891ea18db8 -> ../../sdb4
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 65234e85-5d02-47f2-aadc-da5232fdaa0b -> ../../sda5
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 7d745a84-f09f-43cd-b761-e94abdb72fe6 -> ../../sda4
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 85732ed8-4529-4884-9cc3-f03d5f08d60a -> ../../sda6
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 ace70227-ab7f-47f2-b4cd-7fc6d67df3f8 -> ../../sdb5
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 bf695d17-a57c-4f3a-9d55-65fa43c12a -> ../../sda2
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 c0d24b7e-20ce-4a7c-b2c9-7dc61bbfc2 -> ../../sdc1
lrwxrwxrwx 1 root root 10 2008-10-17 15:53 cd291369-3ea2-40a7-baff-1b9261941e74 -> ../../sdb3
This listing can be used to find the UUID when the device name is known and vice verce.