-
Notifications
You must be signed in to change notification settings - Fork 3
Home
dups reads its config from ~/.config/dups/config.yaml
.
To store backups on a local target, your config would look like:
target:
path: /absolute/local/path/
To store backups on a remote target, your config would look like:
target:
path: /absolute/remote/path/
host: <backup-host>
To change ssh related options like user, port, key-file etc. the ssh config file is used.
For remote backups to work, you have to have ssh key-based authentication set up.
Passphrases are not supported.
Additional config options can be found here.
To list all includes you use -li
, --list-includes
.
To include files, folders and patterns you use -i, --include
.
$ dups -i /absolute/path/to/file.txt
$ dups -i /absolute/path/to/folder
To include items based on patterns you have to use single quotes to prevent the shell from expanding it.
# Includes all .png files contained in "/absolute/path/to/folder"
$ dups -i '/absolute/path/to/folder/*.png'
# Includes all .png files contained in "Pictures" (subdirectories excluded)
# for all users
$ dups -i '/home/**/Pictures/*.png'
include patterns will ultimately rely on shell expansion.
To remove included items you use -ri, --remove-includes
.
dups -ri /absolute/path/to/file.txt
dups -ri '/absolute/path/to/folder/*.png'
To list all excludes you use -le
, --list-excludes
.
To exclude files, folders and patterns you use -e, --exclude
.
$ dups -e /absolute/path/to/file.txt
$ dups -e /absolute/path/to/folder
To exclude items based on patterns you have to use single quotes to prevent the
shell from expanding it.
Unlike includes, excludes will not rely on shell expansion
and are applied while generating the file list.
If a to-be-included item matches one of the patterns, it will be excluded.
# Excludes ALL .mkv files
$ dups -i '*.mkv'
# Exclude all .mkv files contained in "Videos" (subdirectories excluded) for
# all users.
$ dups -i '/home/**/Videos/*.mkv'
To remove excluded items you use -re, --remove-excludes
.
dups -re /absolute/path/to/file.txt
dups -re '*.mkv'
To start a new backup you use -B
, --backup
.
To have backups run in the background you first need a daemon.
Once a daemon is running, you can start a new background backup by adding -bg
for user daemons or -sbg
for system daemons.
$ dups -B -bg
$ dups -B -sbg
To restore a backup you use -R
, --restore
.
This would restore the entire backup to its original location overwriting all
existing files.
To restore a specific backup we add the backups name.
The keyword latest
will automatically resolve to the latest backup.
$ dups -R 20180801180005
$ dups -R latest
To restore only specific items we use --items
.
$ dups -R --items /absolute/path/to/file.txt relative/file.txt
To restore to a different location we use --target
.
$ dups -R --items relative/file.txt --target /tmp
To have restores run in the background you first need a daemon.
Once a daemon is running, you can start a new background restore by adding -bg
for user daemons or -sbg
for system daemons.
$ dups -R -bg
$ dups -R -sbg
To list all backups you use -l
, --list
.
$ dups -l
Name Date Valid
20180801180005 01, Aug 2018 18:00:05 yes
20180802180005 02, Aug 2018 18:00:05 yes
20180803180006 03, Aug 2018 18:00:06 yes
...
To remove individual backups you use -r
, --remove
.
$ dups -r 20180801180005
To remove all backups but keep n of the most recent you use
--remove-but-keep
.
$ dups --remove-but-keep 7
To remove all backups older than some given time you use
--remove-older-than
.
The value is a combination of amount and identifier and supports:
Identifier | Unit |
---|---|
s | Seconds |
m | Minutes |
h | Hours |
d | Days |
w | Weeks |
# Removes all backups older than 7 Weeks
$ dups --remove-older-than 7w
dups can be run as a daemon to handle backup and restore tasks in the background.
To start a daemon you use either --daemon
or --system-daemon
.
The user daemon (--daemon
) is intended for user-sessions and should suffice
for most cases.
To backup/restore items owned by other users (e.g. root) have a look at the
system daemon.
The system daemon (--system-daemon
) is intended for users who need to
include files owned by other users (e.g. root).
To still read the correct config files (for both dups and ssh) you add --user
and your username.
# This has to be run as root
$ dups --system-daemon --user <your-username>
To still get desktop notifications, you have to additionally start a user daemon.
If system files have been included in your installation, there are systemd services available for both, the user daemon and the system daemon.
$ systemctl --user enable dups
$ systemctl --user start dups
$ systemctl enable dups@<your-username>
$ systemctl start dups@<your-username>
Scheduling is not included in dups but instead relies on external tools like cron.
I recommend cronie for systems where it is available. If not available, anacron (which cronie is based upon) is your best bet.
Here is an example on how I schedule my backups.
0 18 * * * nm-online -q -t 300; dups --remove-but-keep 13; dups --system-background --backup
This will:
- Use NetworkManager to wait up to 5 minutes for a network connection.
- Remove all, but keep the most recent 13 backups
- Instruct my system daemon to start a new backup (resulting in 14 backups total)
I have not been asked questions yet :)