Archive for September, 2011

2011-09-30

Find the UUID of a disk to use in fstab

To find the UUIDs of devices, just run blkid. This will print UUID, which type of file system the partition is using, as well as its label if it has one.

To use the UUID in /etc/fstab, just copy the UUID and paste it into fstab, and it will mount that specific disk regardless of where it is located in /dev/ (which tends to change from time to time with removable storage devices).

# blkid
/dev/sda1: UUID="d8aa67a2-2b1c-41d9-b31f-9452c17a1fe5" TYPE="swap"
/dev/sda2: LABEL="System Reserved" UUID="140025B70025A12A" TYPE="ntfs"
/dev/sda3: LABEL="Windows" UUID="307468D67468A078" TYPE="ntfs"
/dev/sda5: UUID="9ed324ed-ce0a-4cd3-b2b5-439a08c622c5" TYPE="ext4"
/dev/sda6: UUID="8ae1edc4-2198-4207-b826-7817a4621394" TYPE="ext4"