1

I will preface my question by saying I don't have a lot of experience with VirtualBox or Ubuntu, but did my best to read the information relevant to my problem and can't figure out why the solutions out there won't work for me.

I have guest Ubuntu running on virtualbox 6.1 through host Windows 10. Originally there was a 500 GB VDI created for the guest, but I wanted to expand that to 800 GB.

In order to do so, I went to “File > Virtual Media Manager” in the VirtualBox UI and expanded the drive from 500 to 800 GB. Then I logged into the guest and installed/ran gparted to allocate the new space to my main partition. These steps all appeared to be successful.

VirtualBox reports an actual size of 500 GB and a virtual size of 800 GB. Gparted reports 800 GB size in the lvm2 pv filesystem with 500 GB used and 300 GB unused.

What step am I missing?

1
  • 6
    You need to look into running pvresize and lvresize. First command make lvm aware of the increased disk space. Second command resizes the individual logical volumes. Use the -r option to resize the file system along with the volume
    – doneal24
    Commented Mar 11, 2022 at 23:16

2 Answers 2

1

Procedure I use after the virtual disk is resized. Does not require a reboot.

In vSphere client, browse to the VM, edit settings, increase the size of the hard disk

echo 1 > /sys/class/scsi_device/2:0:0:0/device/rescan
fdisk -l /dev/sda to confirm the new size

fdisk /dev/sda

Delete the last partition.

Recreate the last partition with default answers:

partprobe

pvresize /dev/sda1

vgdisplay to confirm.

lvresize or lvcreate as necessary.

0

Solution was found thanks to @doneal24.

First I ran sudo pvresize /dev/sda2 though I'm not entirely sure if this step was required for the next command I ran, which was sudo lvresize --size 800G /dev/ubuntu-vg/root followed by sudo resize2efs /dev/ubuntu-vg/root.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .