Linux VM - Extend Disk to Existing Partition

You are a running Linux Server, and need to extend disk to some GB of size. In this example, a disk will be extended from 15 GB to 100 GB.

1. You need to resize disk into 100 GB from vCloud Director.

 

2. Go to VM and check the current condition. You see the existing size is 15 GB.

 

Let's create unallocated 85 GB to existing partition

 

3. Create partition using cfdisk

$ cfdisk

4. You see your Free space 85 GB. Enter on it. Choose New.

 

5. Free Space now become /dev/sda3. Choose Write.

This will writing partition table.

 

6.  Quit. and reboot if needed.

 

7.  Now check the new partition you have created.

$ fdisk-l /dev/sda

 

8. Now let's pull it into your LVM configuration. First you'll create the physical volume.

$ pvcreate /dev/sda3

 

9. Let's take a look at your physical volumes

$ pvdisplay

 

10. Now, extend your volume group (ubuntu-vg) into your new physical volume (/dev/sda3)

 

$ vgextend ubuntu-vg/dev/sda3

$ lvdisplay

 

11. Now, let's extend the logical volume to all free space available.

$ lvextend -l+100%FREE /dev/ubuntu-vg/root

 

12. Extend filesystem.

$ resize2fs /dev/mapper/ubuntu--vg-root

 

13. Now, after all successfull step, check after condition of your disk.

$ df -h

You'll see size of disk increase from 15 GB to 97 GB.