July 20, 2004

RAID 5 on linux

OK, this is more for myself than anybody else, but I've struggled with this since late last week, and six months from now, if I need to do this again, I'll at least have a record of it.

As some of you know, I have a pretty massive machine that I use as a videoserver here at the house. It's running hardware RAID5 (using an LSI Logic MegaRAID i4 controller). Things have been great with the controller, would highly recommend it!

The RAID 5 in the box consists of five 160GB drives giving a total of 0.6 Terabytes available. I've reached that limit over the past year, and needed to add a new drive to the array. Hey, that's one of the benefits of RAID5!

Scott and I went to Best Buy and I picked up a Seagate 160GB drive for $149.00 with $50 in rebates.

I popped the drive in the machine, reconfigured the RAID controller to include the new drive in the array, and let it rebuild the array (which incidentally, took almost two days!). Booted Linux back up (I run SuSe 9.0 Professional on this box) mounted /dev/sda1, and ..... the array showed the same size as before. Major frowny face for me. The hardware controller reported the correct size of the array (781,352,660 MBytes), but df showed only 620,000 MBytes of that as available.

I should probably note that I'm running ReiserFS on this array as well. Repeated google searches for various combinations of linux, suse, "df returning incorrect values", RAID, RAID5, megaraid, i4, ad nauseum, returned nothing seemed like it would help. I did however, find out about reiserfs_resize and cfdisk...handy utilities, but nothing that would help me in this situation.

Poking around tonight in YaST (Yet another Setup Tool...SuSE's administration interface), there's Disk Partition Manager. I didn't have high hopes for anything useful, but, low and behold, there it was... dum da dum! "Resize Partition".

Crossing my fingers and clicking the button brought up a screen that showed me the existing partition, and a block of green (free) space labeled "Unused Disk." There's a nice little slider widget that can be used to adjust the amount of free space. Slinging that sucker all the way to the right so that all available space would be used for the existing partition, I said a little prayer and sacrificed a virgin chicken (while standing on one foot and humming the theme song to Green Acres), and clicked the Apply button.

After the requisite "Warning: this may be a bad thing to do" messages, away it went, happily resizing the partition. When it finished, a mount /dev/sda1 /raid command mounted the raid array back up. A quick check revealed the pre-existing data still existed....WHEW! ('cause there's just no practical way to back up 0.6 TB of data).

The end result?

videoserver:~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda2 38305816 13869196 24436620 37% /
shmfs 192592 0 192592 0% /dev/shm
/dev/sda1 781352660 619039280 162313380 80% /raid

The size of the RAID array has increased by 160 GB to a total of 0.78 TB! I've got two more drive slots open in this case (and coincidentally, one more IDE channel on the controller). Two more drives are going in the machine to bring the total size of the array to 1.12 TB.

Posted by Clack at 07:22 PM | Comments (0)