Keeping Virtual Machine Disks Small
The office desktop, also the house network file server, hosts more than 20 virtual machines (VMs). Some VMs are used used daily, others as needed, and some are historical preservation of past projects.
Storage devices are finite in size. This includes the disks used for backups. One way to conserve storage space with backups is ensuring the VM virtual disks are compacted. A short shell script accomplishes that. The script is launched from within the
rc.local_shutdown script when executing a halt/poweroff and only if the system is a VM.
As all VMs are powered off when the office desktop is powered off nightly, this results in always zeroing unused disk space for each VM disk.
While zeroing unused virtual disk space is automated in the
rc.local_shutdown script, the actual compacting is not. That is remedied with a reminder in the backup scripts that are run manually. A cron job could automate the final compacting, but does not seem urgent.