Thursday, March 31, 2005

Installing Gentoo on Software RAID

I'm currently fighting with this again. Apparently, there have been some changes between the 2004.0 CD and the 2005.0 CD (mostly related to the 2.6 kernal and the DevFS vs UDev systems).

First off, some tips-n-tricks:

1) ifconfig - find out the IP address of the box
2) passwd - change the root password to something you know
3) Starting the SSH daemon - The command is: /etc/init.d/sshd start

Now I'll be able to use SecureCRT and have an easier time of copy-n-paste. (Pick 'keyboard interactive' and 'ssh2' under options when setting up the connection in SecureCRT.)

Links:

Gentoo 2004.3 Software RAID Install HOWTO
Gentoo.org - x86 tips and tricks (including software RAID)
The Linux Documentation Project: Software RAID
An older gentoo.org thread on software raid

Now... to show you what I did and where it breaks. I have (2) IDE disks, attached as /dev/hda and /dev/hdc. I plan on mirroring them, and have already created /dev/hda1 (128MB for /boot), /dev/hda2 (2GB for swap), /dev/hda3 (2GB for root), and /dev/hda4 (rest of disk for LVM). All partitions are flagged as type 'fd' (linux raid auto).

# modprobe md
# ls /dev/md*
ls: /dev/md*: No such file or directory
# for i in 0 1 2 3; do mknod /dev/md$i b 9 $i; done
# ls /dev/md*
/dev/md0 /dev/md1 /dev/md2 /dev/md3
# nano -w /etc/mdadm.conf


Contents of my mdadm.conf file:

DEVICE /dev/hda1 /dev/hda2 /dev/hda3 /dev/hda4
DEVICE /dev/hdc1 /dev/hdc2 /dev/hdc3 /dev/hdc4

ARRAY /dev/md0 devices=/dev/hda1,/dev/hdc1
ARRAY /dev/md1 devices=/dev/hda2,/dev/hdc2
ARRAY /dev/md2 devices=/dev/hda3,/dev/hdc3
ARRAY /dev/md3 devices=/dev/hda4,/dev/hdc4


Pretty generic... now to create the raid. This is where we hit our first issue:

# modprobe raid1
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hda1 /dev/hdc1
mdadm: /dev/hda1 appears to contain an ext2fs file system
size=72192K mtime=Wed Mar 30 16:46:07 2005
mdadm: /dev/hdc1 appears to contain an ext2fs file system
size=72192K mtime=Wed Mar 30 16:46:07 2005
Continue creating array? y
mdadm: ADD_NEW_DISK for /dev/hda1 failed: Device or resource busy
#


Here are the problems:

1) Even though I have a 128MB partition for /boot, it is still showing 64MB from a previous partitioning scheme.

2) mdadm: ADD_NEW_DISK for /dev/hda1 failed: Device or resource busy

So... take a look at my partition list:

livecd root # fdisk -l

Disk /dev/hda: 76.8 GB, 76869918720 bytes
16 heads, 63 sectors/track, 148945 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 249 125464+ fd Linux raid autodetect
/dev/hda2 250 4218 2000376 fd Linux raid autodetect
/dev/hda3 4219 8187 2000376 fd Linux raid autodetect
/dev/hda4 8188 148945 70942032 fd Linux raid autodetect

Disk /dev/hdc: 76.8 GB, 76869918720 bytes
16 heads, 63 sectors/track, 148945 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 249 125464+ fd Linux raid autodetect
/dev/hdc2 250 4218 2000376 fd Linux raid autodetect
/dev/hdc3 4219 8187 2000376 fd Linux raid autodetect
/dev/hdc4 8188 148945 70942032 fd Linux raid autodetect
livecd root #


All of which looks right and proper.

No comments: