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

robs23

Member
Jul 4, 2021
2
0
6
40
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 ;)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!