In the previous post on the topic, I’ve had a look at how to create manual or automated local and remote backups of a Nextcloud AIO instance. Also, I mentioned briefly that restoring an instance to a previous state works without a fuzz. In this post, I’ll have a closer look, as there is one significant shortcoming of the default procedure: It’s all or nothing!
Fast Backups
Nextcloud AIO uses Borg Backup for creating a Nextcloud instance snapshot. To do this, all containers are stopped, which stops the database and anything that could keep transient data in memory. Once the instance is dormant, the data volumes of all Nextcloud AIO docker containers are written to a local or remote Borg archive. If only little data has changed since the last backup, this works quickly, as Borg performs a differential backup. Once the backup is done, all Docker containers are restarted and the backup procedure is finished. Very efficient!
Slow Restores
Restoring a Nextcloud AIO instance to a previous state works in the same way. All containers are shut down and the automated restore process then uses the backup selected by the user to restore the instance to a previous state. This works well but there is a significant catch involved: The restore process is NOT differential, i.e. all Postgres database files and all user data files are restored, even if they already exist on the instance and haven’t changed. This is not a problem if there are only a few gigabytes worth of user data. However, I have well over 300 GB of data on my Nextcloud. Restoring such an amount of data even over a 1 GB Ethernet link takes 50 minutes. Perhaps still acceptable. However, over a 40 Mbps VDSL uplink to which I’m currently limited if I want to keep my backup server at home, it would take 21 hours to get the data back to a server located in the cloud. Totally unacceptable.
Differential Restore Needed
So what I really need is a differential restore procedure. Unfortunately, the Nextcloud documentation doesn’t contain such a procedure. After thinking about it for a while, I figured out a way how to do it. Spoiler: rsync is your friend. More about that in the next post!