That was one of those: updates you should’ve skipped. Unless you have a spare, lazy Sunday afternoon. As I just did. The update itself was Lenny 6.0.3 in my case, but this seems to happen in different places at different times – YMMV. Anyway, the package tool apt-get asked me where it should install Grub – and that’s when I got suspicious. I could choose between sda, sdb, md1 or md2 – any regardless of my choice (even multiples selected), the result was a bit disappointing:
/usr/sbin/grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding won't be possible!. /usr/sbin/grub-setup: error: embedding is not possible, but this is required when the root device is on a RAID array or LVM volume.
Just great. Aunt Google isn’t really helpful on this one, so here’s my little How-To.
Warning notice: please (pretty please) follow these instructions ONLY if you know what they mean. Any single command listed here is quite capable. Of messing up your whole system…
I had this scenario: RAID level 1 for /boot and / (and the swap partition. I know, that’s stupid, so let’s change that in the process, too). Here’s my config for reference:
cat /proc/mdstat Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] md2 : active raid1 sda3 sdb3 726266432 blocks [2/2] [UU] md1 : active raid1 sda2 sdb2 2104448 blocks [2/2] [UU] md0 : active raid1 sda1 sdb1 4200896 blocks [2/2] [UU]
The single disks are configured identically like this:
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0004be32 Device Boot Start End Blocks Id System /dev/sda1 1 8401994 4200997 fd Linux raid autodetect /dev/sda2 8401995 12611024 2104515 fd Linux raid autodetect /dev/sda3 12611025 1465144064 726266520 fd Linux raid autodetect
…and that number “1” being the starting block of partition number 1 is the problem. However, I was really lucky: md0 consists of sda1 and sdb1, and md0 only holds my swap partition. So we have to change that one so that it starts “higher” than block 1. Let’s go:
mdadm --stop /dev/md0
…and tinker with partition 1: delete (d, 1), re-create (n, p, 1, 63, [enter your maximum size here]), change type (t, 1, fd), write back (w). If you like, do the same with disk sdb (if you think it’s more aesthetically pleasing to have the RAID partitions the same size for example). Next, reassemble the RAID, this time using RAID-level 0 (striping) for swap (why shouldn’t we?):
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda1 /dev/sdb1
And: beam me up, Scotty:
accompanied by a:
That’s about it. Please don’t forget to re-setup Grub – hopefully without error messages this time. If you do forget, your next reboot might be a bit messy… 😉
Big thanks goes to the folks over at the Hetzner-forums – they had the solution (but inaccessible for Google, that’s why I put it here).