Backup a remote directory with duplicity

Why not just mount the remote path into your local filesystem tree using sshfs, cifs, nfs or some other facility of your choosing?

If you do that, you can specify two local paths to duplicity and it shouldn't notice that one of the paths is actually on a remote node (make sure you choose the remote file system that exports attributes like permissions etc. in a way you want and also make sure you use correct mount options - which is especially important for samba/cifs, since its defaults are not very unix-ish).

For a Debian or Debian derivatives (like Ubuntu):

apt-get install sshfs

Then:

mkdir -p /mnt/remote &&
sshfs username@remote:/home/username /mnt/remote

After that succeeds, do your backup from /mnt/remote to your local backup path, then

umount /mnt/remote

Also check out man sshfs to see what options might apply to your use case.


Duplicity doesn't support remote sources, so there is no way to do this without tricks like suggested by @blubberdiblub.

It have disappointed me when I found the issue, although they don't call this as an issue: https://answers.launchpad.net/duplicity/+question/143932


From what I understand, supplying remote path followed by local path imposes restoring data, which should be a full restore by default.

"full" parameter is only valid for making backups:

   full   Indicate full backup.  If this is set, perform full backup  even
          if signatures are available.

   incr   If  this  is  requested an incremental backup will be performed.
          Duplicity will abort if old signatures  cannot  be  found.   The
          default is to switch to full backup under these conditions.

So this command: duplicity full /home/me scp://[email protected]/some_dir will make a full backup of /home/me to remote host/some_dir. Full/incr only applies to MAKING backups, not restoring.

If you want to restore only certain path, then use:

--file-to-restore path This option may be given in restore mode, causing only path to be restored instead of the entire contents of the backup archive. path should be given relative to the root of the directory backed up.

According to documentation here: http://manpages.ubuntu.com/manpages/oneiric/man1/duplicity.1.html , what happens is:

When restoring, duplicity applies patches in order, so deleting, for instance, a full backup set may make related incremental backup sets unusable.

Also, last remark about the "ssh://" part. Try using scp/sftp, as according to documentation:

A NOTE ON SSH/SCP PROTOCOLS

   Duplicity specifies two protocol names for the same protocol.  This  is
   a  known  and  user-confusing issue.  Both use the same protocol suite,
   namely ssh through its' utility routines scp and sftp.  Older  versions
   of  duplicity used scp for get and put operations and sftp for list and
   delete  operations.   The  current  version  uses  sftp  for  all  four
   supported  operations, unless the --use-scp option is used to revert to
   old behavior.  The change was made to all-sftp in order  to  allow  the
   remote system to chroot the backup, thus providing better security.