Deprecated Behaviour

The inane, sometimes insane, ramblings from the mind of Brenton Alker.

Configuring Software RAID With Mdadm

Along with the old server machines I collected from the office (that this server is currently running on) came a plethora of hard disks of varying sized. I decided to put a couple of them to use in a RAID array to protect my important (not really) data. The motherboard in my (much newer) desktop machine comes equipped with a RAID compatible disk controller, that I have never made use of. Unfortunately, the machine I have constructed as my server does not.

Never fear, software raid to the rescue. While I was (and still am) led to believe that software RAID is considerably slower than its hardware equivalent, my current array performs comparably, even slightly better (at least for reads), than the individual disks. So it is definitely a viable solution.

So I now have a simple 2 disk mirrored array, and in it’s creation dispelled a few more of my own misconceptions.

RAID array can be configured using partitions on an already partitioned drive (probably even using the 2 partitions on the same disk, but I didn’t try as it sort of defeats the purpose).

Using mdadm, a newer much friendlier (than the older raidtools) solution to software RAID on linux, to set up a software RAID is actually a fairly simple task.

As I was creating an new array from blank disks, the majority of the configuration is one command:

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/hdb1 /dev/hdc1

Where /dev/md0 is the new software raid device and /dev/hdb1 and /dev/hdc1 are the 2 partitions that are to be used to create the array. If there is already data that needs to be preservered the “Create Degraded array, Add new disk” approach (described in much more detail in an article on SourceForge).

and then

mdadm --examine --scan >> /dev/mdadm/mdadm.conf

to save the configuration (it works without the configuration file, it just makes life a little easier)

I am yet to set up monitoring, but according to Linux dev center that is fairly simple too.

The configuration of a RAID array was much simpler and less interesting than I anticipated, but I suppose that’s a good thing for the server administration world in general.