- Create a new VDI disk under Controller: SATA, sized appropriately
- Clone existing VDI into new one
- Remove legacy VDI
- Download GParted ISO from GParted Live CD
- Mount GParted ISO under Controller: IDE
- Start the VM, which will boot on the GParted live CD
- Extend the existing LVM2 partition (/dev/sda2) with the new unallocated space
- Stop the VM, detach the GParted ISO, and reboot the VM
- Extend the logical volume into the resized partition By default, CentOS uses LVM (Logical Volume Manager), which requires an extra step.
- Resize file system
C:\Program Files\Oracle\VirtualBox> VBoxManage.exe clonehd "c:\Users\jerome\VirtualBox VMs\Mathusalem\Mathusalem.vdi" --existing "c:\Users\jerome\VirtualBox VMs\Mathusalem\Mathusalem 2.vdi"
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 48da07eb-3395-4fad-95e3-c0615b185da2
Identify the name of the logical volume via df:
df -h
Then force the LVM volume to take 100% of the available space on the partition:
lvextend -l +100%FREE /dev/mapper/vg_mathusalem-lv_root
resize2fs /dev/mapper/vg_mathusalem-lv_root
After this step, we are now good to go.