Resize LXC DISK on Proxmox

I don't know what's wrong here and this is just an idea, yet could work:
  • resize the volume to 32 GB
  • resize the filesystem to 32 GB
  • mount and fstrim the volume again, umount
  • skrink the filesystem to 14G
  • shrink the volume to 15G
  • resize the filesystem to the maximum capacity (without any size in the resize2fs command)
Maybe that helps.
 
Works in my case. Proxmox 8.1

lvchange -a y /dev/pve/vm-102-disk-0
lvreduce -r -L50G /dev/pve/vm-102-disk-0
lvchange -a n /dev/pve/vm-102-disk-0
pct start 102
 
Last edited:
  • Like
Reactions: Azimut
Nevermind, found out how.
Documenting it here for posterity. :)

On your proxmox node, do this.

List the containers:
pct list

Stop the particular container you want to resize:
pct stop 999

Find out it's path on the node:
lvdisplay | grep "LV Path\|LV Size"

For good measure one can run a file system check:
e2fsck -fy /dev/pve/vm-999-disk-0

Resize the file system:
resize2fs /dev/pve/vm-999-disk-0 10G

Resize the local volume
lvreduce -L 10G /dev/pve/vm-999-disk-0

Edit the container's conf, look for the rootfs line and change accordingly:
nano /etc/pve/lxc/999.conf

rootfs: local-lvm:vm-999-disk-0,size=32G >> rootfs: local-lvm:vm-999-disk-0,size=10G

Start it:
pct start 999

Enter it and check the new size:
pct enter 999
df -h
This was very helpful. Thanks
 
Nevermind, found out how.
Documenting it here for posterity. :)

On your proxmox node, do this.

List the containers:
pct list

Stop the particular container you want to resize:
pct stop 999

Find out it's path on the node:
lvdisplay | grep "LV Path\|LV Size"

For good measure one can run a file system check:
e2fsck -fy /dev/pve/vm-999-disk-0

Resize the file system:
resize2fs /dev/pve/vm-999-disk-0 10G

Resize the local volume
lvreduce -L 10G /dev/pve/vm-999-disk-0

Edit the container's conf, look for the rootfs line and change accordingly:
nano /etc/pve/lxc/999.conf

rootfs: local-lvm:vm-999-disk-0,size=32G >> rootfs: local-lvm:vm-999-disk-0,size=10G

Start it:
pct start 999

Enter it and check the new size:
pct enter 999
df -h
Created an account to reply to this....
Not sure if it's a PVE 8.x.x thing or not, but the lvdisplay | grep "LV Path\|LV Size" doesn't show any of the LXC containers, running or not. It only shows the PVE Root/Swap spaces

However, I was able to successfully resize the storage files using the other commands:
Code:
List the containers:
pct list

Stop the particular container you want to resize:
pct stop 999

Change to the location where the drive file is stored and:
- For good measure one can run a file system check:
e2fsck -fy vm-999-disk-0.raw

Resize the file system:
resize2fs vm-999-disk-0.raw 10G

Resize the local volume
lvreduce -L 10G vm-999-disk-0.raw

Edit the container's conf, look for the rootfs line and change accordingly:
nano /etc/pve/lxc/999.conf

rootfs: local-lvm:vm-999-disk-0,size=32G >> rootfs: local-lvm:vm-999-disk-0,size=10G

Start it:
pct start 999

Enter it and check the new size:
pct enter 999
df -h

Kori
 
Created an account to reply to this....
Not sure if it's a PVE 8.x.x thing or not, but the lvdisplay | grep "LV Path\|LV Size" doesn't show any of the LXC containers, running or not. It only shows the PVE Root/Swap spaces
of course it does not, you're using raw files, as shown in your output. No idea what went wrong in the setup ... yet this is overly complicated (having block storage, then file storage and then a raw file that is then again a block storage for your VM).
 
  • Like
Reactions: Korishan
of course it does not, you're using raw files, as shown in your output. No idea what went wrong in the setup ... yet this is overly complicated (having block storage, then file storage and then a raw file that is then again a block storage for your VM).
I have no idea, it's what was created when I used the Turnkey VM ‍♂️ But I figured to post what worked for me in case anyone else was looking and had a similar setup.
I didn't know there was a different between raw and the other formats other than performance. I'm definitely learning as I progress through the homelab design, redesign, reredesign, rerere......
 
Nevermind, found out how.
Documenting it here for posterity. :)

On your proxmox node, do this.

List the containers:
pct list

Stop the particular container you want to resize:
pct stop 999

Find out it's path on the node:
lvdisplay | grep "LV Path\|LV Size"

For good measure one can run a file system check:
e2fsck -fy /dev/pve/vm-999-disk-0

Resize the file system:
resize2fs /dev/pve/vm-999-disk-0 10G

Resize the local volume
lvreduce -L 10G /dev/pve/vm-999-disk-0

Edit the container's conf, look for the rootfs line and change accordingly:
nano /etc/pve/lxc/999.conf

rootfs: local-lvm:vm-999-disk-0,size=32G >> rootfs: local-lvm:vm-999-disk-0,size=10G

Start it:
pct start 999

Enter it and check the new size:
pct enter 999
df -h
This set of instructions are clear, concise, and easy to follow.

Thank you!

Just one quick question for either yourself or other members here -- if the disk ISN'T stored on the local-lvm thin provisioned volume; i.e. my LXC disks are stored somewhere else, but locally on the Proxmox system, is there a way for me to resize the .raw file WITHOUT having to first move it into the local-lvm thin provisioned storage?

(i.e. I have just mounted a directory (e.g. Datacenter --> Storage --> Add --> Directory) where it is able to store VM disks and also Containers as well) -- is there a way for me to resize the LXC container disks without having to first move them to the local-lvm?

Your help is greatly appreciated.
 
This set of instructions are clear, concise, and easy to follow.

Thank you!

Just one quick question for either yourself or other members here -- if the disk ISN'T stored on the local-lvm thin provisioned volume; i.e. my LXC disks are stored somewhere else, but locally on the Proxmox system, is there a way for me to resize the .raw file WITHOUT having to first move it into the local-lvm thin provisioned storage?

(i.e. I have just mounted a directory (e.g. Datacenter --> Storage --> Add --> Directory) where it is able to store VM disks and also Containers as well) -- is there a way for me to resize the LXC container disks without having to first move them to the local-lvm?

Your help is greatly appreciated.

Thanks!

Am not sure. But I'm thinking since it's mounted on a particular node, and accessible from there, should it matter where it actually is located?
ie just point to wherever the raw file is.

I might be totally wrong about this though...
 
Thanks!

Am not sure. But I'm thinking since it's mounted on a particular node, and accessible from there, should it matter where it actually is located?
ie just point to wherever the raw file is.

I might be totally wrong about this though...
The lv* commands aren't specific to the lvm though?

I am asking because when I type in lvdisplay | grep "LV Path\|LV Size", if I don't move it to the local-lvm storage, then it doesn't show up there.

So, I am assuming that the lv* commands are to manage said local-lvm storage location, and if the disks aren't there, then the remaining lv* commands won't work, correct?
 
The lv* commands aren't specific to the lvm though?

I am asking because when I type in lvdisplay | grep "LV Path\|LV Size", if I don't move it to the local-lvm storage, then it doesn't show up there.

So, I am assuming that the lv* commands are to manage said local-lvm storage location, and if the disks aren't there, then the remaining lv* commands won't work, correct?
I think you may be right.
Just checked a few VMs with their virtual harddrives located outside the local-lvm (they're on an external nfs-share) and I can't list these VMs using the commands above.
But even when I'm in the correct mounted folder, pointing to/located on the nfs share, I can't list those VMs.

Not sure how to go about this.
 
  • Like
Reactions: alpha754293
I think you may be right.
Just checked a few VMs with their virtual harddrives located outside the local-lvm (they're on an external nfs-share) and I can't list these VMs using the commands above.
But even when I'm in the correct mounted folder, pointing to/located on the nfs share, I can't list those VMs.

Not sure how to go about this.
Thank you for checking.

I appreciate you taking your time to do that.
 
  • Like
Reactions: adrian_vg

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!