SNAP-SYNC(8)

NAME
snap-sync - send incremental btrfs snapshots, keeping track of them with snapper

SYNOPSIS
snap-sync [-c <config>] [-d <desc>] [-n] [-r <address>] [-s <subvolid>] [-u UUID]

DESCRIPTION
This program sends incremental snapshots to another drive for backing up data. Plug in and mount any btrfs-formatted device you want your system to be backed up to (like a USB drive). When you run the script you will be prompted to select a mounted btrfs device, or you can optionally select the disk using its UUID on the command line. The script iterates through all snapper configurations by default (this can be changed using the -c flag). For each configuration it creates a new local snapshot. If you have never synced to the specified device you will be prompted to enter a directory on the device where the backup snapshots will go. Additionally you are shown the location of the backed up snapshot. If you have performed a backup to this device before, only the changes since the last backup have to be sent. Use `snapper` to view the snapshots for a subvolume you have backed up. A snapshots with the description `Latest incremental backup` is kept on our local machine so that the next time `snap-sync` runs it will only transfer the difference between it and a new snapshot. Don't manually delete that snapshot unless you want to do an entirely new backup, transferring all of the data again.

OPTIONS
-c, --config <config>
    Specify the snapper configuration to use. Otherwise will perform for each snapper configuration. Can list multiple configurations within quotes, space-separated (e.g. -c "root home").

-d, --description <desc>
    Change the snapper description. Default: "latest incremental backup"

-h, --help
    Print the help message.

-n, --noconfirm
    Do not ask for confirmation for each configuration. Will still prompt for backup directory name on first backup.

-p, --port <port>
    The remote port. Used with '--remote'.

-r, --remote <address>
    Send the snapshot backup to a remote machine. The snapshot will be sent via ssh. Yous hould specify the remote machine's hostname or ip address. The 'root' user must be permitted to login on the remote machine.

-s, --subvolid <subvolid>
    Specify the subvolume id of the mounted BTRFS subvolume to back up to. Defaults to 5.

-u, --UUID <UUID>
    Specify the UUID of the mounted BTRFS subvolume to back up to. Otherwise will prompt. If multiple mount points are found with the same UUID and subvolid, will prompt user.

EXAMPLES

snap-sync
    Get prompted interactively on what disks to backup to and what snapshots to send.

snap-sync --UUID 7360922b-c916-4d9f-a670-67fe0b91143c --subvolid 5 --noconfirm
    Specify the UUID and subvolume of the external disk, backing up all subvolumes with a snapper configuration without promptin for confirmation.

FAQ

  How do I run this program on a schedule automatically?
You can create systemd unit and timer. Here is an example service:
        [Unit]
        Description=Run snap-sync backup
        [Install]
        WantedBy=multi-user.target
        [Service]
        Type=simple
        ExecStart=/usr/bin/snap-sync --UUID 7360922b-c916-4d9f-a670-67fe0b91143c --subvolid 5 --noconfirm
And here is its corresponding timer:
        [Unit]
        Description=Run snap-sync weekly
        [Timer]
        OnCalendar=weekly
        AccuracySec=12h
        Persistent=true
        [Install]
        WantedBy=timers.target

HOMEPAGE
https://github.com/wesbarnett/snap-sync

AUTHORS
Wes Barnett <wes@wbarnett.us>

SEE ALSO
btrfs-send(8), snapper(8)