Wednesday, September 9, 2009

mdadm + lvm2

1) Create partitions on the disks.

2) Create the md0 device with proper raid level and the disks
# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

3) Create physical volumes
# pvcreate md0

4) Create the volume
# vgcreate myvolume /dev/md0

5) Display the volume, note the PE size
# vgdisplay lvm-raid
Free PE / Size 119234 / 465.76 GB

6) make a file system on it
# lvcreate -l 119234 myvolume -n myraidname

7) create the filesystem on the raid volume
# mkfs.ext3 /dev/myvolume/myraidname

9) Add the raid device to mdadm.conf, so it's recognized next time you boot
mdadm -Es | grep md0 >>/etc/mdadm.conf


From http://en.wikipedia.org/wiki/Mdadm

View the status of a multi disk array.
# mdadm --detail /dev/md0

View the status of all multi disk arrays.
# cat /proc/mdstat

No comments:

Post a Comment