CRUX : Home

Home :: Documentation :: Download :: Development :: Community :: Wiki :: Ports :: Bugs :: Links :: About

Back to wiki start page Categories: Install

How to configure LILO to boot from RAID1

Author

20090112 Clemens Koller

Description

LILO can boot directly a root FS from software RAID1, if configured properly. I make the assumption that you have two identical harddisks running in RAID1. It's said that this only works with a RAID1 and mdadm metadata version 0.9 not 1.x. Used LILO version: 22.8

Instructions

First, partition your harddisk and toggle the bootable flag for the partitions which assemble to your root filesystem:

   $ fdisk /dev/sda
   Device Boot      Start         End      Blocks   Id  System
   /dev/sda1   *           1         609     4891761   fd  Linux raid autodetect
   /dev/sda2             610       30200   237689707+  fd  Linux raid autodetect
   /dev/sda3           30201       30401     1614532+  fd  Linux raid autodetect

Do the same for /dev/sdb:

   $ fdisk /dev/sdb
   Device Boot      Start         End      Blocks   Id  System
   /dev/sdb1   *           1         609     4891761   fd  Linux raid autodetect
   /dev/sdb2             610       30200   237689707+  fd  Linux raid autodetect
   /dev/sdb3           30201       30401     1614532+  fd  Linux raid autodetect

Create the RAIDs:

   $ mdadm -C /dev/md0 -l 1 -n 2 /dev/sda1 /dev/sdb1
   $ mdadm -C /dev/md1 -l 1 -n 2 /dev/sda2 /dev/sdb2
   $ mdadm -C /dev/md2 -l 1 -n 2 /dev/sda3 /dev/sdb3

Verify the RAIDs:

   $ mdadm -D /dev/md0
   $ mdadm -D /dev/md1
   $ mdadm -D /dev/md2

Create filesystems:

   $ mkfs.ext3 /dev/md0
   $ mkfs.ext3 /dev/md1
   $ mkswap /dev/md2

Install CRUX (follow the Handbook):

   $ mount /dev/md0 /mnt	
   $ swapon /dev/md2
   $ setup
   $ ...

Add the following to lilo.conf:

   lba32
   install=text
   boot=/dev/md0
   raid-extra-boot=auto
   root=/dev/md0
   prompt
   timeout=100
   read-only
   image=/boot/bzImage-26265
      label=l26265
   ...

Run LILO:

   $ lilo

And, here comes the trick: Make sure, that LILO is also in both Master Boot Records:

   $ lilo -M /dev/sda
   $ lilo -M /dev/sdb

Disclaimer: If you follow the instructions above, you might loose all your data. ;-)