Ubuntu 14.04 Extend logical or physical disk space​

This worked for me when I needed to extend the disk space in a vmware virtual machine. Once you extend the space in vCenter you need to reboot the VM.

Create a partition with available disk space using this command.

cfdisk

 

Select available space then choose ‘write’ then ‘quit’.

 

Scan for the new partition with:

partprobe /dev/sda

You may need to restart if the above command doesn’t work.

Check for the new partition with:

fdisk -l /dev/sda

 

Create a new volume (I will assumed the new partition found above is sda3)

pvcreate /dev/sda3

 

Show the physical volumes with

pvdisplay

 

Now we can extend the primary disk with the following commands. You should be able to get the VOLUME_GROUP name from the above command.

vgextend VOLUME_GROUP /dev/sda3

lvextend -l+100%FREE /dev/VOLUME_GROUP/root

resize2fs /dev/mapper/VOLUME_GROUP-root

 

Check available space with:

df -h

Leave a Comment

Your email address will not be published. Required fields are marked *