SET UP RAID WITH MDADM

We don't have to tell you that backups are vital. Almost everyone recognizes the importance of a good backup--even if we don't always back up our data as often as we should.

While a plethora of backup solutions exist, most only take a point-in-time snapshot of the working system. In other words, the data is only as current as the last backup. Few solutions exist that provide real-time, always up-to-date backups.

RAID, which stands for either redundant array of independent disks or redundant array of inexpensive disks, is one way to keep a fully updated backup of your system. While RAID offers additional benefits, a simple RAID setup maintains multiple copies of your data in real time.

RAID uses two or more disks of the same size to build an array (or grouping) of devices. It then turns these multiple physical devices into one "meta device" that the system uses.

Writing data to this meta device means that you're actually writing the data to all of the devices simultaneously. So if a hard drive fails on one disk in the array, the other disks still retain the data.

Of course, RAID isn't a replacement for a proper snapshot backup either. While RAID can prevent you from having to roll back to a week-old or month-old snapshot if a drive fails, it can't help you regain an accidentally deleted file.

RAID is inexpensive, and the kernel supports it out of the box. Take two identical drives, and partition them exactly the same. Then use the mdadm tool, which you can download from the Web, to create and manage the RAID array.
http://www.cse.unsw.edu.au/~neilb/source/mdadm/

To create the first array on the disk, execute the following:

# modprobe md
# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2
/dev/hda1 /dev/hde1

The above commands create the meta device (/dev/md0) and map it to the two physical devices (/dev/hda1 and /dev/hde1). It assigns them a RAID level of 1, which is a straight mirror. After you've created the first array, you can format and mount /dev/md0 as you would any other partition.

There's no need for a configuration file. The system physically writes the required RAID data to the disks to construct the array to make the RAID array immediately available at boot. This allows you to treat the RAID device as you would any other physical partition.