RAW & VZ Sizes vs LXC Size

spanish

Active Member
Oct 18, 2009
4
0
41
Hello,

Please, excuse my ignorance...

I have a Proxmox 4.4 server with 2 LVM:
· /dev/mapper/pve-data for my unique LXC.
· /dev/mapper/pve-copias for the LXC snapshots.

# lvdisplay /dev/mapper/pve-data | grep Size
LV Size 154.00 GiB
# lvdisplay /dev/mapper/pve-copias | grep Size
LV Size 263.00 GiB

From my Proxmox 4.4 server:
# du -hs --apparent-size /var/lib/vz/images/101/vm-101-disk-1.raw
234G /var/lib/vz/images/101/vm-101-disk-1.raw
# du -hs /var/lib/vz/images/101/vm-101-disk-1.raw
137G /var/lib/vz/images/101/vm-101-disk-1.raw
# df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/pve-data 152G 137G 7.6G 95% /var/lib/vz

From my LXC:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 231G 85G 134G 39% /
...

Please, what is the real size of my LXC? 137G or 85G? Can I reduce the size of vm-101-disk-1.raw? (from 137G -raw size- to 85G -lxc size-).

Thank you very much!

Manuel
 
The space difference comes from blocks that have been written once, but are not in use anymore. This is very common for "dumb" storage backends like RAW. The best way to "trim" them in the RAW setup is to backup & restore them. I hope there will be a "move" option for containers in the near future for PVE, so that you can use that to trim your storage.

I'd suggest to use ZFS instead of RAW, then you'll not have that problem. ZFS uses files directly without the RAW+ext4 layer.
 
  • Like
Reactions: spanish