Blog PostExtend LVM Partition online

I have been facing this recently at work. Luckily, we run a private cloud on VMWare Infrastructure with Storage on EMC SAN. I've got some production machines running RHEL and CentOS RHEL Clone. Recently, some of them started running out of disk space. Luckily, setup was done using default install. So, LVM was used by default.

So, I asked the VMWare admin to add an extra virtual disk for me on each of those machines. and I extended (/) partition to the new disk.

Keeping in mind to follow the procedure is: /dev/sda was the only disk for each machine. So, when we added an extra disk, it was assigned /dev/sdb

Using fdisk, create a new partition:

fdisk /dev/sdb

Make sure you make your choices as primary and assign it first partition.

So, once created, it shall be assigned /dev/sdb1

pvcreate /dev/sdb1

This will create a physical volume for the LVM.

And after creating the physical volume we attach it to our existing Volume Group.

vgextend VolGroup00 /dev/sdb1

Then we extend the Logical Volume which is mounted to (/) by 20GB, make sure you change the number to the attached disk storage.

lvextend -L +20G /dev/VolGroup00/LogVol00

Then we resize the filesystem, since we are running default installs, it runs ext3, so extending it online using the command below:

resize2fs /dev/VolGroup00/LogVol00

Verify the new storage size using:

df -h

It must show the extra 20GB or whatever disk size you added.

Comments

Discuss with me and others You need to sign in to post comments