PSA: borg does not support hardlink-copied repos #6286
Replies: 2 comments 2 replies
-
@enkore ^^^ |
Beta Was this translation helpful? Give feedback.
-
File system interactionLoggedIO generally tries to rely on common behaviours across transactional file systems. Segments that are deleted are truncated first, which avoids problems if the FS needs to Note that deletion, i.e. unlink(2), is atomic on every file system that uses inode reference Truncation is generally not atomic in itself, and combining truncate(2) and unlink(2) is of LoggedIO gracefully handles truncate/unlink splits as long as the truncate resulted in |
Beta Was this translation helpful? Give feedback.
-
Thought I could be clever and save some disk space when testing borg 1.2.
TL;DR: DON'T USE HARDLINKED REPO COPIES!
That's roughly what I did:
cp -al repo11 repo12
, IIRC)borg1.2 compact --cleanup-commits repo12
(among other borg1.2 commands, like check, list, etc.)This unintentionally modified my borg11 repo, because of how
delete_segment
works: it callstruncate_and_unlink
, which first modifies the file in place, truncating it to 0 bytes and then unlinks it (deletes it).If an inode is referenced by 2 filenames (2 hardlinks), that procedure will give:
In this case, the damage is relatively limited, the 17b files were crap anyway.
But
delete_segment
is also called for real, with-content segment files when the compaction runs. And that will cause real damage on the other (hardlinked) repo.repository.py has this, explaining why truncation is used:
At least the corruption in the borg11 repo was rather noticable: borg basically stopped working, just throwing exceptions and hanging.
So guess I'll use the borg12 repo exclusively from now on. :-)
Beta Was this translation helpful? Give feedback.
All reactions