Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
this should probably be tagged grub-legacy rather than grub but I don't have the rep to create the tag –  Jack Douglas Nov 28 '11 at 16:05
2  
Grub2 is the default bootloader 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 –  Jack Douglas Nov 28 '11 at 18:11

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
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)? –  Jack Douglas 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 –  Jack Douglas Nov 28 '11 at 15:59
    
saying that I'd consider installing grub2 if it is straightforward and does what you say? –  Jack Douglas Nov 28 '11 at 16:00

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).

share|improve this answer
    
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 –  Jack Douglas 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... –  Jack Douglas Nov 28 '11 at 18:21
1  
@JackDouglas </dev/sda head -c 512 | hd will at least tell you if Grub is present there. You can also see where it's looking next, but I don't know which bytes to look at. –  Gilles Nov 28 '11 at 18:27
    
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 –  Jack Douglas Nov 28 '11 at 22:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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