# Excluding directories from backup

**URL:** <https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087>\
**Category:** Maintenance\
**Created:** [October 23, 2026, 9:49am UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087 "2026-10-23T09:49:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdoko](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/mdoko/32/3142_2.png) [@mdoko](https://discourse.mailinabox.email/u/mdoko)\
**Post date:** [October 23, 2026, 9:49am UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087/1 "2026-10-23T09:49:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![david.blythe](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/david.blythe/32/3143_2.png) [@david.blythe](https://discourse.mailinabox.email/u/david.blythe)\
**Post date:** [October 23, 2026, 2:50pm UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087/2 "2026-10-23T14:50:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mdoko](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/mdoko/32/3142_2.png) [@mdoko](https://discourse.mailinabox.email/u/mdoko)\
**Post date:** [October 23, 2026, 3:06pm UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087/3 "2026-10-23T15:06:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![david.blythe](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/david.blythe/32/3143_2.png) [@david.blythe](https://discourse.mailinabox.email/u/david.blythe)\
**Post date:** [October 23, 2026, 9:19pm UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087/4 "2026-10-23T21:19:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mdoko](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/mdoko/32/3142_2.png) [@mdoko](https://discourse.mailinabox.email/u/mdoko)\
**Post date:** [October 24, 2026, 12:46am UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087/5 "2026-10-24T00:46:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![damianocorliss87](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/d/9fc348/32.png) [@damianocorliss87](https://discourse.mailinabox.email/u/damianocorliss87)\
**Post date:** [November 17, 2026, 2:18pm UTC](https://discourse.mailinabox.email/t/excluding-directories-from-backup/17087/6 "2026-11-17T14:18:05Z")

</div>

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.
