我想将Proxmox VE 4.2上的LXC容器的主磁盘缩小,例如从30GB到20GB。 收缩似乎还没有得到支持:
$ pct resize <VMID> rootfs 20G unable to shrink disk size
任何想法如何做到这一点?
你可能已经知道了,但这似乎是LXC容器的限制,至less现在是这样。 从pct手册页:
<size> \+?\d+(\.\d+)?[KMGT]? The new size. With the + sign the value is added to the actual size of the volume and without it, the value is taken as an absolute one. Shrinking disk size is not supported.
如果你真的想缩小一个容器,我想你必须执行备份,然后使用--rootfs local:<newsize>选项来恢复它,如下所示:
pct stop <id> vzdump <id> -storage local -compress lzo pct destroy <id> pct restore <id> /var/lib/lxc/vzdump-lxc-<id>-....tar.lzo --rootfs local:<newsize>
当然,你不能在线执行这种调整,所以我不会把它称为一个很好的解决scheme,但是如果你没有其他select的话,它是有效的。
祝你好运,