Skip to content

Latest commit

 

History

History
76 lines (47 loc) · 3.78 KB

File metadata and controls

76 lines (47 loc) · 3.78 KB

btrgit

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.

Attribution

Adapted from answers of server fault.

Installing

pip install git+https://github.com/talwrii/btrgit#egg=btrgit

Examples / Cheat sheet

# Show what changes have recently happened to home
btrgit log /home

# Show what changed in snapshot 443
btrgit log /home 443

Usage

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

Discussion

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.

Alternatives and prior work

Influenced by git

Caveats

  • This approach uses btrfs subvolumes find-new, there is an alternative approach using btrfs receive.