How to restore a Nextcloud backup?

On every Nextcloud update to a new major or minor release, there is a backup step before installation. I am wondering if something went wrong during the update, how do I use this backup in a new installation.

Surely, the Nextcloud documentation explains what has to be backuped and how to restore it, but I have nowhere seen a guide that explains how to use the backup that was done during update.

Thanks for your hints.

That doesn’t represent much. It just copies the server files, without the data folder but with all the apps and the config directory in the data/updater-INSTANCEID/backups/ directory in a folder with the name schema

nextcloud-<version>.<major>.<minor>.<release>-unixtime

So for example:

nextcloud-27.1.5.0-1702631751

Unixtime is the seconds since January 1, 1970.
Converting Unixtime into human-readable time goes like this:

date -d "@1702631751" "+%Y-%m-%d %H:%M:%S"

so 1702631751 corresponds to 2023-12-15 10:15:51

However, no database dump is created without which you cannot undo anything.
Without a database backup and (not that important) a backup of the appdata_INSTANCEID folder, you cannot revert your update to the state from before the update.

For me it is a nice to have. I can fast compare versions on my machine with those backups but I create a backup from serverfiles, database and appdata together with some other important configuration files from acros the server before each update myself. The backup and restore steps are all perfectly scripted and stored in my .bash_aliases file. So my update steps looks like this:

snapshot
nextcloud-pre-update
nextcloud-update
nextcloud-post-update

When I then have problems with the new version I do

restore-snapshot

which shows me a list from all available snapshots I made where I select the snapshot I want to go back to, start restore job and after a minute it is all the old state again.

It is extremely important to have these steps perfectly organized and tested well, so that you know exactly what the steps are to be done, because when something goes wrong and you start to stumble around and encounters dificulties while your server is offline, maybe with an internal server error, that’s not a nice experience :wink:

Much luck,
ernolf

2 Likes

Thanks for your detailed answer. The backup during update seems to me pretty useless in case of a real problem. I do daily snapshots of database dumps, apps and files that are saved with rsnapshot somewhere else.

1 Like