CLI Usage¶
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, if you installed via pip, 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 thereinarguments containing shell wildcards match as expected
- arguments with no wildcards and not ending in
/: if pointing to a subvolume, matches that subvolume verbatim
if pointing to a regular file, reads the btrfs send stream from file
- arguments with no wildcards and not ending in
DESTINATION must reside on a btrfs filesystem.
In addition, 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.
Alternatively, btrsync will use DESTINATION for comparing subvolumes while not actually performing any receive operations for the following options:
-o/--output-dirwill save the send streams as files in a local directory.-O/--output-pipeoption will pass the send stream through a shell pipeline. If-ois also supplied, the stream is then saved to a file, otherwise it is dumped to stdout.
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