Whilst software RAID probably isn't the most popular, since hardware RAID is much preferred, I don't currently have the technology in my machine to do this. So, I used software RAID, and have submitted this HOWTO for anyone who wants to use it.
First, you'll need more than one hard disk. Both mine are IDE, the first is a 20GB disk, and the second is a 160GB disk. Since you cannot partition it during the installation process, you'll have to create the partitions manually. This is a simple task, and requires the use of a utility called "fdisk". As an example, I've listed my hard disk partitions below, the blocks that they utilise, and the effective rough size in MB/GB.
This HOWTO has been written for RAID1, but can equally apply for RAID5 as well.
CODE
/dev/hda1 = blocks 1-12 = 100MB
/dev/hda2 = blocks 13-2434 = 19.9GB
/dev/hdb1 = blocks 1-125 = 1GB
/dev/hdb2 = blocks 126-2547 = 19.9GB
/dev/hdb3 = blocks 2548-end = 138GB
/dev/hda2 = blocks 13-2434 = 19.9GB
/dev/hdb1 = blocks 1-125 = 1GB
/dev/hdb2 = blocks 126-2547 = 19.9GB
/dev/hdb3 = blocks 2548-end = 138GB
/dev/hda1 has been created because the boot section needed to be outside of the RAID array, therefore this will be mounted as "/boot".
/dev/hda2 will be mounted as "/" and will be utilised as part of the RAID array. The equivalent partition that it will be mirrored with is /dev/hdb2.
/dev/hdb1 is swap, and isn't being mirrored. Neither is my /home mountpoint, since this is larger than the rest of the space I have. If I had 2 x 160GB drives in my system, then everything would have been mirrored.
Creating the partitions
Boot from the Mandriva CD/DVD and press F1. Type "linux rescue" at the prompt. Afterwards, you should get a menu, and choose the option to go to the command line.
For options on what commands to use in fdisk, press "m" once within the program. However, the basics are:
CODE
n = create new partition
d = delete existing partition
p = show existing partitions
w = save and exit
q = exit without saving
d = delete existing partition
p = show existing partitions
w = save and exit
q = exit without saving
Since, I have two hard disks, the commands to use with fdisk, are as follows:
CODE
fdisk /dev/hda
fdisk /dev/hdb
fdisk /dev/hdb
after one of these commands has been ran, you can then use the menu options I listed above. Now, my full example:
CODE
fdisk /dev/hda
n - to create new partition
p - to choose primary rather than extended
1 - if prompted for which primary partition type 1.
press enter for the start block, as we will use the default.
+100M (this is to select 100MB partition, easier than figuring out equivalent in blocks which is 1-12)
n - to create new partition
p - to choose primary
2 - to create 2nd primary partition
press enter for the start block, as we will use the default.
press enter for the end block, as we will use the default.
t - toggle partition type
2 - partition 2
fd - selects auto RAID
w - to save and exit
n - to create new partition
p - to choose primary rather than extended
1 - if prompted for which primary partition type 1.
press enter for the start block, as we will use the default.
+100M (this is to select 100MB partition, easier than figuring out equivalent in blocks which is 1-12)
n - to create new partition
p - to choose primary
2 - to create 2nd primary partition
press enter for the start block, as we will use the default.
press enter for the end block, as we will use the default.
t - toggle partition type
2 - partition 2
fd - selects auto RAID
w - to save and exit
now the 20GB disk has been partitioned as I have above. Let's do similar for the 160GB, however, we need swap and home on here also. So:
CODE
fdisk /dev/hdb
n
p
1
press enter for default start block
+1024M (1GB swap)
n
p
2
press enter for default start block
2547 (this will equal same size partition for "/" to be mirrored - calculation later)
n
p
3
press enter for default start block
press enter for default end block
t
1
82 (sets for swap file)
t
2
fd
w (to save and exit)
n
p
1
press enter for default start block
+1024M (1GB swap)
n
p
2
press enter for default start block
2547 (this will equal same size partition for "/" to be mirrored - calculation later)
n
p
3
press enter for default start block
press enter for default end block
t
1
82 (sets for swap file)
t
2
fd
w (to save and exit)
That's the second disk configured, exactly how we want it. Swap at the beginning, so that it's faster to access. Then the "/" partition, exactly the same size, followed by /home using the rest of the disk.
So, how did I work out what size for the partition? Well, easy really. On /dev/hda it started at block 13 and finished at 2434. So, 2434-13=2421 blocks utilised for "/". On /dev/hdb the partitioning was different, "/" didn't start at block 13. Therefore, since the swap ended at 125 and this partition starts at 126, we need to work out the end point for this partition. We know the size is 2421 blocks, so 2421+126=2547, which is the end point, to get the exact same size as the partition on /dev/hda.
Installation
Now the installation can be completed, so type "reboot" and press enter, to restart, and boot from the Mandriva CD/DVD again. This time, press enter to let it boot normally into the installation.
When you get to partitioning, choose "Custom Partitioning", since we already have done it, so we just need to allocate these to mount points, as well as create the arrays.
Select the first partition on /dev/hda, and set this to be "/boot" and then set the file system type be it ext2, ext3, reiserfs, etc, etc. I chose reiserfs, but ext2 or ext3 are just as good here. Now select the second partition, and create the array, let it use the default of "md0".
On /dev/hdb, the first partition should be green, and will show as swap, so nothing to do here. Select the second partition, and you can then choose an option to add this to the existing array. Select the third partition, and then set this to be "/home" and choose the file system type.
Click the Advanced button, go to the array tab, and then modify the file system so that it is what you want it to be, be it, ext2, ext3, reiserfs, etc, etc.
Continue the install, and let all partitions be formatted. And follow the rest of the installation as you would normally and reboot the system when complete.
Post Installation
Now that your system is up and running, you can check the status of your array, by typing this at a terminal prompt:
CODE
cat /proc/mdstat
this will output on the percentage complete of the array, or whether it's complete and active. This can take some time depending on the file system/partition size.
Now you have software raid running on your system.
