I run KVM based virtualization server (namely, Proxmox) where some Debian based machines are run in KVM VM's. Proxmox can create backups of VMs, it also compress the VM disks images.
As we understand, backup sizes are increasing over time, since more data stored on each VM disk and more 'clean' blocks of VM disk become 'dirty' (that is, contains remaining of old files). So, even if I delete all files on such a virtual disk by
rm -rf it, in fact the backup will be of the same size since this won't clear all the blocks of VM disk.
I can 'clear' the VM disk by doing something like
dd if=/dev/zero of=/BIG.txt and then
rm -f /BIG.txt - this way I create big file full of zeros that will use all of the disk space and after I delete it its ex-blocks will contain zeroes. The downside is that for a moment the disk become full which affects every program that want to write anything.
But maybe there are some other way to clear unused disk blocks with zeroes so backup will compress such a disk with better rate? Some Windows based programs offer options to 'clear unused disk space' (e.g. CCleaner), but I need that for Linux.