Interact with btrfs snapshots made with snapper in a manner reminiscent of git.
Search for changes to files and restore old versions of files. The output is designed to be useable by other command line tools.
Written and maintained by Facet.
Adapted from answers of server fault.
pip install git+https://github.com/talwrii/btrgit#egg=btrgit
# Show what changes have recently happened to home
btrgit log /home
# Show what changed in snapshot 443
btrgit log /home 443
usage: btrgit [-h] [--debug] {volumes,purge,log,copy} ...
An interface to btrfs that behaves like git
positional arguments:
{volumes,purge,log,copy}
volumes Show the subvolumes
purge Remove files from all snapshots
log Show changes made to a directory tree or files
copy Copy a file or directory at a particular commit
optional arguments:
-h, --help show this help message and exit
--debug Print debug output
btrfs is an open-source filesystem for the linux operating system. Btrfs provides a feature called copy-on-write which allows files to be copied at virtual zero cost in terms of time and storage (see Functional Data Structure.
This feature also allows the implementation of snapshots, complete copies filesystem at a particular point in time at very little cost. Snapshots have existing in other filesystems and surrounding utilities: notably lvm, but the performance benefits of copy-on-write allows snapshots to be used far more aggressively.
snapper is one such tool that takes advantages of snapshots to produce an ordered history of how a filesystem has change.
The author found that he desired a more feature-complete interface to this history, and noting the similarity of of this concept to version control systems like git decided to write an interface more reminiscent of git.
- An initial subset of features was adapted from answers of server fault.
- This ideas here very much represents snapper's existing feature through the metaphor of git
- https://github.com/sysnux/btrfs-snapshots-diff.git was a pre-existing project to see the difference between btrfs snapshots
- snapper gui is a gui which may well provide similar features.
- zfs is an open-source copy-on-write filesystem with similar features to btrfs that is used in production by various companies. Code for zfs is owned by Oracle. Oracle has sued google using its copyright claims on another peice of open-source: Java. There is an (at the time of writing open) issue for extending snapper to interact with zfs )
Influenced by git
- This approach uses
btrfs subvolumes find-new, there is an alternative approach usingbtrfs receive.