duply backups to Google Drive for less than £2 a month

As of writing this google Drive prices are quite affordable and with the demise of  Crashplan for home I’ve been looking for alternatives.

so, over the next few weeks I’ll be abusing google drive as a backup.

Screen shot of google prices
Google Drive prices

Create A profile

firstly create a profile with

duply googlebackup create

Create an API token

visit https://console.developers.google.com/ and create an Client ID

client ID > Other
it will look something like this
sdfsodsafindafoaidsfdosihfh8sdf8s.apps.googleusercontent.com
and a secret key
3204uujfw9e0hw8ef9f_er3

pop these two values in to your gdrive file.

cat ~/.duply/googlebackup/gdrive

client_config_backend: settings
client_config:
client_id: <secret google ID here>
client_secret: <secret key here>
save_credentials: True
save_credentials_backend: file
save_credentials_file: gdrive.cache
get_refresh_token: True

 

these are the important part of the config file

cat ~/.duply/googlebackup/config
GPG_KEY='GPG KEY ID HERE'
GPG_PW='Password here'


GPG_OPTS='--compress-algo=bzip2 --bzip2-compress-level=9'

export GOOGLE_DRIVE_SETTINGS = gdrive

TARGET='pydrive://<USERNAME>@gmail.com/Backup'


SOURCE='/home/dthomas'

FILENAME='.duplicity-ignore'
DUPL_PARAMS="$DUPL_PARAMS --exclude-if-present '$FILENAME'"

MAX_AGE=1M

MAX_FULL_BACKUPS=2

MAX_FULLS_WITH_INCRS=2
MAX_FULLBKP_AGE=1M
DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE "

VOLSIZE=100
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

 

and ofcourse add any folders you wish to ignore.

cat ~/.duply/googlebackup/exculde

# 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/Bin
- /home/dthomas/Devel
- /home/dthomas/Games
- /home/dthomas/Videos
- /home/dthomas/Documents/ISOs
- /home/dthomas/Downloads
+ /home/dthomas
- **

this is the important part of the bashrc file

cat .bashrc

...
export GOOGLE_DRIVE_SETTINGS='/home/dthomas/.duply/googleDrive/gdrive'
...

then run with

duply googlebackup backup

this can be run manually or by adding it to your users crontab

Encrypted DVD Playback in Fedora 26

Photo in a matrix style of a DVD

Playing a DVD on Fedora 26 is not too difficult. Once the libdvdcss libraries are installed.

visit http://download.videolan.org/pub/libdvdcss/ and download the newest tar.bz2 package  e.g. 1.4.0

$ tar -xvf libdvdcss-1.4.0.tar.bz2
$ cd libdvdcss-1.4.0
$ ./configure
$ make
$ sudo make install

 

I had to add the following line to my /etc/ld.so.conf

/usr/local/lib

 

then a quick

sudo ldconfig

and DVD playback should be working again

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.

 

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!