Wednesday, September 17, 2008

 

RAID and MDADM

Well, I know I don't keep this blog to active...I do have lots of information to put in here, but time is something I don't have a lot of...
So, I recently got the bright idea to build a Raid array. I had 3 extra disks and bundled them together in a Raid 5.
This wasn't so bad, and I put all my data on the raid. Then I thought...hay, why not add another drive? So I found another drive (identical to the other 3) and added it in...or TRIED to ad it in.
I lost everything.
So, let me detail the RIGHT way to do things...
1) Once you have a set of disks that you wanna use for a Raid array plug them all into your board and crank up the power.
2) Using GPartEd or some other partition editor, set the drives up with an extended partition, unformatted, and set the RAID flag
3) from the Terminal, type in "sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb5 /dev/sdc5 /dev/sdd5
4) when done, you have to format the array using mkfs.ext3 or mkfs.ext2, or whatever your favorite file system is - you will have no troubles to this point...
5) When you want to get brave and add a disk to your array, you should first add the new drive as a spare: sudo mdadm /dev/md0 --add /dev/sdc1
This should work fine, and it should take a little while as something happens to the drive (mine took a couple hours)
6) When that is all done, you should have a Raid 5 with 3 Active Disks and one Spare: sudo mdadm -D /dev/md0
7) Now, you can GROW your raid array onto the spare: sudo mdadm --grow /dev/md1 --raid-devices=4 --size=max
8) Then, you must resize the file system: sudo resize2fs /dev/md1

I got this to work, but only after following this pattern. Doing it the other way caused everything to go very badly...

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?