dietpi-backup not backing up user_data

HI,

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.
Regards,
Keith Ellis.

Hi,

if I’m not mistaken, external disk are excluded by default and will not be backup.

Maybe MichaIng could help if I’m correct :slight_smile:

Yes that is true. Only when dietpi_userdata is on the same drive, it is included in into the backup.

But it should be possible to add contained directory via the “Custom filter” option.

means for the actual case /mnt/data/ to be included into custom file

I’ve added

+ /mnt/dietpi_userdata/
+ /mnt/data/dietpi_userdata/

to the .dietpi-backup_inc_exc file and it is not making any difference.

Just out of interest, where would you expect the backed up data for this to appear. Would it show in the /mnt/dietpi_backup/dietpi-backup/mnt/ directory?

Maybe I’ll just setup up a manual rsync job.

basically DietPi is doing nothing else than using rsync. If I find time, I could run some test

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 :thinking:. 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:

+ /mnt/sda1/dietpi_userdata/
- /mnt/*

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:

+ /mnt/sda1/dietpi_userdata/
- /mnt/sda1/*
+ /mnt/sda1/
- /mnt/*

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.

Thanks for your time on this. Much appreciated.