Testing RAID in CentOS

Now that I created a CentOS system with RAID-5 and RAID-1in my previous post, it’s time to test whether the RAID will actually save my system in case of disk failure.

A simple way to simulate a disk failure without actually beating the crap out of one of your disks (which would be especially difficult with the virtual disks in this case) is by using the mdadm utility included in CentOS and other Red Hat-based linux distributions.

1) First, confirm that your RAID includes a spare drive that the system will rebuild the array with and determine which disk is going to “fail” by checking the output of ’cat /proc/mdstat’:

As you can see, I have split each of the 4 disks in my virtual machine (VM) into 2 partitions each – a small RAID-1 partition for /boot and a large raid-5 partition for / (everything else). The (S) next to some of them signifies that that partition is a Spare, to be used in case of disk/partition failure.

2) To simulate disk failure, we will pass ’fail’ argument to one of the partitions:

Make sure the partition you’re marking is part of the correct array, or it will just tell you it can’t find it.

The array should automatically start rebuilding at this point. You can check the progress by checking mdstat again:

3) After you have verified that the array rebuild has completed, you now know your system is safe from virtual hammers! To re-add the virtually destroyed partition back, just run:

You might have to reboot before being able to add the partition back into your array.

This entry was posted in all and tagged . Bookmark the permalink.

2 Responses to Testing RAID in CentOS

  1. Pingback: Installing CentOS 5.4 in VMware « Roman

  2. Pingback: Firewall (iptables) rules for Zimbra in CentOS « Roman

Leave a Reply