Today I created a temporary linode to test pv-grub with xen.
I made a Debian 8 "deployment" in /dev/xvda and another one in /dev/xvdc.
Then I booted with a menu entry like this one:
Code:
title Debian GNU/Linux, kernel 3.16.0-4-amd64
root (hd0)
kernel /boot/vmlinuz-3.16.0-4-amd64 root=UUID=f5cea9b5-6b12-4b1a-880d-6f134d917473 ro
initrd /boot/initrd.img-3.16.0-4-amd64
I expected that it would boot the Debian install at /dev/xvda but to my surprise, it booted /dev/xvdc instead.
The reason: Both deployments had the same UUID!
The UUID is supposed to be random, it's not supposed to be duplicate in the same system.
The UUID thing was created to survive disk name changes (for example, /dev/xvda to /dev/vda when moving from Xen to KVM), so it is a good thing and it should be supported.
Fixing this should be quite easy indeed: Create the partition like this:
Code:
uuid=`uuidgen`
mkfs.ext4 -U ${uuid} /dev/whatever
Then instead of a fixed /etc/fstab, generate it with a template, like this:
Code:
sed -e "s/ROOTUUID/${uuid}/" /mnt/etc/fstab.in > /mnt/etc/fstab
rm -f /mnt/etc/fstab.in
You get the idea. Alternatively, use "tune2fs -U randomuuid" after mkfs.ext4 and something like the above replace with sed.
The good thing is that there is no initrd to regenerate, so this is probably everything that needs to be done.
Thanks.