want to (safely) test raid setup and ability to boot from alternate drives
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
install grub with software raid (mdadm) - safetly boot from alternate drive(s)
Hello all,
I have successfully setup software raid1 with hot spare (total 3 drives) on my system and I want to test its ability to boot from one of the alternate drives if the primary dies.
backup. be sure to have the grub bootloader on all drives MBRs (important w/ sw-raid; grub-install hdX). now just remove one drive.. . there's an alternative way by marking a drive faulty - see man mdadm for more info.
I choose to use RAID1 over RAID5 primarily for reliability over speed.
I bought all 3 drives together and if for some reason 1 dies, I would naturally start to wonder about the other 2. Also, in the rare chance that 2 drives have faults I'm still ok.
I've also read about it and it seems that using RAID5 on a 3 drive setup doesn't really offer a huge amount of performance. I would rather have RAID5 with 5 or more drives.
backup. be sure to have the grub bootloader on all drives MBRs (important w/ sw-raid; grub-install hdX). now just remove one drive.. . there's an alternative way by marking a drive faulty - see man mdadm for more info.
sl, ritch
Thank you. I will try that out sometime this week, when I get a chance.
OK - before I attempt to install grub on my alternate hard drives I want to check to see if it is already installed. I also want to know (after I try to install it) whether or not it is installed.
Is there a way to verify that grub is installed on my alternate hard drives?
Well, I didn't find a (good) way to verify if grub was installed on my alternate drives. The only way I could really find out is unplug my primary drive and boot the system. I was left with a blinking cursor. So I took that as a 'NO'.
After a few searches and fiddling around I found out how to install grub on the alternate drives.
Some of this may be debian specific so double check before using yourself.
I ran:
Code:
grub-install /dev/sdb1
Searching for GRUB installation directory ... found: /boot/grub
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc
grub-install /dev/sdc1
Searching for GRUB installation directory ... found: /boot/grub
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc
Note: If you get an error like "grub: no corresponding bios drive" try running:
Code:
grub-install --recheck /dev/sdx
Where X is your primary drive (ie: sda1)
It checks for all the available drives to boot from and puts them in the device.map file. I choose to just re-install on the primary drive, because it doesn't work if you don't put a drive location... It should IMO - it just updates the device.map. I suppose you can manually alter this file also... but I would read the man page to find out for sure.
Then I ran:
Code:
#grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> root (hd1,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+15 p (hd1,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
grub> root (hd2,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd2)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd2)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd2) (hd2)1+15 p (hd2,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
Finally I added a couple boot entries to my menu.lst for fallback and to manually select if I need to.
my menu.lst (this is VERY debian specific):
Code:
== cut to save space ==
## fallback num
# Set the fallback entry. This allows you to boot from an alternate drive
# if the first drive of the array fails.
fallback 5
== cut to save space ==
### END DEBIAN AUTOMAGIC KERNELS LIST
## Fallback Entry (fallback 5)
title Debian GNU/Linux, kernel 2.6.26 (sdb)
root (hd1,0)
kernel /boot/vmlinuz-2.6.26 root=/dev/md0 ro
initrd /boot/initrd.img-2.6.26
## Fallback Entry (fallback 6)
title Debian GNU/Linux, kernel 2.6.26 (sdc)
root (hd2,0)
kernel /boot/vmlinuz-2.6.26 root=/dev/md0 ro
initrd /boot/initrd.img-2.6.26
I unplugged my primary drive (after shutdown of course) and booted it up. Lo and behold it came alive!
I haven't tried to boot off of one drive, but I'm sure it would work. I'm going to make a boot floppy as an additional backup just in case.
Hope this helps someone.
Last edited by checkmate3001; 08-03-2008 at 04:50 AM.
Reason: fix a code section and add a title
Nice post on raid 1 and grub; I'm sure it'll be helpful for a lot of people who ask the same grub questions. Not at all Debian specific though; other than the word "Debian" it ought to work with any distro. Certainly ought to work with minimal renaming of files for slackware, pclinux, ubuntu as far as I know. Still, probably a good idea to put a warning/disclaimer on it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.