Backup up with Duply

Backups are vitally important, if you have ever lost your data you will understand this.
The general rule is backup 3-2-1.

3 backups, 2 on-site and 1 off-site, of the local being your “active data”
thankfully Duplicity can do this for us and duply can make life easier still.

INSTALL

dnf install duply # Fedora & Family

apt install duply # Debian & Family

 

USING

The general form for running duply is:
duply PROFILE COMMAND [OPTIONS]

creating a profile for the local backup

➜ ~ duply Documents-local create

Congratulations. You just created the profile 'Documents-local'.
The initial config file has been created as
'/home/dthomas/.duply/Documents-local/conf'.
You should now adjust this config file to your needs.

IMPORTANT:
Copy the _whole_ profile folder after the first backup to a safe place.
It contains everything needed to restore your backups. You will need
it if you have to restore the backup from another system (e.g. after a
system crash). Keep access to these files restricted as they contain
_all_ informations (gpg data, ftp data) to access and modify your backups.

Repeat this step after _all_ configuration changes. Some configuration
options are crucial for restoration.

 

Editing the config and exclude files

The config file is quite self explanatory,

$ nano /home/dthomas/.duply/Documents-local/conf

 

 

GPG_PW='ENTER A PASSWORD HERE'
GPG_OPTS='--compress-algo=bzip2 --bzip2-compress-level=9'

TARGET='file:///mnt/tardis/backups/' #a mounted USB DRIVE
# base directory to backup
SOURCE='/home/dthomas/'

# exclude folders containing exclusion file (since duplicity 0.5.14)
# Uncomment the following two lines to enable this setting.
FILENAME='.duplicity-ignore'
DUPL_PARAMS="$DUPL_PARAMS --exclude-if-present '$FILENAME'"

# Number of full backups to keep. Used for the "purge-full" command.
# See duplicity man page, action "remove-all-but-n-full".
MAX_FULL_BACKUPS=2

# Number of full backups for which incrementals will be kept for.
# Used for the "purge-incr" command.
# See duplicity man page, action "remove-all-inc-of-but-n-full".
MAX_FULLS_WITH_INCRS=1

# activates duplicity --full-if-older-than option (since duplicity v0.4.4.RC3)
# forces a full backup if last full backup reaches a specified age, for the
# format of MAX_FULLBKP_AGE see duplicity man page, chapter TIME_FORMATS
# Uncomment the following two lines to enable this setting.
MAX_FULLBKP_AGE=1M
DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE "

# sets duplicity --volsize option (available since v0.4.3.RC7)
# set the size of backup chunks to VOLSIZE MB instead of the default 25MB.
# VOLSIZE must be number of MB's to set the volume size to.
# Uncomment the following two lines to enable this setting.
VOLSIZE=50
DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE "

# verbosity of output (error 0, warning 1-2, notice 3-4, info 5-8, debug 9)
# default is 4, if not set
VERBOSITY=5

 

the exclude file is easy, just list the folders not required in the backup
or use the .duplicity-ignore parameter from the config and place a “.duplicity-ignore” in
a folder you want ignoring.

nano /home/dthomas/.duply/Documents/exclude
# although called exclude, this file is actually a globbing file list
# duplicity accepts some globbing patterns, even including ones here
# here is an example, this incl. only 'dir/bar' except it's subfolder 'foo'
# - dir/bar/foo
# + dir/bar
# - **
# for more details see duplicity manpage, section File Selection
# http://duplicity.nongnu.org/duplicity.1.html#sect9

- /home/dthomas/Music
+ /home/dthomas
- **

Remote backup

➜ ~ duply Documents-remote create

Congratulations. You just created the profile 'Documents'.
The initial config file has been created as
'/home/dthomas/.duply/Documents-remote/conf'.
You should now adjust this config file to your needs.
...

 

once again edit the config and exclude files.

the important changes are

TARGET='scp://username:password@your.local.host:22//your/backup/path/' #a remote sever such as DigitalOcean

Running Backups

Running the back up is as simple as

duply <Profile name> backup # E.g. $ duply documents backup

then sit back and let the bits fly.