Wednesday, September 7, 2011

Extending LVM2 partition in Centos 6


A quick how to on extending an LVM2 volume on Centos 6.


The following commands need to be run as a super user, i.e su - or sudo


First you will need to add the new partition to your LVM Group, this is assuming you have alreday created the disk with fdisk or similar and created a file system on the new drive to be added:


Initialise the partition for use in an LVM Group:
Inspiron-1545:~#pvcreate /dev/sdb1


Then add the new PV partition to to your LVM Group:
Inspiron-1545:~#vgextend VolGroup00 /dev/sdb1


You can check that there is now free PE's available to grow your partition:
Inspiron-1545:~#lvm vgdisplay


Check volume name:
Inspiron-1545:~#df /


Extend the partition you want to add the extra space too:
Inspiron-1545:~#lvextend -L +100G /dev/VolGroup00/LogVol00


Lastly extend the filesystem on the partition:
Inspiron-1545:~#resize2fs /dev/VolGroup00/LogVol00


Run df -h / to make sure that the extra space has been added as expected.


Original article can be found here.

No comments:

Post a Comment