[SOLVED] Minimize backup size - how to?

Razva

Renowned Member
Dec 3, 2013
252
10
83
Romania
cncted.com
Hey,

I'm using Proxmox 5 and local ZFS for storage.

I've created a KVM VM, used the ZFS mount for storage, allocated 100GB of space, checked "discard" and installed the OS.

Immediately after OS install I've made a backup by using vzdump. Backup size was ~5 GB. Everything OK 'till here.

Next, I've downloaded 10 + 10 + 10 + 10 + 10 GB of data. All data files were different in order to keep ZFS dedup out of the way. "df" reported ~45 GB of used space. I've made a new vzdump, backup size was ~45 GB. Everything OK 'till here.

Lastly I've removed all "data" test files. "df" reported ~5 GB of used space. But when making the vzdump...the backup size remained at ~45 GB.

Is there any way to really discard unused data without interfering with the VM? I cannot ask everybody to allow me root access in order to manually clear/discard space via OS/VM.

Thanks,
Razvan
 
Are your VM disks SCSI? Only then the discard is passed through to the underlying system.
 
Did you activate the discard option on the VMs disks and does the OS inside the VM also do discard (trim)? Also check if your SCSI controller type is VirtIOSCSI.
 
Did you activate the discard option on the VMs disks and does the OS inside the VM also do discard (trim)? Also check if your SCSI controller type is VirtIOSCSI.
As previously specified I'm using SATA, not SCSI. So I guess the "Discard" option does nothing?
 
SATA & SCSI in combination with the VirtIOSCSI controller can passthrough discard.
https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_virtual_machines_settings
Asked my provider, we're using NVMe that are connected to the motherboard via M.2.

Here are the storage settings:
2017-09-15_11-15-40.png


Here are the VM settings:
2017-09-15_11-11-06.png


The OS is CentOS 7, Minimal.

The behaviour is the one specified in the initial post.

Do I need to set anything OS-specific?
 
Try fstrim -v / inside the VM, this should release the blocks if everything is working correctly.
 
Try fstrim -v / inside the VM, this should release the blocks if everything is working correctly.
Yeah, I just read that CentOS doesn't enable TRIM or discard by default. Things look better after running trim, so I guess this issue is fixed.

For those who have the same issue, just enable fstrim and you'll be good to go. :)
 
For those looking for the solution, long story short:
  • use ZFS as your storage
  • use VirtSCSI as "Bus/Device" when creating your VM
  • setup TRIM in the OS (it's not installed by default on CentOS / Debian / Ubuntu) or DISCARD. Note that "fstrim" needs to be manually executed so you should set a daily cron task that runs before doing the backups
I hope this helps.
 

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!