12

If I use the Debian Stable (Squeeze) Installer to install Debian, booting from a RAID1 pair of drives, does it write grub to the MBR of both drives - if not, how should I best protect against a drive failure - if I just clone the MBR won't it still point to the failed device?

  • this should probably be tagged [tag:grub-legacy] rather than [tag:grub] but I don't have the rep to create the tag –  Nov 28 '11 at 16:05
  • 2
    [Grub2 is the default bootloader](http://wiki.debian.org/Grub) for Debian Squeeze. – jasonwryan Nov 28 '11 at 17:49
  • Sorry - `grub-install -v` reports `grub-install (GRUB) 1.98+20100804-14+squeeze1` which as you say is Grub2 –  Nov 28 '11 at 18:11

2 Answers2

14

Not sure if the installer does it by default, but if (once the system is booted) you run:

# dpkg-reconfigure -plow grub-pc 

just hit enter until you're prompted for "GRUB install devices", then you can select the MBRs of both drives.

Here is a screenshot of the relevant screen in Debian Jessie (8.3), with GRUB2 version 2.02~beta2-22+deb8u1. This shows the setup of my computer, which has two drives (/dev/sda and /dev/sdb) in a RAID 1 configuration (/dev/md1), and two other drives (/dev/sdc and /dev/sdd) in a RAID 1 configuration (/dev/md0).

enter image description here

Faheem Mitha
  • 34,649
  • 32
  • 119
  • 183
derobert
  • 107,579
  • 20
  • 231
  • 279
  • Thanks. Does the MBR then point at one particular device and if so would they both point at the same device (which would be bad if that one failed)? –  Nov 28 '11 at 15:03
  • The MBR should point the to device the MBR is on. Or possibly the first device. BIOSes make this hard to get right, you should test it to be sure. Pull the power cable off of each of the disks (one at a time). If you get to the grub menu, then you should be good. – derobert Nov 28 '11 at 15:14
  • Each disk will have its own MBR and embedded grub2 core image that will look for your /boot. If your /boot is in an mdadm raid1, then it will find it on either disk. – psusi Nov 28 '11 at 15:39
  • @psusi grub legacy is still the default with the stable debian installer –  Nov 28 '11 at 15:59
  • saying that I'd consider installing grub2 if it is straightforward and does what you say? –  Nov 28 '11 at 16:00
  • @JackDouglas, yes, then I'd suggest manually installing grub2 instead ( the grub-pc package ). It is leaps and bounds better than grub-legacy. Among the fancy things grub2 can do are boot from an LVM volume in a raid0 ( without a /boot partition ). – psusi Nov 28 '11 at 16:11
  • "Pull the power cable off of each of the disks (one at a time)." - finally got round to testing this for real - works perfectly, thanks –  Jan 07 '12 at 13:58
  • Per the screenshot I added, I'd appreciate some clarification as to why GRUB needs to be installed to `/dev/sda` and `/dev/sdb`, and not `/dev/sdc` and `/dev/sdd`? – Faheem Mitha Feb 21 '16 at 15:51
2

If you install Grub legacy, then it's only installed on the one boot disk. You can add it to the second disk's MBR by running grub-install /dev/sdb (assuming that your second disk is /dev/sdb). Make sure that in both cases, Grub reads from the first BIOS disk (you may need to tweak /boot/grub/device.map for that). If one of the two disks fails, whichever disk is left will be the first BIOS disk.

You can install Grub2 on Debian squeeze, and I recommend that if you have any sort of nontrivial setup such as RAID. Grub2 has the advantage that you can put your whole system on LVM, you don't need a non-LVM /boot partition. As far as I know, the squeeze installer supports installations over RAID+LVM with grub2 (you may need to coerce it a little not to create a separate /boot partition).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • My apologies for my newbie confusion - I assumed v1.98 was not Grub2, Grub2 is in fact installed. The d-i happily installed booting from a RAID1 array it created btw –  Nov 28 '11 at 18:19
  • The main thing I'm still confused about is whether d-i installed Grub2 to both drives in the arrar or just one - I can test by pulling them out in turn and booting but I wonder if there is a way I can examine the MBR or if there is a tool that will tell me... –  Nov 28 '11 at 18:21
  • 2
  • thanks, interesting. If I understand the output correctly Grub is on `sda` but not `sdb`. I'll follow derobert's suggestion to install on `sdb` as well –  Nov 28 '11 at 22:01