Installing Mandriva with software raid


This is based on configuring Mandriva with Software Raid 1.  Of course, hardware-based raid is preferred because it's much faster, and not dependent on the Operating System.  However, Software Raid is pretty good within Linux, and not a great deal of speed loss.  But at least there is data redundancy in the event of a disk failure!

For Raid, you do need to have at least two hard disks.  It just isn't possible otherwise.  In this example, I've used 2 x 160GB hard disk drives.  I configured three partition types, those being:


this is all I really need at home.  Obviously, expand this and change accordingly, based on the amount of mount points you require.  If you already have a system up and running, and want software raid, then you don't need to reinstall.  See my other procedure for creating an existing system to software raid instead.  Or, if you want to do a new install of Mandriva, then just back up your important data, and then follow the procedure below.

Please note - I'm not responsible for any data loss you incur following this procedure.  You follow this at your own will.  These procedures do work, I use them all the time.  You should always make sure you have backed up your data.  This is your responsibility, not mine :-) 

Creating the Partitions

There's a number of ways for doing this.  I prefer a more manual method, mainly because I like control of how my partitions will be set up.  However, the partitioning can be done during the installation.  Go into Custom Partitioning when prompted.  Then click the Expert button to get into Expert mode.  You'll now have a lot more options available, and you need to create the Raid Partitions here.  You then assign them to an array, usually referred to as md0, md1, md2, etc.  You would choose each partition from each of the two disks to be a part of the array.  The unfortunate thing about the graphical partition creation is that it's very difficult to get the partitions exactly the same size - which is really important otherwise each of your partitions will not be equal causing you problems later.

This is why I prefer the manual method, it's just much easier to control, and it's not very difficult at all.  So, in this example, of my 160GB disks and Raid 1, this is how my partitions are laid out:

swap = 1GB
/ = 10GB
/home = 149GB

So, now that we have the partition information laid out, you can see how it will work for the rest of the installation.  I boot the Mandriva Installation CD, and I choose Rescue mode.  I just exit to the prompt after this.

You need to use fdisk for creating the partitions - or whichever partitioning tool you prefer.  I use fdisk anyway, I prefer this.  First off, do this:

fdisk -l

this will show if both your hard disks are being recognised by the system.  Mine were, and showed up as /dev/hda and /dev/hdb.  Now, the options you need to use within fdisk are as follows:

n = Create New Partition
d = Delete Partition (just in case you need it when entering wrong values)
p = Show Partitions (so you can view what you just created)
t = Toggle partition type
w = Save and Exit
q = Exit without saving

As before, I mentioned the sizes for my partitions, so this is how I create them.  First the swap partition:

fdisk /dev/hda
1 (for first primary partition)
press enter for the default start block of 1
82 (this is swap partition type)

Now for creating the / partition:

press enter for the default start block
2 (selects the second partition - last time you didn't get prompted, because only one partition existed)
fd (for auto raid partition type)

Now, we repeat the same process for the /home partition:

press enter for the default start block
press enter for the end start block (defaults to end of the disk)

You see we did things slightly different there.  We didn't specify the size, we just chose the defaults which go to the end of the disk, making things very very easy for us.  The last command, the w, saved and exited fdisk - as explained earlier in the command preparation.  You can now repeat this process for the second hard disk.  Of course, there is a much easier and quicker way:

sfdisk -d /dev/hda | sfdisk /dev/hdb

and it will automatically copy the whole partition information to the second hard disk, and each partition will be exactly the same as the one on the first disk.  Please note, if you are using more than four partitions in your install, then you can only create a maximum of 3 primary partitions.  The fourth has to be extended, and then you create logical partitions that start from partition 5 onwards.  Partition 4 will be the extended partition, and is not to be created or toggled to type "fd".


After doing what I've just done above, reboot the system and boot from the Mandriva CD/DVD again - this time booting normally for installing Mandriva.  Select Custom Partitioning when prompted.  It shall detect the partitions as configured for Raid, and then it's a case of setting up the arrays for each partition so that they are referenced as md0, md1, md2, etc as before.  You then create the file system on top of this, as ext3, reiserfs or whatever you prefer (you have to click the Expert button to do this and select the arrays by their md reference) and continue installing Mandriva in the normal manner once you've done this.


Now that your system is installed, you can check the status of the raid arrays using the following command:

cat /proc/mdstat

this will tell you the status of the arrays, and whether the building of the array has completed or not.  For large partitions this will take some time, so wait for this to complete, and then shut down your system.  Otherwise, it'll start from the beginning again each time your system starts, and your array won't be functional until this is completed successfully.