Friday, October 4, 2013

Using UUID's and label for partitions

Using label and UUID can be come very handy when you're using multiple disks or change disks frequently (for any reason). Imagine your machine is powered on. Then you connect the first external disk which will appear as /dev/sdb for eg. /usr. The second external disk that will be connected appears as /dev/sdc for eg. /opt. If you disconnect both disks and connect the second disk for /opt first it will appear as /dev/sdb which was the device entry for /usr before. One chance to avoid that is mounting disks by UUID's. Each partition on a disk has it's own UUID. The UUID can be listed with blkid or lsblk: