You are not logged in or registered. Please login or register to use the full functionality of this board...



Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing grub to /dev/sdb
04-24-2013, 09:37 AM (This post was last modified: 11-06-2013 08:55 PM by knifebunny.)
Post: #1
Installing grub to /dev/sdb
We generally use RAID1 arrays for the "/boot" partition of our servers for redundancy. RAID1 means that the partitions are all identical, and therefore all the drives hold the information necessary to boot. So we take /dev/sda1 and /dev/sdb1 and create /dev/md0 where we mount "/boot". Then we install grub in the MBR of both /dev/sda and /dev/sdb pointing it to the proper partition so that if the first drive fails, the second can boot in its place.

Grub v.1

The "normal" way to manually install grub version 1 would be to use the "root" and "setup" commands of the grub shell. So assuming our "/boot" partition is on /dev/sda1 and /dev/sdb1, we'd run
Code:
grub
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

The problem with this is that we've told grub on /dev/sdb (hd1) to look on the first partition of the SECOND drive for its files. But if the first drive fails, the existing second drive will become the first drive. So it won't be able to boot because there won't be a (hd1,0) partition for it to load its files from. It needs to load its files from (hd0,0) regardless of which drive actually boots.

The solution is to use the "device" command of the grub shell to tell grub that (hd0) is the drive we are installing into, regardless of it's present position. Then whichever drive boots, it will look for its files on its own first partition (hd0,0). So here's the commands we actually run
Code:
grub
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Grub v.2

Installing grub v.2 on multiple drives is A LOT simpler than v.1, at least if you are using debian or a debian clone. You simply run
Code:
dpkg-reconfigure grub-pc
and select the drives you want to install grub in. The install script takes care of the rest.

Now everything should be set up correctly. Disconnect the first drive and the second should boot with no problem (albeit with a degraded array).
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)