SNAP-SYNC(8) | System Manager's Manual | 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] [-p port] [--sudo] [-s subvolid] [-u UUID] [-k] [-q]
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
-d, --description desc
-h, --help
-n, --noconfirm
-k, --keepold
-p, --port port
-q, --quiet
-r, --remote address
--sudo
-s, --subvolid subvolid
-u, --UUID UUID
EXAMPLES
snap-sync
snap-sync --UUID 7360922b-c916-4d9f-a670-67fe0b91143c --subvolid 5 --noconfirm
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
AUTHORS
Wes Barnett wes@wbarnett.us
SEE ALSO
2021-01-24 | SNAP-SYNC |