How are BLKID 's Assigned?

387 views Asked by At

Suppose I have a situation like I have installed /etc and /boot in two separate partition which belongs to an USB device , and the rest of the system / and /home in the HDD. Now my question is I need to statically route the USB device in my fstab , but the problem is there is no certainty that the USB will always take say /dev/sdb or /dev/sdc , so my approach would be to use BLKID.

Here I am confused as to whether the BLKID of a particular Hardware Device ( With a static Hardware ID) always the same? if not what is the work around in the situation?

How are BLKID's Assigned ?

1

There are 1 answers

0
James Waldby - jwpat7 On BEST ANSWER

An article modestly called UUIDs and Linux: Everything you ever need to know states that UUID's of disk devices are stored in superblocks, so they are persistent and can be used in /etc/fstab (in place of /dev device references). An example entry in fstab might look like

UUID=8ec0b48f-a4b8-4ca8-bc27-40984b38b2a7 none  swap  sw   0

If you want to change the UUID of an ext2 partition, tune2fs (for example) provides the means. Eg:

tune2fs -U new_uuid /dev/sda43

Also see the blkid man page and to see a list of disk devices organized by UUID, say ls -l /dev/disk/by-uuid.