reconfigure rootfs on running lxc machine via API = Error 500

dipe

Active Member
Mar 21, 2013
39
0
26
I can change disk size of a running container on the fly using the web api but I do not seem to be able to do this via rest api

root@proxa1:~# pvesh set /nodes/proxa3/lxc/124/config --memory 4096
200 OK
root@proxa1:~# pvesh set /nodes/proxa3/lxc/124/config --memory 4096 --rootfs volume=proxazfs:subvol-124-disk-1,size=18G
unable to modify rootfs while container is running

there there a way to get this working or should i make a feature request via bugzilla
 
There is an extra API entry point for resize:

# pvesh help -v nodes/localhost/lxc/124/resize
 
Ah, thanks Dietmar. I had looked at http://pve.proxmox.com/pve2-api-doc/ and it had not made it in there yet. This works perfectly. Now it seems that if the machine is powered down I can use something like this (in python lingo)
post_data['rootfs'] = re.sub(r",size=[0-9]+G", ",size=%sG" % lxcdisk, rootstr)

do even shrink disks. The resize method however does not allow me to shrink disks even if the machine is powered down. I am using zfs (e.g. volume=proxazfs:subvol-126-disk-1,size=30G)

Is this a protection mechanism? Is there any risk in downsizing the rootfs via the config method? My testes have shown that the config method fails (correctly) if the target size is below the currently used space.
 
shrinking traditional file systems is risky (it might cause data loss in some situations). so yes, this is a protection mechanism.
 

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!