Error using ZFS snapshotting #1001
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'm trying to use the ZFS snapshot feature of borgmatic to backup some files. I'm having an issue where borgmatic is attempting to snapshot and mount my root filesystem when I haven't specified it to do so. I am seeing a read-only filesystem error, from where it looks like it is trying to mount my actual dataset on top of the snapshotted root filesystem (which isn't possible since it is readonly).
truncated config file:
Any idea how to fix this/what I'm doing wrong?
Steps to reproduce
No response
Actual behavior
No response
Expected behavior
No response
Other notes / implementation ideas
No response
borgmatic version
1.9.10
borgmatic installation method
pip install
Borg version
1.4.0
Python version
Python 3.11.2
Database version (if applicable)
No response
Operating system and version
Debian GNU/Linux 12 (Proxmox)
Thanks for reporting this... I don't think you're necessarily doing anything wrong, and you've identified at least two different issues manifesting here:
staticfiles
snapshot mount point (because there's no final path component for a root snapshot mount point). I think the fix here may have to be a special case for any snapshotted root datasets to avoid that overlap.Some things that might help debug the first point:
zfs list -H -t filesystem -o name,mountpoint,org.torsion.borgmatic:backup
source_directories
?Thanks for the quick response, here is the output from zfs list.
I currently have the
org.torsion.borgmatic:backup
property unset, but I have tried both methods of first using only source_directories to specify the dataset and then instead using theorg.torsion.borgmatic:backup=auto
property on the dataset withsource_directories
commented out. It seems to produce the same result in either case where it snapshots my root pool and tries to mount it with the data pool on top.Okay, I've got a system (well, a VM) with a ZFS root now, so I'll see if I can repro this. Looking at the code though, I'm a little mystified as to how the root is getting snapshotted on your system. If it comes to it, would you be comfortable installing a replacement borgmatic ZFS hook with added instrumentation/logging?
Yes, I can do that if needed.
A quick update: Turns out, you won't need to install any additional instrumentation. I have a full repro of both problems here on my ZFS root VM! I added a little extra logging, and it looks like the root dataset is getting included in snapshotting because of a metadata directory that borgmatic sneaks into the archive to support the
borgmatic config bootstrap
action. Here's the added log:So I'll probably need to come up with a way to exclude such non-user-specified directories from the snapshotting.
Okay, this has been fixed in main and will be part of the next release. Here's the changelog:
Thanks again for the bug report!
Released in borgmatic 1.9.11!
Thank you for working out this issue so quickly! After testing the new update, it looks like everything is working with the zfs snapshot and borg archive creation. However, I am seeing an error during the cleanup phase of the process:
It looks like zfs.py is trying to remove the temporary snapshot directory twice (lines 395 and 414). I think the issue stems from my root path '/' showing up when
get_all_dataset_mount_points
is run. This causes it to be picked up bysnapshot_mount_path
on line 383 and removed on line 395 in addition to the removal ofsnapshots_directory
on line 414.I added some additional debug messages prefixed by '***' to find this:
Thanks for reopening this and providing the additional details. Unfortunately I don't have a repro here even with my ZFS VM, but here's something to try since you're already in the code. If you add
, ignore_errors=True
to the secondrmtree()
call so it looks like the first one, does that "fix" the problem? If so, I can make the change to main.Yes, adding
, ignore_errors=True
to the secondrmtree
fixes the issue for me.Okay, thanks for verifying! I've made the change to main and it'll be part of the next release.
Released in borgmatic 1.9.13!