| Royce Souther 2005-07-05, 5:47 pm |
| Can someone explain to me what I am doing wrong.
I am trying to build a custom OS installer. I have made a live CD that is
built from a fresh debootstrap. The installer copies it self on to the
target drive then makes an initrd file and sets up lilo. One of the options
in the install if for a RAID-1 configuration.
The problem I am having is with RAID. It seems like the initrd cannot load
the RAID modules at boot time. The kernel panics because it cannot find
the /dev/md0 device. The /dev/md0 is in the initrd and the raid1 module
does get loaded before the linuxrc script is done.
The error is
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(9,0)
I tried to use the mkinitrd script but that did the same thing. So then I
installed Suse. It has a nice GUI tool for setting up RAID at install time.
The Suse installer could see all the partitions I had made, it could even
tell that /dev/hda5 was part of /dev/md0. I let it install without changing
the partions and it can boot just find. I copied the initrd file that Suse
made and then reinstalled my Debian image. I set lilo.conf to use the Suse
initrd file and to my shock, I get the same error. This seems like the
problem is not in the initrd file, but where could it be.
The steps I use to build my system are like so...
1) Use dd to blank the first few thousand block of the drive to remove any
partitions
2) Use sfdisk to create a new partition table
/dev/hda1 size=20M ID=83 ext2 to use as /boot
/dev/hda2 ID=5 Extended partition
/dev/hda5 size=5G ID=fd Linux RAID autodetect to be used as /
/dev/hda6 size=20G ID=fd Linux RAID autodetect to be used as /home
/dev/hda7 size=500M ID 82 swap
3) Use mdadm to create a degraded RAID for each
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hda5 missing
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/hda6 missing
4) Format /dev/md0 as ext3
mkfs.ext3 -F -m 0 -i 4096 /dev/md0
5) Mount /dev/md0 with device access
mount -o dev /dev/md0 /mnt/target
6) Copy OS system into the target
7) Mount /dev/hda1 as /mnt/boot
8) Move /mnt/target/boot/* to /mnt/boot
9) Unmount /mnt/boot
10) Mount the boot partion with device access
mount -o dev /mnt/hda1 /mnt/target/boot
11) Write a new lilo.conf file like so
lba32
boot=/dev/hda
install=/boot/boot.b
backup=/dev/null
map=/boot/map
delay=1
default=linux
image=/vmlinuz
append="apm=power-off quiet"
initrd=/boot/initrd.img
root=/dev/md0
vga=791
label=linux
read-write
12) Activate the partition to boot with lilo
chroot /mnt/target lilo
13) Unmount everything and reboot
|