Thursday, 8 March 2012

Create LVM over RAID

Initial set of LVM on top of RAID
The first command pvcreate will "initialize a disk or partition for use by LVM". The second command vgcreate will then create the Volume Group, here the volume group is lvm-raid:

# pvcreate /dev/md0

# vgcreate -s 16M lvm-raid

-s option will sets physical extent size on physical volumes of this volume group. The default value for the physical extent size is 4MB. Here the value 4 MB can be too low for a large RAID array. In those cases you'll need to specify the -s option with a larger than default physical extent size. The default of 4MB leads to a maximum logical volume size of around 256GB, 16MB PE size will limit single LV to grow beyond 1TB.

# vgdisplay
  Free  PE / Size       67235 / 500 GB

If you want to utilise total space in RAID 500 GB

# lvcreate -l 67235 lvm-raid -n lvm0
create a LV of 500GB


If you want to create a small space in RAID

# lvcreate -L 400 -n lvm0 lvm-raid
create a LV of 400MB

# lvdisplay

# mkfs.ext3 /dev/lvm-raid/lvm0

# mkdir /data

# mount /dev/lvm-raid/lvm0 /data

# vi /etc/fstab

/dev/lvm-raid/lvm0 /data ext3 deafults 0 0

If you want to extend the LV
# lvextend -L +800 /dev/lvm-raid/lvm0

# resize2fs  /dev/lvm-raid/lvm0

No comments:

Post a Comment