So, I ran into a peculiar problem while trying to get my homebuilt 4TB NAS up and running last night. I bought two 2TB SATA drives, and sourced everything else from my old computer boneyard (i.e. my closet). The issue I was having was the Ubuntu 10.10 Server installer kept failing when trying to install GRUB. I eventually tracked this down to an issue installing GRUB to GPT partitions (GRUB requires a BIOS boot partition). Since I’m running a small 5GB partition in RAID1 for Ubuntu, and the rest of the disks (~4TB) in RAID0, I’m exceeding the partition size limitations of MBR, and thus need to use GPT. Fine. The issue is that the Ubuntu installer seems to be unaware of how to handle this situation. Long story short, here’s what you need to do when yours fails:
- Switch to a virtual console (ctrl + alt + F2)
- Chroot into your new Ubuntu environment (the GRUB install happens towards the very end, so Ubuntu is more or less set up at this point). For this example, let’s assume your root is /dev/md0, and it’s a RAID1 array consisting of partitions on /dev/sda and /dev/sdb. Adjust accordingly.
# mkdir /mnt/ubuntu
Update: A few people have mentioned that their fs is not mounted at this point, and it appears that I did miss that step (*smacks head*), sorry about that! I’m writing this next line from memory, I need to run through this again to test, but your RAID array should be up and running at this stage, so simply mounting it to your new /mnt/ubuntu directory will work. Replace the ‘x’ in mdX with the number of the array / resides on (0 in my case).
# mount /dev/mdX /mnt/ubuntu
# mount -o bind /dev /mnt/ubuntu/dev
# chroot /mnt/ubuntu /bin/bash
- Now you’ll be at a BASH prompt, chroot’d into your fresh Ubuntu install. Let’s fire up GNU parted and get the first disk going.
root@host:/# parted /dev/sda
- Hopefully, Ubuntu started the first partition of each drive at least 32kiB in, giving us enough room to stick a BIOS boot partition on each drive. If not, you’ll need to use parted to recreate your entire partition table, then restart the installation, and let the Ubuntu install work with your partition structure (i.e. don’t let it make its own).
(parted) mkpart grub 0 1MB
Ignore whatever warning it gives you, and/or accept whatever rounded partition boundaries it gives you.
- Now we need to set the grub_boot flag on that partition. Let’s find out what partition number it is
Replace <part number> with the partition number for the topmost partition.
(parted) set <part number> bios_grub on
- That’s it. Quit parted.
- Repeat from step 3 for your other drive(s)
- Now that you’ve created a BIOS boot partition on each drive in the array, we can clean up and continue with the install.
# umount /mnt/ubuntu/dev
# umount /mnt/ubuntu
- Switch back to the first console, where the installer is running (ctrl + alt + F1) and try to re-run the grub install. If it fails again, you can mount the new system again, chroot back into it (step 2), and run grub-install on both drives (i.e. ‘grub-install /dev/sda’ and ‘grub-install /dev/sdb’). This should get you back on track. Worst case scenario, you may need to restart the Ubuntu install, just have it leave your partition table alone, and the GRUB install will go smoothly.
Hopefully this saves you several late-night hours.