I put myself a small NAS together, to experiment a bit with raid. I have a working RAID 5 array using mdadm under Debian 6 ("squeeze").

I installed GRUB and Debian to an USB stick, since I was not aware one can actually boot from a raid, so this seemed like the best option. The stick has two partitions on it, an ext3 for / and swap. The raid uses GPT and only has one big ext4 partition on it.

Unfortunately the USB stick is quite slow, at least slower than I expected. It would be awesome if I could get rid of it or only use it for booting purposes. Can I just copy my system folders (i.e. everything under /, except for the mount point of the raid) and reinstall GRUB somehow? I'd prefer to avoid rebuilding and -formatting the array, since there's already quite a bit of data on it.

I found a related question, but the answers are quite mixed and I'm not sure whether I can go that route.

My current plan is to just copy / to the array and reconfigure GRUB (using dpkg-reconfigure grub-pc) on the stick. Could that work? I'd update fstab too of course, but I'm not aware of any other needed changes.

  • 1
    That should about do it. You will need to explicitly grub-install /dev/sdx; update-grub instead of re-configuring the package though. – jordanm Apr 6 '13 at 0:48

Grub can only boot from Linux RAID 5 since version 1.99, if I read the changelog correctly. Debian squeeze comes with Grub 1.98. So you'll need to either boot from the USB stick, shrink the RAID array (possible but annoying), or install a newer Grub. I'd go with upgrading Grub; the Grub packages from Debian wheezy should work.

Beyond installing Grub and copying the files, you'll need a couple of steps on the new system. Run chroot /raid-mount-point and do the following:

  • Update /etc/fstab.
  • Run update-initramfs to regenerate the initramfs, which contains the drivers and scripts needed for your system to boot. Your current initramfs probably doesn't support your RAID array, so if you don't do this, your system won't boot.
| improve this answer | |
  • Thank you, it worked like a charm :). It's blazingly fast. – svens Apr 6 '13 at 10:28
  • By the way, I was unable to update grub from backports. So I just tried it with the installed version (1.98+20100804-14+squeeze1) and it worked. – svens Apr 6 '13 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.