This is not a definitive guide, just some notes about what I did to set up my software RAID 1 on SuSE 8.2.
SuSE 8.2 was installed and running on a 10GB drive. I bought 2x120GB drives to create a fileserver.
Initially, I was intending to replace the 10GB drive with the 2 new ones. I changed my mind because I would like the data to be separated from the rest of the system. So I decided the 10GB would hold / and the RAID devices would only be for swap, /var, and /home.
Disks:
- /dev/hda 10GB
- /dev/hdb 120GB
- /dev/hdc 120GB
I installed the disks, then started up yast (System->Partitioner).
On each of /dev/hdb and /dev/hdc I created 3 partitions - each one set to be a RAID partition (File System ID: 0xFD Linux RAID).
Yast is fine if you only want one RAID device. However, it has problems when you want to manipulate more than one. This is not a big deal, just a little annoying.
Nevertheless, I attempted to create three RAID devices using yast. I created RAID device /dev/md0 and added the largest partitions from hdb and hdc; this would be /home. Now to add 2 more RAID devices.
To create another RAID device, you Edit RAID and in the top right hand corner is the option to Add RAID. However, yast didn't let me add any partitions to a new RAID device. I ended up with /dev/md1 and /dev/md2 as zero-sized devices.
I wrote the partition table and quit yast. Now to edit /etc/raidtab. This is the file as yast left it.
#/etc/raidtab
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
device /dev/hdb3
raid-disk 0
device /dev/hdc3
raid-disk 1
raiddev /dev/md1
raid-level 1
nr-raid-disks 0
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
raiddev /dev/md2
raid-level 1
nr-raid-disks 0
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
This is the edited /etc/raidtab
#/etc/raidtab
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
device /dev/hdb3
raid-disk 0
device /dev/hdc3
raid-disk 1
raiddev /dev/md1
raid-level 1
nr-raid-disks 2 ### changed
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
### changed ###
device /dev/hdb1
raid-disk 0
device /dev/hdc1
raid-disk 1
###############
raiddev /dev/md2
raid-level 1
nr-raid-disks 2 ### changed
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
### changed ###
device /dev/hdb2
raid-disk 0
device /dev/hdc2
raid-disk 1
###############
I issued the mkraid command to create the RAID devices. I had to force these:
mkraid -f /dev/md1
mkraid -f /dev/md2
I went back into yast and set the new RAID devices to format and set one to swap. I did not want to set /var just yet as I had /var on my original 10GB disk and still wanted to copy over the data.
I rebooted into single user mode to move /var.
# mkdir /mnt/new_var
# mount /dev/md2 /mnt/new_var
# (cd /var tar -cpf -.) | (cd /mnt/new_var; tar -xpf -)
# umount /mnt/new_var
# rm -rf /var ; mkdir /var
# mount /dev/md2 /var
I added the new /var to /etc/fstab, then rebooted the system.
/proc/mdstat will tell you the current state of your RAID devices. I have set up a script to monitor it, but a quick realtime check is: watch /proc/mdstat