[SOLVED] Extending Hard Drive in Ubuntu Guest

lilCDNnrg

Member
Oct 1, 2016
34
2
8
I am having a problem with my Ubuntu server 14.4.5 it is setup as an email server and has magically used up all the space it currently has on the disk which is causing problems with the PostgreSQL database on it. I have managed to do a apt-get clean up and have gotten some space back but I need to make the partition larger until I have some time to rebuild it and figure out what happened.

I extended the disk in the Proxmox GUI and they tried to extend it in the Linux file system which was setup as LVM but end up corrupting the disk each time and having to restore it from a backup.

Where could I find a guide to extending the disk as the ones that I have found don't seem to be working for me. I am using qcow2 images for the HDD.
 
I did and when I did the reboot the machine would not boot. I'm guessing it's something I'm missing but I'm not sure what.
 
It looks like i was finally able to get things done and have extended the drive from 8GB to 30GB. here was the process that i followed.

1) Turned off the VM
2) Backed up the VM
3) extended the disk using web GUI
4) booted the VM using Ubuntu Desktop
5) launched GParted using TRY Ubuntu
6) Right Clicked both sd2 and sd5 and chose "Deactivate".
7) Resized the extended (sda2) partition.
8) Resized the lvm (sda5) partition.
9) Booted up the VM normally
10) executed the following Commands:
a) lvextend -l +100%FREE [mount point] {/dev/vrtemlsrv-vg/root}
b) resize2fs [mount point] {/dev/vrtemlsrv-vg/root}​
11) Restarted and confirmed size
12) Backed up the VM