Thanks drs305. It works!
It would be great if the moderators could split this thread starting at post #8. At that point the conversation turned to using labels with grub2. This is an important question I think. I have seen a lot of people asking about it and I have not found a good solution yet. But the approach drs305 suggested does work. So it would be nice to have it in a new thread with a proper title that reflects grub2 and labels.
Let me summarize what I did. I hope others comment in regard to whether all these steps are necessary and accurate. But this IS WORKING for me.
1. changed /etc/defaults/grub
uncommented this line and used quotes around true:
Code:
GRUB_DISABLE_LINUX_UUID="true"
2. changed /etc/grub.d/10_linux as follows:
Code:
auto_label="`e2label ${GRUB_DEVICE_BOOT} 2>/dev/null`"
linux_root_device_thisversion="LABEL=${auto_label}"
cat << EOF
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
3. changed /usr/lib/grub/grub-mkconfig_lib as follows. I know this code could be improved by including it in a proper conditional, but I didn't know how to do that. So it just executes always.
Code:
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
# otherwise set root as per value in device.map.
echo "set root='`${grub_probe} --device ${device} --target=drive`'"
#if fs_label="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
#echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
#fi
auto_label="`e2label ${device} 2>/dev/null`"
echo "search --no-floppy --label ${auto_label} --set root"
Those changes generate perfect (as far as I'm concerned) stanzas in grub.cfg. And my test machine boots as expected.
Code:
menuentry "Linux Mint 9, 2.6.32-21-generic (/dev/sda1) -- recovery mode" --class linuxmint --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --label my_label --set root
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=LABEL=my_label ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
my /etc/fstab also uses labels. Here's an example (although this exact example is from another machine)
Code:
LABEL=home_volume /home ext4 noatime,acl,user_xattr 1 2
LABEL=root_volume / ext4 noatime,acl,user_xattr 1 1
LABEL=swap_volume swap swap defaults 0 0
LABEL=boot_volume /boot ext2 noatime,acl 1 2
Bookmarks