Monday, July 18, 2011

Linux disks by LABEL and UUID

To list disks by uuid you can issue:

ls -al /dev/disk/by-uuid/

..the answer should be something like:

5d82b8f4-5dfd-4164-8a78-e56cb1d7ea1c -> ../../sdb1

6cc7cb86-f1bc-4c16-833c-c6efa55257d6 -> ../../sda1 find out specific uuid of a specific disk you shoud run:

blkid /dev/sda1

..and you can auto mount in /etc/fstab by specifying the UUID instead of device, for example:

UUID=5d82b8f4-5dfd-4164-8a78-e56cb1d7ea1c /tmp          ext4    errors=remount-ro 0       1

Another way to categorize disks is by label. Of course, you can also auto mount disks in /etc/fstab by labels. To set a label for a disk just type:

e2label /dev/sda1 mylabel


tune2fs -Lmylabel /dev/sda1

..and you can auto mount disks in /etc/fstab like this:

LABEL=/         /      ext3    defaults        1 1


No comments:

Post a Comment