Resizing disk a Virtual Box Ubuntu VM

347 Views Asked by At

I have resized the disk in Virtual Box, but this doesn’t show up in the ubuntu VM. As i see here doubts about resize a virtual disk I need to use gparted to use the unallocated space but I do not have enough space on the VM to install gparted. Is there anyway around this? If I do install a gparted iso file and mount it on the cd rom, how do I use it post that?

udev                                 472944       0    472944   0% /dev
tmpfs                                100880    1004     99876   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   4062912 3867440         0 100% /
tmpfs                                504392       0    504392   0% /dev/shm
tmpfs                                  5120       0      5120   0% /run/lock
tmpfs                                504392       0    504392   0% /sys/fs/cgroup
/dev/loop1                            99328   99328         0 100% /snap/core/9665
/dev/sda2                            999320  147652    782856  16% /boot
tmpfs                                100876       0    100876   0% /run/user/1000
/dev/loop2                            98944   98944         0 100% /snap/core/9804

The disk was 10GB earlier, i've added another 10GB

1

There are 1 best solutions below

0
On

So, the above disk is LVM partitioned. In order to resize, first we need to check available space in the volume group(allocated/unallocated) vgdisplay #specify volume group name if there are multiple Based on how much free space is there you can add using lvextend, lvextend -L +2G <device_name> So we have extended the file system, now we need to update it using resize2fs <device_name> check your free space again using df, you should be good