Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Saturday, April 26, 2008

UUID

stable root device
Given: server with SCSI disk for the system plus a SCSI storage in the back. The SCSI disk uses another driver than the SCSI storage. Installing Debian etch via grml is no problem, the system disk is /dev/sda, the SCSI storage is bound to /dev/sdb. But: 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. (Side-note: the grml-kernel does not have this problem, it just boots the system without any problems at all. 8-))

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

# xfs_admin -L test /dev/hda1
writing all SBs
new label = “test”

# findfs LABEL=test
/dev/hda1

Problemas arranque grub, uuid identico en dos particiones

No comments: