Btrfs snapshot does not work when snapshotting subvol at / #959
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I would like to use the newly added btrfs snapshot feature. In 1.9.4 a bug in parsing findmnt output prevented it from working. In 1.9.5, another bug seems to be preventing it from working.
Steps to reproduce
My setup is a flat btrfs layout with these subvolumes:
and a few others for data
/home, /etc/, and /var/log are backed up.
btrfs:
is added to the config with no extra settings.Actual behavior
It appears that a directory has been created on the filesystem that's stopping the snapshot from being made.
Log leading up to the failure:
Expected behavior
Snapshot should be created and backup should run
Other notes / implementation ideas
Below is my guess as to what's wrong.
Digging into the code, I see the following line in the source that seems to be causing this:
The snapshot path comes from this function:
When the path in question is "/", this probably produces an unintended result: the snapshot path would be
/.borgmatic-snapshot-60000/
as indicated in the log. (with trailing slash). However, when os.dirname is called on a path with a trailing slash, it returns the entire path before the trailing slash (/.borgmatic-snapshot-60000). This results in that directory being created, and the snapshot command failing.borgmatic version
1.9.5
borgmatic installation method
Arch official repo
Borg version
1.4.0
Python version
3.13
Database version (if applicable)
No response
Operating system and version
Arch Linux
Excellent detective work! I appreciate you filing this and diagnosing the problem as well. I don't have a system with a Btrfs root, which is probably why this use case went undetected during testing. I'll look into the code and see if stripping that trailing slash will serve as a fix. I may need to rely on you for actually testing it though...
I believe this is fixed now in main, but I don't have an easy way to test it locally. If you do though, I would appreciate it! The only file changed (besides tests and project metadata) is
btrfs.py
.Released in borgmatic 1.9.6!