I have a machine running Debian 6. Because of some recent changes, I tried upgrading to Grub2 (yes, grub legacy was installed by default). Everything went well (chainloading, reboot) until I started "upgrade-from-grub-legacy". The machine has 2 harddisks which contain two software raid1 – /dev/md0, a small one containing /boot and /dev/md1 using the remaining capacity.
Parted shows me:
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 512MB 512MB primary ext2 raid
2 513MB 2560MB 2047MB primary linux-swap(v1)
3 2560MB 954GB 951GB primary ext3 raid
and for the second disk:
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 512MB 512MB primary ext2 raid
2 513MB 2560MB 2047MB primary linux-swap(v1)
3 2560MB 954GB 951GB primary ext3 raid
The dialog for "upgrade-from-grub-legacy" shows:
[ ] /dev/sda (1000204 MB; Hitachi_HDS721010CLA332)
[ ] /dev/sdb (1000204 MB; Hitachi_HDS721010CLA332)
[ ] /dev/md0 (511 MB; ???)
[ ] /dev/md1 (951308 MB; ???)
but no matter which I select, it fails saying:
/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.
As far as I could guess from various posts, there should be a boot_grub Flag somewhere.
Can I use Grub2 in my current configuration, if yes, how and is it safe to reboot in the current stage?
Best Answer
Okay, I figured it out.
The problem was that grub2 needs space to save the stage2 loader to - and in my configuration, there was none.
The solution was to shrink Partition 1 on both disks using resize2fs, parted and mdadm by taking out one disk at a time from the RAID.
I shrank 16MB of the front of Partition 1, retried "upgrade-from-grub-legacy", installed to /dev/sda AND /dev/sdb, because the machine may boot from either one. Everything went well, reboot - and it was done.
So, in summary: Yes, I can use Grub2, but I had to rearrange the partitions to make space for stage2. Yes, it was safe to reboot as long as "upgrade-from-grub-legacy" had not finished because the chainloader with grub1 was still in place and working.