I am a developer of timeshift-autosnap-apt which runs before any
update|install|remove command on Ubuntu, and works particularly well with btrfs.
I would like to have the same for Fedora 33 on btrfs, which requires changing the names of the subvolumes as I have outlined here:
Now timeshift works fine, but I was wondering if anyone knows how to implement a “DPkg::Pre-Invoke hook” in dnf? Or something similar to a Pacman trigger, but in dnf?
The idea is that when one runs a dnf update or upgrade command, timeshift should automatically create a btrfs snapshot.
Yes, this is possible. The DNF plugin API is fully documented. Additionally, you may find it useful to look at the sources of the Snapper plugin to create a Timeshift one.
If the documentation or the Snapper plugin do not provide sufficient guidance, please open a bug on dnf and describe your problems. We’ll do our best to help you.
It’d be preferred if Timeshift would accept the existing subvolume naming scheme instead of requiring users rename things. The “flat” layout is well suited for applications like Timeshift to create their own namespace for placing snapshots in, out of view of the user and other programs.
Snapshots will thwart accurate disk usage accounting e.g. when the user does
du -sh ~/ if snapshots are kept in the search path. Same for find/search/indexing utilities. There isn’t a good reason why snapshots for specialized tools like Snapper and Timeshift need to be in the mounted search path.
Also, we’re exploring a standardized naming scheme that will enable intelligent subvolume discovery and auto-assembly, similar to the idea of the Discoverable Partition Spec. A side benefit is being able to (finallly) explicitly support multi-boot Fedoras, .e.g F32+F33 or F33 Workstation+Silverblue.
Snapshots can be created/deleted without being in the mounted search path using either of two _fd variants
btrfs_util_create_snapshot_fd2() found in libbtrfsutil. There’s the C API and also python bindings that support this. Recursive snapshot creation and deletion, something not otherwise available in the user space tools, is also possible.
Thanks, I will look into this!
Good idea, I will do that!
I agree with your views. Thanks for pointing out to some of the development happening here, I will look into this.
Actually, what I like about Timeshift is its simplicity and GUI, and it is quite popular among users (gets mentions on the Linux podcasts all the time etc). Anyways, my plan is to
- Make an interface inside Timeshift to set the names of the BTRFS subvolumes. I have a fork where I hardcoded the Fedora 33 names root and home instead of @ and @home, which works well. Having an interface is I think a good first step here and I’ll work on that. If you are interested check it out here:
- Looking at the Snapper DNF Pluging I should be able to replicate this for Timeshift. Ideally, this would be part of Timeshift, I am in contact with the timeshift-autosnap developer and in some future we will merge all autosnap stuff into one repository (for apt, pacman, and hopefully dnf) and then try to merge it into Timeshift. I am not so familiar with the Vala language, but it does not seem hard to get into it.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.