oh grub2 how I hate thee

let me count the ways…

infinity plus 1) you think you are smart but you are not,
infinity plus 2) you do not give the people the power they need to help out when you are not smart — see number 1.

I simply wanted to upgrade my 1TB of software raid 1 to 1.5 TB of software raid 1, besides the time for copying and syncing it should be a slam dunk, but thanks to grub2 it was a super utter cluster f*ck.

I started by transitioning to a non mirrored 1.5 Tb disk with boot, swap and root, then after I was able to boot that, I built a set of degraded raid1’s on the other disk and then tried to bring the the first 1.5.

however my partition on the first half of the degraded raid was slightly larger than partition on the second half, I tried to resize it but then it wouldn’t boot… so I got to do the whole 1TB copy with billions of hard links over again… These are the steps to resize a raided partition if you are not using it for root http://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid

Finally on the system 10 days later, still need to add the other half of the degraded disk, but this time they are the same size.

For grub2 help this page was helpful, (mostly pages 2 and 3): http://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-system-incl-grub2-configuration-ubuntu-10.04

I also manually updated the device map /boot/grub/device.map which may have helped things, dunno…

There was a post I read along the way but can’t find the URL that talked about using chroot, after mounting some things like dev and proc into the future chroot, that sounded promising, but I didn’t have to do that.

I also tried a shit ton of different ways to tell grub to boot my degraded mirror, ran grub-install, update-grub, and update-initramfs many, many, many times, what ultimately seemed to work was to run update-grub and grub-install again after I hacked my way to getting grub to boot up with root on /dev/md2. After the raid is done re-syncing I’ll try to pull the half that I built first and try to boot from the new half.

grub2 help for kernel upgrade on Ubuntu 12.04 domU on XCP

I wouldn’t be posting if this wasn’t yet another corner case, where things don’t work as they should… I likely built my xcp-xapi box at a bad time for xcp-xapi and grub2, hopefully this helps others…

Situation: installing new virtual kernel on Ubuntu 12.04 domU kernel upgrade crashes royally:

Error: Starting VM – Using to parse /boot/grub/grub.cfg – WARNING:root:Unknown directive load_video – WARNING:root:Unknown directive terminal_output – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive export – WARNING:root:Unknown image directive recordfail – WARNING:root:Unknown image directive gfxmode – WARNING:root:Unknown image directive recordfail – WARNING:root:Unknown directive submenu – WARNING:root:Unknown image directive recordfail – WARNING:root:Unknown image directive gfxmode – WARNING:root:Unknown image directive recordfail – Traceback (most recent call last): – File “/usr/lib/xcp/lib/pygrub.xcp”, line 853, in – raise RuntimeError, “Unable to find partition containing kernel” – RuntimeError: Unable to find partition containing kernel

Background: Ubuntu 12.04 dom0 running xcp

Work around (http://blog.403labs.com/post/1546501840/paravirtulization-with-citrix-xenserver-5-5-and-ubuntu):

 xe vm-param-set uuid=<VM-UUID> PV-bootloader-args="--kernel=/boot/vmlinuz-3.2.0-29-virtual --ramdisk=/boot/initrd.img-3.2.0-29-virtual"
xe vm-param-set uuid=<VM-UUID> PV-args="root=UUID=<disk-UUID> ro -- console=hvc0"