Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluded folders trigger warning because of changes during backup #8471

Open
fidelski opened this issue Oct 14, 2024 · 8 comments
Open

Excluded folders trigger warning because of changes during backup #8471

fidelski opened this issue Oct 14, 2024 · 8 comments

Comments

@fidelski
Copy link

Have you checked borgbackup docs, FAQ, and open GitHub issues?

Yes, there are many reports but none specifies that the corresponding file was explicitly excluded.

Is this a BUG / ISSUE report or a QUESTION?

This is a BUG report.

System information. For client/server mode post info for both machines.

borg 1.4.0

Operating system (distribution) and version.

  • Arch Linux x86_64
  • Linux 6.10.10-arch1-1

Hardware / network configuration, and filesystems used.

  • ext4

How much data is handled by borg?

borg create -C zstd,13 --patterns-from /etc/backup/system.lst '::system-backup-{now:%Y-%m-%d}'

/etc/backup/system.lst:

R /
P sh

- home/
! re:^(proc|dev|sys|run|tmp)
- mnt/
- var/tmp/
- var/cache/
- root/.cache

Describe the problem you're observing.

When using the above pattern list that explicitly excludes /mnt for creating a backup, borg exits with an error because of changed files within a subfolder of /mnt.

Include any warning/errors/backtraces from the system logs

Okt 14 16:24:17 pc-dada-01-linux borg[1112235]: /mnt/cifs/Products: file type or inode changed while we backed it up (race condition, skipped file)
Okt 14 16:43:25 pc-dada-01-linux systemd[1]: system-backup.service: Main process exited, code=exited, status=1/FAILURE
Okt 14 16:43:25 pc-dada-01-linux systemd[1]: system-backup.service: Failed with result 'exit-code'.
Okt 14 16:43:25 pc-dada-01-linux systemd[1]: Failed to start Create the system backup.

The corresponding folder that generates the error is on the path /mnt/cifs/Products whereas the path /mnt is excluded from the backup. Hence the error is wrong, there is no race condition and files may change therein without affecting the backup.

I understand that the filesystem is still searched on /mnt as opposed to e.g. /proc - but since the entire folder is excluded from the backup borg must not exit with an error due to files changing therein. This way borgs exit code is useless or counterproductive respectively.

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Oct 14, 2024

There are 2 ways to exclude:

  • - will not backup matching files, but will still recurse into the excluded directory (use this if you want to include some stuff in there)
  • ! will not recurse deeper if the pattern matches

So, that would avoid the problem you are seeing.

But I get your point. Will have a look...

What is that Products - is it a directory, a mountpoint, automounter, ...?

BTW, status=1/FAILURE is not correct, borg uses 1 for warning, not for "failure".

@ThomasWaldmann ThomasWaldmann changed the title Excluded folders trigger error because of changes during backup Excluded folders trigger warning because of changes during backup Oct 14, 2024
@fidelski
Copy link
Author

/mnt/cifs/Products is a systemd auto-mounted directory driven by a corresponding entry in /etc/fstab. Because of the entry - /mnt in the list it is expected to be excluded from the backup - what it is (the directory does not get backed up), nevertheless the backup exits with a non-successful exit code because of changes within that directory (that is explicitly excluded).
Btw. Thanks a lot for all the effort and this wonderful backup solution!

@ThomasWaldmann
Copy link
Member

BTW, if you do not use !, borg will trigger the auto-mounting while recursing - is that what you want?

@fidelski
Copy link
Author

BTW, if you do not use !, borg will trigger the auto-mounting while recursing - is that what you want?

Thanks for the tip, didn't know that. Here I don't want this though, I just want to exclude some directories (that do not trigger errors/warnings since excluded).

@ThomasWaldmann
Copy link
Member

Well, then try using ! re:^mnt or so, so that it matches on the mnt directory name already and does not recurse into mnt and does not trigger your automounter.

@fidelski
Copy link
Author

Thank you for the idea. I found the following solution that actually even better matches my needs - just like you suggested with !, that way I don't get the error and I also get the outer most directory backed up (something I initially wanted): ! mnt/*. So I think the point is that the minus (-) behaves somewhat unintuitively (at least to me) in that warnings (/errors) are still triggered for files therein. I thought to have read the docs and did not come across an explanation for this. So maybe its just that the docs could mention this.

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Oct 15, 2024

The explanation for that is your automounter: it changes the inode in the moment borg accesses the mountpoint directory name. - doing recursion and ! not doing recursion is documented IIRC.

@fidelski
Copy link
Author

Ok, I understand. Sort of a special case with the automounter in place here. Still a warning for an excluded directory though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants