Hot to resize VM's disk properly? Df -h still shows LVM uses previous size

robs23

Member
Jul 4, 2021
2
0
6
41
I'm still new to Proxmox so please excuse me if I'm mixing conceptions etc. I have a VM in my Proxmox node which was creaed on LVM storage with 10G disk size. As the consumption grew, I've increased disk size in VM's hardware/hard drive settings to 20G and then to 30G. I'm very much puzzled that df -h still shows /dev/mapper/ubuntu--vg-ubuntu--lv size is still 10G and 100% used...
df.png

Here's output from lvdisplay:
lvdisplay.png

And below is output from lsblk which kind of shows sda is increased to 30G but the partition where my lvm lives is only 18.2G:

lsblk.png

I assume I have to make sda3 to use +10G as sda1 + sda2 + sda3 use only 20G now, but how?
 
Last edited:
Hello,
As said, I'm still a newbie. In the meantime I managed to increase the partition and sda3 is now little over 20G. But my LV is still 10G, I see the command to increase it to use whole available space, but I'm getting No space left on device when I try to execute it.. I need to find some files to remove in order to get some free space, otherwise can't increase LV. Perhaps you have some tips what I could safely remove? The VM runs Ubuntu server
 
Okay so i assume you did something like this:
Code:
# parted /dev/sda
(parted) resizepart 3 100%
(parted)
At this point your partition is 30G (Or +20G is you did not use 100%)
But thats not the whole thing.
You can check if your partition still has unused space with:
Code:
# parted /dev/sda
(parted) print free
(parted) quit
If so you can consume this free disk space with resizepart 3 100%
Now you will want to tell your Physical Volume(PV) that it can take more space as the partition it sits on has grown.
You can check if there is free diskspace available for your PV with [!CODE]pvs[/CODE]
I'd recommend reading https://pve.proxmox.com/wiki/Logical_Volume_Manager_(LVM) to understand LVM better.
Therefore resize the PV.
Code:
# pvresize /dev/sda3
The last step is then to resize the Logical Volume
Code:
# lvresize --extents +100%FREE --resizefs /dev/ubuntu-vg/ubuntu-lv
Hope this helps
 
  • Like
Reactions: chojin and cods69
Okay so i assume you did something like this:
Code:
# parted /dev/sda
(parted) resizepart 3 100%
(parted)
At this point your partition is 30G (Or +20G is you did not use 100%)
But thats not the whole thing.
You can check if your partition still has unused space with:
Code:
# parted /dev/sda
(parted) print free
(parted) quit
If so you can consume this free disk space with resizepart 3 100%
Now you will want to tell your Physical Volume(PV) that it can take more space as the partition it sits on has grown.
You can check if there is free diskspace available for your PV with [!CODE]pvs[/CODE]
I'd recommend reading https://pve.proxmox.com/wiki/Logical_Volume_Manager_(LVM) to understand LVM better.
Therefore resize the PV.
Code:
# pvresize /dev/sda3
The last step is then to resize the Logical Volume
Code:
# lvresize --extents +100%FREE --resizefs /dev/ubuntu-vg/ubuntu-lv
Hope this helps
Not OP, but thanks, this was exactly what I needed ;)
 
The last step is then to resize the Logical Volume
Code:
# lvresize --extents +100%FREE --resizefs /dev/ubuntu-vg/ubuntu-lv
Hope this helps
Thanks for this @hd-- !
However, I get the following message when using this code in my Proxmox shell:
Bash:
root@pve:~# lvresize --extents +100%FREE --resizefs /dev/pve/vm-152-disk-0
fsadm: Cannot get FSTYPE of "/dev/mapper/pve-vm--152--disk--0".
  Filesystem check failed.

Can someone give me a hint how to solve this?

All best
Dirk
 
you're trying to resize the LV on the host, but the instructions are meant to be executed inside the VM, after you resized the vm disk on the host in the GUI
Have you already done so?
And did you make sure the VM has logical volumes?
Please send us the output of lsblk.