Thursday, December 20, 2012

3 TB HDD + Raid 5 + LVM

So i got my new HP Microserver N40L :) and 3x HDDs WD30EFRX.

If you ask your self how to setup a mdadm raid 5 and LVM here is a quick Howto...

My Setup:
1x 4BG USB Stick for the OS Centos 6.3 64 bit.
1x HDD 160GB for temporary HDD work. so i don't have to start the idle raid every time...
3x 3TB HDDs for Raid 5.


Here are the commands i used for the partitioning + Raid 5 + LVM Setup.

Note 1: Do not use "fdisk" if i remember right it does not work with partitions larger then 2TB...

Note 2: Check your system and replace the below commands with your setup... (sdx, sdy).

Note 3: repeat Partitioning steps 2 - 7 for all your Raid Members.

Partitioning:
  1. yum install parted
  2. parted /dev/sda   (see note 2)
  3. (parted) mklabel gpt
  4. (parted) unit TB
  5. (parted) mkpart primary 0.00TB 3.00TB
  6. (parted) print
  7. (parted) quit

Raid Setup:
  1. yum install mdadm
  2. mdadm --create /dev/md0 --level=raid5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1
  3. cat /proc/mdstat (you will see that 1 drive is rebuilding. thats normal...)
LVM:
  1. yum install lvm2.x86_64
  2. pvcreate /dev/md0
  3. vgcreate vgdata1 /dev/md0
  4. lvcreate --name lvdata1 -l 100%FREE vgdata1
  5. mkfs.ex4 /dev/vgdata1/lvdata1

No comments: