Use the following steps to extend the root partition residing in a logical volume created with Logical Volume Manager (LVM) in a virtual machine running Red Hat/CentOS VMs. Increase the root partition size without server reboot in ESXi Host. You can do this simple steps to Increase VM root partition size in ESXi host.

If possible, take a complete backup of the virtual machine prior to making these changes.

Create new partition using fdisk

[[email protected] ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (209715200-419430399, default 209715200):
Using default value 209715200
Last sector, +sectors or +size{K,M,G} (209715200-419430399, default 419430399):
Using default value 419430399
Partition 3 of type Linux and of size 100 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

You can use the same way to add a new virtual disk to the existing VM and create a new PV instead of a new partition.

That’s it, You have done.

How to extend primary partition size in Linux for LVM

You have already created 4 partitions on your main drive but you want to extend the partition 4 with additional disk size. Once increased the size via the VMware instance Edit option and when you try to extend using fdisk <disk>, it will show error like below.

If you want to create more than four partitions, you must replace a primary partition with an extended partition first