Friday, February 22, 2008

Why you should love LVM as much as I do.

First off, want to start out by saying sorry to the three people who read my blog. Those of you who know me know I only blog about stuff I find truly interesting or useful, so the filter is generally set pretty high.

Anyway, I ran into a bit of a conundrum. I brought home a bunch of big SCA drives to replace my small 14GB drives in my raid5 at home.. At first I was unsure how I was going to go about getting the stuff off the raid5 array so that I could resize it. Would I have to dd the stuff over to another drive? How was this going to work.

Then I found out that since i'm using LVM on the array, I can use the "pvmove " command. pvmove essentially tells LVM "Hey, move everything off of the specified physical volume device onto all of the other physical volumes in a particular volume group. Since I alraedy had a 1-off 146GB scsi drive laying around, I was able to do this in a few simple steps:

1) install 146GB scsi drive and rescan scsi bus
2) pvcreate
3) vgextend
4) pvmove
(wait an hour)
5) vgreduce
6) pvremove (not really necessary if you're just gonna nuke the drive)

Voila! All of my running vm's are unaffected except for a slight slowdown during pvmove, and now I can reorganize the raid5 array. If I had a controller that supported it, I could technically have changed the raid5 out without even rebooting the system.

Once I had the new raid5 configured, I followed the same steps in reverse to get the vms off of the un-redundant 146GB drive.

This is one of the reasons why I love linux, evms, enterprise stuff, etc. It makes crap like this incredibly easy.

Anyway, back to your regularly scheduled nothingness!

--pete