From OpenVZ to LXC with thin provisioning ?

lince

Member
Apr 10, 2015
78
3
8
Hello,

I'm migrating from proxmox 3.4 to proxmox 4.0 and therefore I'm migrating my containers to LXC.

I see that LXC containers use raw disks. With OpenVZ, containers only used the necessary disk space, but now I have a container that uses the entire 4GB raw disk image when it only needs 900MB.

Is there anything I can do to make this container use only the real disk space without using the entire 4GB ?

Thanks.
 
Hello,

I'm migrating from proxmox 3.4 to proxmox 4.0 and therefore I'm migrating my containers to LXC.

I see that LXC containers use raw disks. With OpenVZ, containers only used the necessary disk space, but now I have a container that uses the entire 4GB raw disk image when it only needs 900MB.

Is there anything I can do to make this container use only the real disk space without using the entire 4GB ?.

These RAW disk files are sparsely allocated, so they only use the disk space that's actually written to them.
Code:
root@proxmox4:/var/lib/vz/images/227# ls -lah
total 34G
drwxr-----  2 root root 4.0K Dec 19 01:16 .
drwxr-xr-x 19 root root 4.0K Dec 19 04:06 ..
-rw-r-----  1 root root  80G Dec 19 16:10 vm-227-disk-1.raw

root@proxmox4:/var/lib/vz/images/227# du -chs *
34G     vm-227-disk-1.raw
34G     total


The bigger problem is with snapshot backups.
At the moment you only get snapshot backups on ZFS. If you have to use LVM, there are no snapshot backups like with OpenVZ (only suspend), so there is always downtime.

LVM thin provisioning promises to solve the above snapshot backup problem, but it does not work for LXC containers at the moment, regardless of what the announcement says. See more here:
https://forum.proxmox.com/threads/lxc-snapshot-no-available-yet-will-it-work-on-lvm.23619

Also be aware that LXC has a number of shortcomings: disk IO causes much worse load compared to OpenVZ, and LXC containers routinely time out / disappear if one of them uses too many resources. Also inside a container the only resource thats displayed correctly is memory... number of CPUs, swap size, load average (and many other system statistics) are simply displayed from the host, conveying incorrect information to the guest.
 
Last edited:
Thanks, you are right, the file shows like a 4GB file but both du and the total of the ls command report only 848M. Interesting concept this sparse files.

About the storage, I don't know what to do yet. I have a 500GB drive that I wanna use to share the storage for a 2 or 3 node cluster that I'm building at the moment. I want to use 250GB for VMs and containers and the other 250GB for backups or whatever.

I was thinking about using lvm-ext4-nfs because I read that zfs needs at least 8GB of ram (I have only 4GB) and for ceph I would need more disks.
But this is gonna be my first shared storage so any advice will be more than welcome.

Regards.
 

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!