RSYNC-BACKUP
NAME
rsync-backup - a backup tool
SYNOPSIS
rsync-backup
[ options ]
backup-target source-directory...
DESCRIPTION
Rsync-backup
creates a copy of the directories listed in
source-directory...
under the directory called
backup-YYYYMMDD-HHMMSS
which is added to the directory
backup-target.
YYYYMMDD-HHMMSS
is the time the backup was started.
Running a second time creates a second copy
of the directories backed up under a different name,
but files that haven't changed aren't copied. Instead they are
hard linked to the version already present to save space.
backup-target
can be:
-
- /path
-
a local directory
- x@host:/path
-
/path on a host reachable via "ssh x@host".
- :filesys:/path
-
The directory
/path on
filesys.
filesys
will be
mounted if not present. It can one one of:
-
- /dev/sdaXXX
-
(a mountable block device)
- UUID
-
(a UUID displayed by blkid)
- LABEL
-
(a volume label displayed by blkid)
Older backups can be pruned to reduce space used. Files backed up can
be read and written by root if sudo access is available. You can opt to be
notified by email if the backup fails.
OPTIONS
- -a A, --age=A
-
Keep progressively fewer older backups.
A
is a comma separated list in the format
AGE:DAYS,....
Group backups in periods of DAYS long. If a period has
more than one backup at least
AGE
days old, prune the
youngest. Consider
7:2,30:7.
7:2
means only keep
1 backup per 2 days for backups a week or more old.
Reduce that to one backup per week after a month.
- --bwlimit=B
-
Passed through to rsync. Caps bandwidth usage. Useful with ssh.
- --exclude=E, --exclude-from=E, -f=F, --include=I, --include-from=I, -x, --one-file-system
-
Passed through to rsync. These options select which
files in the source-directory's are backed up. The
default is to backup all files.
- -g, --ignore-ssh
-
Exit silently (no email) if ssh host is unreachable. Useful with
sporadically connected laptops.
- -i, --ignore-device
-
Exit silently (no email) if the target :filesys: file system
in
backup-target
can not be found. Useful for
sporadically connected USB and networked drives.
- -m E, --email=E
-
Send email to email addresses
E
if the backup fails.
- --prune-all
-
Prune all unwanted backups. By default at most two are pruned.
- -p S,--max-space=S
-
After a successful back is performed prune older
backups until they occupy no more than
S
GiB.
Calculating the disk space used can be very slow.
- -r F,--min-free=F
-
After a successful backup is performed prune older
backups until there is at least
F
GiB of free space on
the
backup-target
file system.
F%
will treat
F
as a
percentage rather than a absolute number.
- -s,--sudo, --sudo-local, --sudo-remote
-
Read and write files as root.
--sudo-local
reads the
backed up files as root,
--sudo-remote
writes the backup as root,
--sudo
does both. Without
--sudo-remote
device files can not not be backed up and file
owner/group can not be preserved.
--sudo-local
requires
sudo --preserve-env
permission.
- -u S,--auth-sock=S
-
Communicate with ssh-agent over unix socket S.
The default is to use the
SSH_AUTH_SOCK
environment variable if set and valid,
otherwise look for the socket in a variety of well known places.
- -v,--verbose=S
-
Passed through to rsync.
DEPENDENCIES & LIMITATIONS
Dependencies in additional packages that come with Debian minbase
(ie, a very minimal install):
- findfs
-
Only needed if backup locations are specified by label or UUID.
- flock
-
Required.
- netcat
-
Required. Both the BSD and the traditional version will work.
- rsync
-
Required.
- sh
-
Required.
/bin/sh
must be a POSIX shell.
- /usr/lib/sendmail
-
Only needed if
--email
is used.
- ssh
-
Only needed if used as a backup target.
- sudo
-
Only needed if
--sudo
used or a file system must be mounted.
- chrt, eatmydata, ionice, nice, nocache
-
Optional, but if present will be used to reduce the impact of
rsync-backup
on the machine.
Rsync-backup expects the source and target file systems to be Linux or BSD.
ACL's and Extended attributes are not backed up.
AUTHOR
Russell Stuart, <russell+rsync-backup@stuart.id.au>.