I hit an issue that sometimes, the disk size of a VM is not large enough after a few weeks development. I thought it is trivial to increase the disk size since I am using a VM. But it turns out that modify the system disk is not easy.
I searched online for a while and here is what finally works for me:
Details are explained here
- shutdown VM, increase disk size (please take a snapshot in case anything goes wrong)
- run cfdisk
- select free space
- click ‘New’
- select ‘Logical’
- select Type => 8e
- select Write and confirm by “yes”
- select Quit after writing
- reboot
- sudo pvcreate /dev/sda6
- sudo vgextend ubnt1204 /dev/sda6 (please look up the vgname by vgdisplay)
- sudo lvextend -l +100%FREE /dev/ubnt1204/root (look up the logiacal volume name by lvdisplay)
- sudo resize2fs /dev/ubnt1204/root
- run df -h to confirm new storage size
That’s it. Hope it helps.