Grub 2 Cheat Sheet


Grub 2 can boot from raid5 MD devices. Useful tips for usage and troubleshooting.

Create your raid5 array from partitions (hda1, …) not from whole disks (hda, …). Otherwise grub will have too little space for itself and will fail to
install.

When you are re-using disks from previous raid setups, zero superblocks of
devices which will be re-used:

# mdadm --zero-superblock /dev/hda

Install the system so that / is on your /dev/mdX device.

Install grub2 package:

# aptitude install grub-pc

Generate your /boot/grub/grub.cfg:

# update-grub

Install grub on MBRs of all disks in the array:

# grub-install "(md0)"

Now reboot to your / on raid5.

Grub2 rescue cd

Should anything go wrong:

# aptitude install grub-rescue-pc
# ls -l /usr/lib/grub-rescue/grub-rescue-cdrom.iso

Recovery of degraded raid5

In grub2 console (from the rescue cd) run:

> insmod mdraid
> insmod raid
> insmod raid5rec
> ls

this should show you (md0) in output

To have output paged (useful):

> pager=1

To boot from our raid:

> set root=md0
> source /boot/grub/grub.cfg

© 2009 r@hq.sk
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.


Leave a Reply

Your email address will not be published. Required fields are marked *