I’ve been running dietpi-backup for a while, and I’ve just noticed it is not backing up the /mnt/dietpi_userdata/ directory.
I’ve added this into the custom filers file, even though it says dietpi-backup backs up user data, so this should don’t be necessary, and it is still not backing it up.
I have an external drive (/dev/sdb1) which I have mounted in dietpi-drive_manager as /mnt/data/ and set it to use this drive for User Data
I have a second external drive /dev/sda1 which I have mounted as /mnt/backup/ This is the mount point specified in the dietpi-backup setup.
When I view the backup data, the /mnt/backup/dietpi-backup/data/mnt directory is empty. I presume this is where my user data should be.
Can someone help me understand what I am doing wrong please.
What I thought earlier already is that include/exclude rules are applied in the order they appear in the file, so that we might need to add the static rules after the custom rules (currently it’s the other way round) to get it working for includes. So far I was very careful in doing changes to this, to not change/break existing rules . I’ll also run some tests to verify this.
It’s basically true. Includes need to be defined before excludes, as the first matching rule is applied. Also includes for files/directories inside of excluded parent directories are never processed, so their include rules do never apply. This is why external DietPi userdata were never included like intended originally:
Since /mnt/sda1 is excluded with the second rule, it is never entered, and hence the contained dietpi_userdata directory is never processed which makes the rule obsolete. To Include only this directory while keeping everything excluded, the following would work:
In most cases, I guess + /mnt/sda1/ is wanted, to include the whole mount point.
Guessing too much with userdata however is not trivial, especially when taking into account that user might move them to a different place before restoring the backup. In this case, depending on includes/excludes, they could be unintentionally removed or doubled. Also while one might want to backup userdata, on restore, it is probably not wanted that newly uploaded images and videos are removed. So I decided that it’s better to make those rules transparent and editable to users by adding them to the default custom filter file: https://github.com/MichaIng/DietPi/pull/4474
The default rules are like they were: Only userdata on the root partition are backed up. When moved to an external drive, the rules need to be adjusted before updating the backup.