I’m trying to backup a guest Ubuntu server on VirtualBox hosted by a OS X. As it’s little team server it can afford being down a few minutes (even an hour) during the night.
I’ve learned from experience that backing up a virtual machine while it’s running is a non sens as the files inside the guest machine would be inconsistent, particularly MySQL or PostgreSQL databases. To get a consistent backup you have to stop (or pause) the virtual machine (that’s the case for both VirtualBox and VMWare).
So I’m stopping the machine, export it as an .ova file (a tgz which content is everything you need to rebuild a VM) and reboot the machine. The whole process takes a tenth of minutes which I can afford.
The problem is the tgz is created every day during the night. Restic sees it as a brand new file, certainly cause its creation date is new. More, even its content differs from the previous due to gzip compression. So backing up this ova/tgz file is not a good solution, it wont benefit from deduplication.
I tried to extract the ova/tgz file (which gives vmdk files) to benefit from dedup and speedup restic. But again that is not the solution as every day the vmdk files are seen by restic as brand new files (certainly due to creation date and inode).
I took a step back and thought I could just stop the VM and do my backup with restic, but restic is giving me a ETA of 20 hours.
I don’t know what’s done by VirtualBox when you shutdown the guest system, the running machine was already backed up, so these 20 hours means there’s a huge difference between running and stoped instances.
In short
1- backing up a running VM is non sens
2- Exporting the VM as ova makes a new huge (15GB) file every day (means many hours)
3- Extracting the ova makes new vmdk files every day (same many hours)
4- stopping the machine and doing a restic backup asks for 20 hours even if the running machine is already in the repo.
I also thought that if I had a first backup the forth solution would be much faster on the second run, so I waited for 20 hours, then
- Booted up the virtual machine,
- made a simple sudo apt-get update followed by an apt-get upgrade which told me there were only one 300KB package to upgrade with no new space eaten from the disk space.
- Stopped the virtual machine
- Launched the same restic backup command …
This was two hours ago and restic is telling me to wait for 11 more.
So I’m stuck, if anyone has an idea…