Virtual disks (Virtualbox in our case) are very large files, that may change frequently. This is a big problem for backup. A little change (even a simple boot of virtual machine) may cause a 20 GB file to be stored twice during backup process.
The use of an incremental backup solution (eg rdiff-backup) could theoretically be an option, but may cause serious delays in the restore process for such a large file.
A good solution is to use immutable disks. When a virtual disk marked as immutable, practically becomes read-only and any differences will be stored in differencing disks. After shutdown of virtual machine, differencing disks are reset (not deleted), and any changes are lost. If this is not desired, you may turn off autoreset flag:
VBoxManage modifyhd <uuid> | <filename>-autoreset off
So, if you use the virtual machine only for software testing, after virtual machine setup with all necessary software and system updates, mark the disc as immutable.
When a major upgrade is necessary (either Virtualbox upgrade, or guest operating system update or guest software update), mark virtual disk as normal, perform the upgrade and then mark disk as immutable again.
The various differencing disks stored in the folder Snapshots, can either be ignored by the backup process, or simply deleted after shutdown and before the backup. Preferably from Virtual Media manager (Release → Remove)
Immutable virtual disks
In order to mark a disk as immutable, you should Release it from Virtual Media Manager. After mark the disk as immutable you should Attach it again to the virtual machine (from virtual machine Settings).
Attention
Be sure you have a backup of your virtual disks, before you make any changes!
References
Virtualbox
- Oracle VM VirtualBox
- Virtual storage
- Differencing images
- Differencing file not deleted after shutdown with immutable disk.
Entrepreneur | Full-stack developer | Founder of MediSign Ltd. I have over 15 years of professional experience designing and developing web applications. I am also very experienced in managing (web) projects.