Sunday, July 24, 2011

Setup Raid 1 Using mdadm In Ubuntu

Sorry for the prolonged absence. Been very busy. I recently bought two 2 Tb hard drives and used mdadm to create a Raid 1 array for my new data drives in Ubuntu 10.04
Raid 1 uses 2 identical size hard drives and will mirror the data from one hard drive to the other automatically.

I tried several tutorials to set up mdadm but several of them either missed a few steps or were lacking good instructions. But then I found this site and followed the instructions. Working fine now!

http://lummie.co.uk/ubuntu-server-setting-up-and-managing-raid1/

I can use the Gnome Disk Utility available in the repo's to check the SMART Status of each disk in the array as well as checking the health of the array.
I usually use Western Digital hard drives as they have been very reliable for me but for this project I used a set of Samsung's.

The Samsung's required a firmware fix to repair a flaw that caused lost data.
I had to create a Dos based bootable flash drive and throw the firmware on it then boot to it to flash the hard drive firmware. Talk about the retro 90's!

I have been running the array for a month and everything has been flawless.
Read and write speeds have been what I expected for a software based Raid array. And I have not had to rebuild the array except the one time I had an unexpected power outage when a tree took down a power line.

Software based Raid setups have their advantages and disadvantages.
Many of the motherboard based Raid controllers are actually considered fake Raid and don't work well with Linux. They also have disadvantages that surpass those of a software Raid.

One advantage of using software such as mdadm is the ability to use any model of Western Digital hard drives. I didn't know this fact until after I ordered the Samsung's.

A while back Western Digital pulled a fast one on it's customers. They decided they needed to increase their revenues on their higher cost 'Enterprise' models of hard drives. No one was buying them. Instead everyone was purchasing their Black edition and using them for their Raid setups.

So Western Digital went and disabled the TLER feature in all of their hard drives except for the Enterpise editions.
TLER is an abbreviation for Time Limited Error Recovery. Essentially a hardware Raid controller queries the hard drive every so often and the hard drive responds back. If the controller does not get a response in a predetermined time it marks the hard drive as bad and drops it from the array. This requires you to rebuild the array which takes quite awhile.

Since WD disabled TLER in their home based hard drives, the drive will continue to drop out of the array and require you to spend countless hours of adding the drive back into the array then rebuild it. Not very productive.

With mdadm it does not query the hard drive nor does it rely on TLER.
That means that it is up to you to be vigilant and check the status of the array on a regular basis. This can be done through the Gnome Disk Utility or a set of commands found on the page I linked to.

You can also reconfigure mdadm to send you email alerts if something happens to the array. I haven't set up my system this way so I don't know what is all involved.
You can find additional info on mdadm and advanced features here;

https://help.ubuntu.com/10.04/serverguide/C/advanced-installation.html

Remember that backing up your data is important. Using a Raid array in a Raid 1 or Raid 5 configuration is a step in the right direction but unless you monitor the array health you can have a disaster on your hands that rivals a single hard drive failure scenario.


Have fun and keep your data safe.