I need to know how to fix my LVM stuff, so that I can use the 20 GB of space I added to my VirtualBox VM. I ran out of space in my VirtualBox VM. When I initially created the VM I selected "dynamic allocated storage". I mistakenly assumed the virtual hard drive would grow automatically as it ran out of space. Instead I learned that it does not automatically grow, but can be manually increased in size by use of a command line utility in the host OS provided by VirtualBox / Oracle. I backed everything up before making any changes.
So far I have run this command and successfully increased the size of the VM drive:
Code:
C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd "C:\Users\...path to vm\MyVm.vdi" --resize 40,960
0...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%.
Next I booted to an Ubuntu boot CD and started GParted. From there I disabled the lvm2 pv, and resized /dev/sda2 and /dev/sda5 to take up all of the additional space I just added. Because I do know what what I am doing, and for fear of trashing the existing data, I did not format anything. After these changes I can successfully boot into Ubuntu, but when check out the size of the drive, it looks as if it has not been increased.
Code:
user@zugzwang:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root 19G 16G 1.7G 91% /
I found a few commands online to get information about the Logical Volumes, Physical Volumes, and Volume Groups. This is what they show:
Code:
user@zugzwang:~$ sudo lvs
[sudo] password for user:
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
root ubuntu-vg -wi-ao--- 18.74g
swap_1 ubuntu-vg -wi-ao--- 1020.00m
user@zugzwang:~$ sudo pvs
[sudo] password for user:
PV VG Fmt Attr PSize PFree
/dev/sda5 ubuntu-vg lvm2 a-- 39.76g 20.02g
user@zugzwang:~$ sudo vgs
[sudo] password for user:
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 2 0 wz--n- 39.76g 20.02g
As you can see it looks like the problem is that my Physical Volume and Volume Group both show that there is 20 GB free, while the Logical Volume where the actual filesystem resides only has the original 18.74 GB. My question is how do I fix everything so that my filesystem can take advantage of the additional 20 GB of space I added?