1. 4FIPS
  4. APPS
  5. CODE
  7. ABOUT


Forums dedicated to the projects hosted at 4FipS.com

Skip to content

Encrypted backups using 'duplicity' on Windows via WSL

> Coding, hacking, photography, and such...

Encrypted backups using 'duplicity' on Windows via WSL

Postby fips on Fri Jul 02, 2021 3:16 pm

Luckily, the Windows Subsystem for Linux (WSL) has made it really simple to use all kinds of Linux command-line tools on Windows. One of such useful tools is an open-source backup package called duplicity. It's robust, feature-rich and can be deployed and used in just a few steps, like shown below:

Given the WSL is already installed, then by typing 'bash' in the Windows Command Prompt (cmd.exe), one can enter the Linux shell, like so:
C:\Users\john> bash

From there, 'duplicity' can be installed, like so:
sudo apt-get install duplicity

And that's basically it, given the drives are already mounted under '/mnt/', one can backup e.g. 'c:\Users\john\data\' into 'd:\backup_john_data\', simply by typing:
duplicity /mnt/c/Users/john/data/ file:///mnt/d/backup_john_data/

Which prompts for a passphrase and outputs something like this:
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: none
GnuPG passphrase:
Retype passphrase to confirm:
No signatures found, switching to full backup.
--------------[ Backup Statistics ]--------------
StartTime 1625233987.10 (Fri Jul  2 15:53:07 2021)
EndTime 1625233987.45 (Fri Jul  2 15:53:07 2021)
ElapsedTime 0.35 (0.35 seconds)
SourceFiles 4
SourceFileSize 8566184 (8.17 MB)
NewFiles 4
NewFileSize 8566184 (8.17 MB)
DeletedFiles 0
ChangedFiles 0
ChangedFileSize 0 (0 bytes)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 4
RawDeltaSize 8565672 (8.17 MB)
TotalDestinationSizeChange 8587856 (8.19 MB)
Errors 0

Similarly, restoring the backup from 'c:\backup_john_data\' back to let's say 'c:\Users\john\data_restored\', is just a matter of:
duplicity restore file:///mnt/d/backup_john_data/ /mnt/c/Users/john/data_restored/

Which verifies the passphrase and outputs:
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Fri Jul  2 15:53:00 2021
GnuPG passphrase:

The '--volsize' parameter can be used to change the size of the produced backup file chunks (the default value is 25Mb, which might be rather small by modern standards, and produce a lot of files in the backup directory).
duplicity --volsize 700 /mnt/c/Users/john/data/ file:///mnt/d/backup_john_data/
User avatar
Site Admin
Posts: 161
Joined: Wed Nov 12, 2008 9:49 pm
Location: Prague

Encrypted backups using 'duplicity' on Windows via WSL



Return to General Talk, News & Blog

Who is online

Users browsing this forum: No registered users and 1 guest