Replies: 3 comments 5 replies
|
Let me know if i need to promote this discussion to an issue |
|
Thanks again for the detailed write-up @roelbeun. I dug through this and there is one important nuance: That said, I did find a real cache persistence bug in the same area: a fresh named volume mounted at I opened a fix in #565. It sets |
Uh oh!
There was an error while loading. Please reload this page.
Summary
The container ships with
HOME=/root, so borg's default cache location is/root/.cache/borg/. However, the documented compose example mounts the cache volume at/home/borg/.cache/borg, which borg never touches. As a result, theborg files-cache and chunks-cache live in the container's writable layer and are lost on every container recreate (image update,
compose down && up, etc.).This is a silent performance regression: backups still succeed, but every container recreate forces borg to re-read and re-hash all source data from scratch. For large repositories this changes incremental runs from minutes to many hours/days.
Environment
2.1.01.4.42.0.0b21ainullcode/borg-ui:latestEvidence
Inside the running container:
The bind-mounted directory at
/home/borg/.cache/borg/contains 10 repo cache directories, but the file mtimes inside them are months old:Meanwhile recent backup runs (verified via
/api/activity/backup/{id}/logs/download) complete successfully withrc 0, which means borg is reading/writing a working cache somewhere — just not in the bind-mounted path. The only writable location that fits is/root/.cache/borg/in the container's ephemeral layer.No
BORG_CACHE_DIRorBORG_BASE_DIRis set in the container environment, so borg falls back to$HOME/.cache/borg/, which resolves to/root/.cache/borg/.The compose example in the README documents the mount as
/home/borg/.cache/borg, which is inconsistent with the image's actualHOME.Impact
On my setup, a ~10 TB media repository takes 33–51 hours for what should be a quick incremental run, because borg re-reads every source file across the network to rebuild the chunk index. With a persisted files-cache, the same run would complete in minutes (only newly added/changed files need to be hashed).
This is easy to miss because:
/home/borg/.cache/borg/is non-empty (it was populated before theHOMEchange took effect), so a casual check looks fine.Proposed fix
Either of the following would resolve the mismatch. I'd lean toward option 1 because it doesn't risk breaking other
HOME-dependent paths in the image:Update the compose example (and any other docs) to mount the cache at
/root/.cache/borg:Change the image's HOME to /home/borg (the directory already exists inside the image with the expected .cache/borg/ layout), and keep the compose example as is.
Set BORG_CACHE_DIR in the image to a stable path inside one of the persisted volumes (e.g. /data/borg-cache/), and document that path. This has the bonus of decoupling the cache location from HOME entirely.
Question
Is the current HOME=/root intentional, or a side-effect of switching base images? Knowing the intent would help decide between fix 1 and fix 2.
All reactions