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.