borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
10.97k stars 741 forks source link

"file changed while we backed it up" if file permission is changed during backup, even if the permission is same as before #8299

Open bojan-future opened 1 month ago

bojan-future commented 1 month ago

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

Yes

Is this a BUG / ISSUE report or a QUESTION?

BUG

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

Client:

Your borg version (borg -V).

1.2.4

Operating system (distribution) and version.

Debian GNU/Linux 12 (bookworm) x86_64

Hardware / network configuration, and filesystems used.

Proxmox VM / is on ext4 /home/sharedfiles/ is available to the network using samba

How much data is handled by borg?

about 1.4 TB

Full borg commandline that lead to the problem (leave away excludes and passwords)

borg create --stats \ $REPOSITORY::'{now:%Y-%m-%d_%H:%M}' \ /home/sharedfiles

Describe the problem you're observing.

For some files I get the warning "file changed while we backed it up" even though I am positive the file has not changed (ie. old rar archive, or a video file).

Possible cause:

There is a cron job running every minute that changes the permissions on all shared files. The permissions on above mentioned files are same before and after the cron job.

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

Yes It happens each time I start borg create on this system

Include any warning/errors/backtraces from the system logs

infectormp commented 1 month ago

I suppose this is the same problem as described in FAQ https://borgbackup.readthedocs.io/en/stable/faq.html#i-am-seeing-a-added-status-for-an-unchanged-file

ThomasWaldmann commented 1 month ago

@infectormp no, that's something different (FAQ is about unexpected "M" status for the most recent file, but this is about "changed while we backed it up that single file").

@bojan-future A "file" consists of data and metadata. While in your case the data might be unmodified, I think borg noticed that you touched the metadata.

Guess the easiest way to solve this is to not run that cronjob while you run the backup with borg. Or you just ignore the warning, which should be harmless in that case.

Another solution might be not needing that permissions-cronjob at all, by doing things a bit differently, e.g. using ACLs or sgid or samba configuration (if that is a samba share).

infectormp commented 1 month ago

@ThomasWaldmann I mean the root cause is the same. Metadata changed during the backup process.

ThomasWaldmann commented 1 month ago

The root cause is different in the FAQ item: there, the root cause is that borg intentionally deletes the freshest file from the files cache, so it will show "A" for that file even if it is totally untouched.