dietpi-backup not backing up user_data Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
keithellis
Posts: 53
Joined: Mon May 23, 2016 2:55 pm

dietpi-backup not backing up user_data

Post by keithellis »

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.
User avatar
Joulinar
Posts: 4823
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-backup not backing up user_data

Post by Joulinar »

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 :)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3023
Joined: Sat Nov 18, 2017 6:21 pm

Re: dietpi-backup not backing up user_data

Post by MichaIng »

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.
User avatar
Joulinar
Posts: 4823
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-backup not backing up user_data

Post by Joulinar »

means for the actual case /mnt/data/ to be included into custom file
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
keithellis
Posts: 53
Joined: Mon May 23, 2016 2:55 pm

Re: dietpi-backup not backing up user_data

Post by keithellis »

MichaIng wrote: Fri Jun 04, 2021 1:28 pm 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.
I've added

Code: Select all

+ /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.
User avatar
Joulinar
Posts: 4823
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-backup not backing up user_data

Post by Joulinar »

basically DietPi is doing nothing else than using rsync. If I find time, I could run some test
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3023
Joined: Sat Nov 18, 2017 6:21 pm

Re: dietpi-backup not backing up user_data

Post by MichaIng »

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.
User avatar
MichaIng
Site Admin
Posts: 3023
Joined: Sat Nov 18, 2017 6:21 pm

Re: dietpi-backup not backing up user_data

Post by MichaIng »

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:

Code: Select all

+ /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:

Code: Select all

+ /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.
keithellis
Posts: 53
Joined: Mon May 23, 2016 2:55 pm

Re: dietpi-backup not backing up user_data

Post by keithellis »

Thanks for your time on this. Much appreciated.
Post Reply