Replicate btrfs subvolumes, handling Copy-on-Write (COW) relationships and incremental transfers automatically.
Project description
btrsync
Replicate btrfs subvolumes, handling Copy-on-Write (COW) relationships and incremental transfers automatically.
Documentation is on Read the Docs. Code repository and issue tracker are on GitHub.
Background
btrfs is a modern Linux Copy-on-Write (COW) filesystem supporting powerful features such as snapshotting and incremental serialization. This makes it easy to efficiently replicate related snapshots from one filesystem to another by transferring only the differences between them.
What is not easy, however, is manually identifying and tracking these relationships in order to fully leverage the features of btrfs. Built-in tools provide the necessary mechanisms, but the heavy lifting is left to the user.
This is where btrsync comes in.
True to its name, btrsync is "rsync, but for btrfs", reducing the complex task of comparing and replicating snapshots down to a one-liner:
btrsync SOURCE DESTINATION
Features
- Handles subvolume discovery and incremental transfers automatically
- Supports local and remote machines (through SSH)
- Intuitive CLI inspired by familiar tools like rsync and scp
Usage
Command-line
Run the main command-line interface with
python -m btrsync.cli [OPTIONS] SOURCE [SOURCE ...] DESTINATION
(replace python with python3 if your system's python defaults to Python 2)
Alternatively, you can directly run
btrsync [OPTIONS] SOURCE [SOURCE ...] DESTINATION
SOURCE arguments are interpreted as follows:
- Arguments ending in
/denote directories and match all subvolumes contained therein - Arguments containing shell wildcards match as expected
- Non-directory arguments with no wildcards match subvolumes verbatim
DESTINATION must reside on a btrfs filesystem.
Additionally, both SOURCE and DESTINATION arguments may:
- be rsync-like SSH locations (i.e., in
user@host:pathform) - be full URLs, with
file://andssh://as accepted schemas
The location syntax is similar on purpose to that of rsync and scp, and principle of least surprise applies.
Examples
A minimal example:
btrsync /snapshots/ /mnt/drive/backup
will transfer all read-only subvolumes below /snapshots/ to /mnt/drive/backup after asking confirmation.
A more involved case, fetching specific subvolumes from a remote machine:
btrsync -svp 'user@host:snaps/dev*' devsnaps/
will transfer subvolumes that match snaps/dev* from the SSH remote host host, logged in as user, to the local directory devsnaps/ after asking confirmation; in addition:
-sexecutebtrfscommands usingsudo-vprint verbose information during transfer-pperiodically report progress
Non-interactive invocation, useful e.g., in scripts:
btrsync -yq --incremental-only /snapshots/ ssh://user@backup.example.com:1234/snaps/
will transfer subvolumes under local directory /snapshots/ to the SSH host backup.example.com, connected as user to port 1234, saving them under the remote path /snaps/; in addition:
-yproceed without asking for confirmation-qdo not print output, except for errors--incremental-onlyskip any transfers that cannot be done incrementally
The help option provides further details:
btrsync --help
API
See the API Reference section of the documentation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file btrsync-0.3.tar.gz.
File metadata
- Download URL: btrsync-0.3.tar.gz
- Upload date:
- Size: 46.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbd0f7a874784c155dd15f7f79c22e76a92830ea71f0b5f228e8c4f1b7d7b148
|
|
| MD5 |
6e4735889565acc9f001278b8a4cec61
|
|
| BLAKE2b-256 |
10887e77ddc74702bd74642b579f82dc88932a8b3daa218bd896ab2ea58699ff
|
File details
Details for the file btrsync-0.3-py3-none-any.whl.
File metadata
- Download URL: btrsync-0.3-py3-none-any.whl
- Upload date:
- Size: 42.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d25975374176d2d6a1c6f8e0aa0d2f8aac20afa2f20eab8ee6f6126bc9b2ec1b
|
|
| MD5 |
a4751744976456ea2b0bbb3e45032c7f
|
|
| BLAKE2b-256 |
ebf2041427b9306393f099b7a9799bff1fd3b9dc0ae0dd46835022483cedb71b
|