Excluding directories from backup

Is it possible to exclude some directories from being backed up? I have some directories with large files that do not need being backed up, and I would like to exclude them from being backed up by the automatic backup script. What is the easiest way to do that?

The miab backup is a compressed version of: /home/user-data/ with the owncloud-backup and backup folder excluded.

So if your files are outside /user-data/ you should be fine.

They are within the ${STORAGE_ROOT}. Specifically, a part of a web page as some datasets that will be available for download for a couple of months. I want to avoid them blowing up the backup unnecessarily. I have those datasets backed up somewhere else already.

There are two ways you could proceed:

  1. Move the files outside of ${STORAGE_ROOT}

2.Edit the python backup file to exclude your folders

Using 2. will work, but your changes will be overwritten with ever miab update (not apt update). If the files are already present, and the script is running, it probably already included the datasets into the backup.

Yeah… I was afraid that would be the case.

My current solution is a modification of backup script together with automatically applying a patch to it after every miab update. It works, but it feels inelegant. I was hoping for a less hacky way of doing it.

If those datasets are served through the web server, a less hacky option may be to keep them outside ${STORAGE_ROOT} and point nginx at them with an alias. For example, keep them in /srv/datasets and add a location block using alias /srv/datasets/; under the relevant site. The rest of the site can remain where it is, and the backup script will not encounter those files, so you should not need to patch it after updates. Just check that nginx can read the directory and files.