Boot by UUID or disk label 

Newsgroups: gmane.linux.distributions.grml.user
Date: Thu, 1 Feb 2007 10:11:47 +0100
> Grml wiki indicates that grml can use disk labels/UUIDs as root= option
> for booting [1]. What's the correct syntax for that?

http://michael-prokop.at/blog/2006/08/11/stable-root-device-aka-uuid/

mika

Boot by UUID or disk label 

Upcoming grml releases will very probably use mounting by UUID for main partition (the libata merge of >=2.6.19 forces the decision), I've to make sure the upgrade path works fine for all users then.

> A side question, is the UUID get assigned during mkfs or partition
> creation, or...?

The UUID is usually assigned with running mkfs. Some filesystems provide an interface to change the UUID later on, like with

xfs_admin -U $UUID

mika

Stable root device (AKA UUID) 

http://michael-prokop.at/blog/2006/08/11/stable-root-device-aka-uuid/

Given: server with SCSI disk for the system plus a SCSI storage in the back. who guarantees that /dev/sda is always the systemdisk? Using the Debian-kernel with initramfs isn't capable of booting the system via root=/dev/sda1 because /dev/sda1 corresponds to the SCSI storage.

Generic solution: use the power of UUID:

root@grml # /lib/udev/vol_id /dev/sda1 | grep UUID
ID_FS_UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210
root@grml # eval $(/lib/udev/vol_id /dev/sda1 | grep UUID)
root@grml # ls -la /dev/disk/by-uuid/$ID_FS_UUID
lrwxrwxrwx 1 root root 10 Aug 10 11:01 /dev/disk/by-uuid/4a6aed11-42dd-4c82-81ce-8f469e93f210 -> ../../sda1

Now we know the UUID and boot the system via root=UUID=… instead of a root=/dev/sda-entry:

title           Debian Etch, kernel 2.6.15-1-686 (on /dev/sda1)
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.15-1-686 root=UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210 ro
initrd          /boot/initrd.img-2.6.15-1-686

Finally do not forget to adjust /etc/fstab as well for all entries:

UUID=e0164f78-9821-4eaf-bda7-1fd9b43a6f06 /     ext3  defaults,errors=remount-ro 0 1
UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210 /home ext3  defaults                   0 0
UUID=0e88f32f-fb98-4279-b3bc-8edfc2046b5d none  swap  sw                         0 0

mika

Stable root device (AKA UUID) 

# xfs_admin -L test /dev/hda1
writing all SBs
new label = "test"
# findfs LABEL=test
/dev/hda1

documented on: August 13th, 2006 at 23:53, Michael Gebetsroither