Similar command/step will be available in ESXi host also.
versa@versa-analytics:~$ sudo vgdisplay
--- Volume group ---
VG Name system -à
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 79.76 GiB
PE Size 4.00 MiB
Total PE 20418
Alloc PE / Size 20407 / 79.71 GiB
Free PE / Size 11 / 44.00 MiB
VG UUID rQQ1qy-BBTO-H7TZ-Ua10-Wt11-mo2Y-tjuGyp
To add additional physical volumes to an existing volume group, use the vgextend command. The vgextend command increases a volume group's capacity by adding one or more free physical volumes.
Extends or add /dev/vda6 to system volume group
versa@versa-analytics:~$ sudo vgextend system /dev/vda6
Volume group "system" successfully extended
Extend the logical volume
versa@versa-analytics:~$ sudo lvextend -l+100%FREE /dev/system/root
Extending logical volume root to 81.76 GiB
Logical volume root successfully resized
versa@versa-analytics:~$
Resize the root file system.
versa@versa-analytics:~$ sudo resize2fs /dev/mapper/system-root
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/mapper/system-root is mounted on /; on-line resizing required
old_desc_blocks = 5, new_desc_blocks = 6
The filesystem on /dev/mapper/system-root is now 21432320 blocks long.
Check by issuing df command
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-root 81G 2.8G 74G 4% / à Is increased by 10 G.
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 799M 404K 799M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 0 3.9G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/vda1 236M 37M 187M 17% /boot
versa@versa-analytics:~$
versa@versa-analytics:~$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 90G 0 disk
|-vda1 253:1 0 243M 0 part /boot
|-vda2 253:2 0 1K 0 part
|-vda5 253:5 0 79.8G 0 part
| |-system-root (dm-0) 252:0 0 81.8G 0 lvm /
| `-system-swap_1 (dm-1) 252:1 0 8G 0 lvm [SWAP]
`-vda6 253:6 0 10G 0 part
`-system-root (dm-0) 252:0 0 81.8G 0 lvm /
# Original disk size is around 80G. Increase by 300GB
Command used to view the partitions : sudo fdisk -l
Ex:
[versa@versa-analytics: ~] $ sudo fdisk -l
Disk /dev/vda: 380 GiB, 408021893120 bytes, 796917760 sectors <<< Total Disk Size is 380GB ( 80GB + 300GB Additionally added )
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaca4508d
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 167770111 167768064 80G 8e Linux LVM <<< Already Existing Parition with 80GB
To create a new Partition you need to go to command mode with the CLI : sud ofdisk /dev/vda
[versa@versa-analytics: ~] $ sudo fdisk /dev/vda
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Use 'p' to print the current partition table to the terminal from within command mode.
Command (m for help): p
Disk /dev/vda: 380 GiB, 408021893120 bytes, 796917760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaca4508d
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 167770111 167768064 80G 8e Linux LVM
Use the command 'n'to create a new partition. You can create a logical or primary partition (l for logical or p for primary).
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2 <<<<< Depends on the new VDA partition number created.
First sector (167770112-796917759, default 167770112):
Last sector, +sectors or +size{K,M,G,T,P} (167770112-796917759, default 796917759):
Created a new partition 2 of type 'Linux' and of size 300 GiB.
To verify the partitions , use the command 'p'.
Command (m for help): p
Disk /dev/vda: 380 GiB, 408021893120 bytes, 796917760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaca4508d
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 167770111 167768064 80G 8e Linux LVM
/dev/vda2 167770112 796917759 629147648 300G 83 Linux <<<<< Type needs to be changed to Linux LVM
Use the command 't' to enter the partition type change command. Select the partition number and issue the Hex code '8e' to convert into Linux LVM.
Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): L <<<< To list all the codes.
Hex code (type L to list all codes): 8e <<<< Select 8e for Linux LVM
Changed type of partition 'Linux' to 'Linux LVM'.
Command (m for help): p
Disk /dev/vda: 380 GiB, 408021893120 bytes, 796917760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaca4508d
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 167770111 167768064 80G 8e Linux LVM
/dev/vda2 167770112 796917759 629147648 300G 8e Linux LVM
Use the command 'w' to write the new partition with defined properties.
Command (m for help): w
The partition table has been altered.
Syncing disks.