In the world of servers there are many options when it comes to protecting your disks and the data on those disks. You can create backups of your disks or even get creative and rsync your data to another drive or to an off site storage area. On my server I chose to go with a RAID array.
In my line of work I see a number of times that people over look their data. They then have a drive failure or some other catastrophe and then poof their data is gone. Their first feeling of emotion is to blame their host or to some other extent any one besides them selves. This is often the “fear” that is talking but in some cases they just could not afford it.
I’m not saying I’m rich and by far I do see the requirement for data security. I have been stupid before in my choices but this time around I wanted to make sure I protected my servers most important data from failure. Of course a $400 RAID card would have been great but I couldn’t afford that at the time I started to use this server. So I went with something a little bit different called a software RAID.
Redundant Array of Independent Disks is what RAID stands for, it has been revised from the “Inexpensive” disk version originally created. As I only chose to go with RAID-1 as I have a server with 4 disks in it. I got thinking that I wanted to test how well a software raid worked. So like any confidant geek I went to the data center and pulled on of the drives in the array. My plan was to make sure my monitoring worked (it didn’t) and to make sure that everything kept running. So upon pulling it the server went on without skipping a beat. The bad thing was that it required to be looked at because I never got a failed RAID notice.
I checked using the “cat /proc/mdstat” command to get my array status:
Personalities : [raid1]
md0 : active raid1 sdb1[0]
488383936 blocks [2/1] [U_]
unused devices:
As you can see it only lists 1 drive out of two so we can see that something has gone wrong! I did some checking and noticed that all four drives were in fact being seen by my server so I did a reboot (I don’t know why I thought maybe the array would rebuild on its own.) of course I needed to interact with it (this is where a $400 + card comes in very nicely).
I checked my disks “fdisk -l”:
Disk /dev/sda: 160.0 GB, 160000000000 bytes (Primary OS Drive)
Disk /dev/sdb: 500.1 GB, 500107862016 bytes (RAID-1 Disk #1)
Disk /dev/sdc: 500.1 GB, 500107862016 bytes (RAID-1 Disk #2)
Disk /dev/sdd: 500.1 GB, 500107862016 bytes (Backup Drive)
Disk /dev/md0: 500.1 GB, 500105150464 bytes (RAID-1 Array)
Disk /dev/md0 doesn’t contain a valid partition table (Normal for the Way I did the Array)
So I added my disk back into the array and let it try to start rebuilding “mdadm /dev/md0 -a /dev/sdc1″
Now I check to see the status of the array “cat /proc/mdstat”
Personalities : [raid1]
md0 : active raid1 sdc1[2] sdb1[0]
488383936 blocks [2/1] [U_]
[>....................] recovery = 4.0% (19803264/488383936) finish=169.7min speed=46010K/sec
What do you know it is recovering / rebuilding
. You can see it is going at roughly 46Mb per second with an estimated completion time of 169 minutes or just under 3 hours. Not bad for some freeness is it?