Excluding trash and other data from backups

Hello, I would like to set up automatic backups for a Nextcloud installation. However, I don’t need to backup for example the trash, all the file versions or the updater backups.

Is it safe to restore Nextcloud from a backup that includes only the */files and appdata_* directories? If it’s not, is it at least safe to restore without */files_trashbin and */files_versions?

You can avoid trash files, simply perform files rescan after you restore the data:

sudo -E -u www-data php occ files:scan --all

Even you can exclude appdata directory, but you need to refresh your db after this:

sudo -E -u www-data php occ files:scan-app-data

There are different ways to do backup:

  1. I would say in a “light” way you can exclude /updater-*, /appdata_* and /apps directories.
  2. On a hard way you can exclude /data/<USER>/files_*.
  3. Bare minimum that you need to backup is:
  • db backup
  • user data folder backup
  • config.php backup, to be precise instanceid, passwordsalt and secret.
  1. I do my backups and excluding only /appdata_*, because I can recreate it quickly, and restore will take few minutes with minimum interaction.

Some docs regarding backups: Backup — Nextcloud latest Administration Manual latest documentation

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.