12.12.2019

Extending disk space for FastNetMon VM installs

To extend default disk space size for FastNetMon installs on VM you need to extend disk space from hypervisor size and reboot virtual machine.

First step to run parted to update total disk space size. parted will ask you about fixing GPT table, please accept it and answer with “Fix”.

sudo parted
GNU Parted 3.2
Using /dev/sda
(parted) print
Warning: Not all of the space available to
/dev/sda appears to be used, you can fix the
GPT to use all of the space (an extra 167772160 blocks)
or continue with the current setting? 
Fix/Ignore? Fix                                                                                                            

As next step, please increase size of underlying partition used my LVM:

sudo parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  1076MB  1074MB  ext4
 3      1076MB  21.5GB  20.4GB

(parted) resizepart 3 100% 

After finishing this step we will have 100G partition:

sudo parted
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  1076MB  1074MB  ext4
 3      1076MB  107GB   106GB

Next step will be extension of LVM physical volume:

sudo pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
sudo pvs
  PV         VG        Fmt  Attr PSize   PFree 
  /dev/sda3  ubuntu-vg lvm2 a--  <99.00g 80.00g

Finally, extend LVM volume used for / partition to maximum size:

sudo lvresize -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Size of logical volume ubuntu-vg/ubuntu-lv changed
from 89.19 GiB (22833 extents) to <99.00 GiB (25343 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.

Extend root filesystem:

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 13
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 25951232 (4k) blocks long.

After finishing process, please reboot virtual machine.