Valery's Mlog

Mindlog of a Freak
July 30th, 2006 by Valery Dachev

Debian Installer, SATA and Software RAID

Yesterday I had to completely reinstall a server. It came with two Hitachi 250 Gb SATA HDDs installed on a ALi M5281 SATA RAID Host Controller. However I prefer using software RAID-1 array as there are no spare disks and it would be hard to find exactly the same drive in case one of these ones fail a year or two later. I had already downloaded and burned the netinst image of Debian-Installer, so I just had to run through the quick installation process. I really hoped its developers have fixed the problems with booting from software RAID… but they haven’t (or it’s probably a problem with booting from non-IDE drives). GRUB simply cannot find the correct device to boot from. Fortunately, we have a very, very quick workaround. The following procedure is helpful in all cases GRUB fails to install correctly, because it gets a bit harded to boot into the installed system (especially when on RAID) and reinstall grub.

Let’s say you have two SATA drives – /dev/sda and /dev/sdb, you’ve created a RAID array /dev/md0 (using /dev/sda2 and /dev/sdb2 for example) and you’ve installed the base system on it. Right after you install GRUB, you’re presented the “Finish Installation” dialog that warns you your system is about to reboot. Don’t let it do so:

  1. switch to the spare console using Alt+F2 and press “Enter” to enable it;
  2. type “chroot /target” – we’ll work on the volume the system is installed;
  3. enter the GRUB shell by typing “grub“;
  4. type “device (hd0) /dev/sda” so GRUB should know which one the BIOS device (hd0) really is (I suppose it’s /dev/hda by default);
  5. select the root partition with “root (hd0,1)” if you’ve used /dev/sda2 for your partition in the array (use (hd0,2) for /dev/sda3 and so on..). GRUB should tell you it has found a partition type 0xfd (Linux RAID Autodetect) with its respective filesystem type.
  6. install grub on (hd0) with “setup (hd0)“;
  7. if you’re setting up RAID-1, repeat the last three steps for each drive replacing /dev/sda with drive’s device name;
  8. type “quit“, switch back the the main console with Alt+F1 and let the installer reboot the system.
  9. pray I was right. :)

Cheers ! :)

Comments

One Response to “Debian Installer, SATA and Software RAID”
  1. Worked for me.
    Thank you very much.
    Regards

    Diego

Leave a Reply

%d bloggers like this: