lxc resize problem

soban

New Member
Jan 20, 2016
12
0
1
37
hello,
I have some backup CT, but there is large size (10GB reserve) get. RAM and CPU I can change, but disk size is problem.
Real size of VM is 2GB, how can I RootDisk change to 4GB?
When i try:
root@new_proxmox:~# pct resize 100 rootfs 4G
unable to shrink disk size

I can change this configuration, but VM don't see it correct:
root@new_proxmox:~# cat /etc/pve/lxc/100.conf
arch: amd64
cpulimit: 1
cpuunits: 1024
hostname: new_proxmox
memory: 256
net0: bridge=vmbr0,hwaddr=32:31:38:30:66:39,name=eth0,type=veth
onboot: 1
ostype: debian
rootfs: local:100/vm-100-disk-2.raw,size=10G
swap: 256

But when I edit this rootfs line (to 4G) - that don't resolve problem. I see this value in panel, but when I try add for example more +2G then he back to 12G.

And CT (debian) see:
root@new_proxmox:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 7.8G 811M 6.6G 11% /
none 100K 0 100K 0% /dev
cgroup 12K 0 12K 0% /sys/fs/cgroup
tmpfs 16G 0 16G 0% /sys/fs/cgroup/cgmanager
tmpfs 3.2G 40K 3.2G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 205M 0 205M 0% /run/shm

How can I cut this space for example to 4G?
 
Last edited:
Hi,

you have to do this manually.
Make a backup before , if something goes wrong.

First shrink the filesystem.
You can do this with
resize2fs

Then you have to shrink the image,

qemu-img
 
I have backup, but it don't work:

root@new_proxmox:~# resize2fs -M /var/lib/vz/images/100/vm-100-disk-2.raw
resize2fs 1.42.12 (29-Aug-2014)
Please run 'e2fsck -f /var/lib/vz/images/100/vm-100-disk-2.raw' first.

root@new_proxmox~# e2fsck -f /var/lib/vz/images/100/vm-100-disk-2.raw
e2fsck 1.42.12 (29-Aug-2014)
e2fsck: MMP: fsck being run while checking MMP block
MMP check failed: If you are sure the filesystem is not in use on any node, run:
'tune2fs -f -E clear_mmp {device}'

MMP error info: last update: Tue Feb 23 11:55:05 2016
node: up-page-s1 device: /var/lib/vz/images/100/vm-100-di

/var/lib/vz/images/100/vm-100-disk-2.raw: ********** WARNING: Filesystem still has errors **********


any idea?
 
Last edited:
If you're sure it's not in use you can do as the output there suggests: `tune2fs -f -E clear_mmp /your/image.raw` before performing the other steps (e2fsck, resize2fs, ...)