Wednesday, January 04, 2006

LVM on top of RAID5

I'm turning my old Pentium III 800 MHz box into a Linux RAID5 server. Steps are:
  • Acquired four 200GB IDE drives
  • Acquired Highpoint Rocket133 IDE adapter card because the motherboard does not have enough IDE connectors. I may need another one because the Software RAID HOWTO says that each drive should have its own channel instead of sharing one (master/slave) between two drives (because when a master/slave dies, it may take the correspond slave/master with it).
  • Format each drive with fdisk. Create one full size partition with type FD.
  • Create the RAID5 with mdadm:
  • Make the new /dev/md0 available for LVM use:
    pvcreate /dev/md0
  • From the LVM Tutorial, create LVM volume group named vgdata with 32MB extent:
    vgcreate -s 32M vgdata /dev/md0
  • Create LVM logical volume named lvdata:
    lvcreate -l 17885 -n lvdata vgdata
    17885 is the total number of LVM extents (at 32MB each) in my RAID. Use vgdisplay to find out how many free extents you have.
  • Format logical volume with reiserfs:
    mkreiserfs /dev/vgdata/lvdata
  • mount it:
    mount /dev/vgdata/lvdata /mnt/data
  • Wait a heck of a long time for the RAID to build properly (may take overnight). Check /proc/mdstat/ periodically to see if the recovery has completed. The cat output should look like this:
    Personalities : [raid5]
    md0 : active raid5 hdh1[3] hdg1[2] hdf1[1] hde1[0]
    586075008 blocks level 5, 128k chunk, algorithm 2 [4/4] [UUUU]
    
    unused devices: 
    Do not reboot your machine until the recovery is complete as it'll just start all over again.

0 Comments:

Post a Comment

<< Home