Skip to content
tadly edited this page Aug 23, 2018 · 17 revisions

Configuration

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.

Managing items

Includes

List includes

To list all includes you use -li, --list-includes.

Add 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.

Remove includes

To remove included items you use -ri, --remove-includes.

dups -ri /absolute/path/to/file.txt
dups -ri '/absolute/path/to/folder/*.png'

Excludes

List excludes

To list all excludes you use -le, --list-excludes.

Add 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'

Remove excludes

To remove excluded items you use -re, --remove-excludes.

dups -re /absolute/path/to/file.txt
dups -re '*.mkv'

Managing backups

Create backups

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

Restore backups

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

List backups

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
...

Remove backups

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

Daemon

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.

User 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.

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.

Systemd

If system files have been included in your installation, there are systemd services available for both, the user daemon and the system daemon.

User service

$ systemctl --user enable dups
$ systemctl --user start dups

System service

$ systemctl enable dups@<your-username>
$ systemctl start dups@<your-username>

Scheduled backups

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:

  1. Use NetworkManager to wait up to 5 minutes for a network connection.
  2. Remove all, but keep the most recent 13 backups
  3. Instruct my system daemon to start a new backup (resulting in 14 backups total)

FAQ

I have not been asked questions yet :)