FTP backup with duplicity/ftplicity

While the 1blu vserver is still running even though I do not pay anything for it, I thought I could use it for something useful. ;-)

I found an interesting article about encrypted and incremental backups using ftp with the app “duplicity” in issue #13 of the German computer magazine c’t. (page 216)

The author of the article, Christiane Rütten, uses a wrapper script called ftplicity to simplify the usage of duplicity. It is working really great. Here are the steps to setup an automatic, encrypted and incremental backup using ftplicity/duplicity aggregated from the article:

————————————————————————-

apt-get install duplicity
gpg –gen-key
wget ftp://ftp.heise.de/pub/ct/listings/0613-216.tar.gz
unzip 0613-216.tar.gz
cp ftplicity/ftplicity /usr/local/bin
ftplicity
nano -w .ftplicity/conf
# GPG_KEY < = set to the 8 digit long key-id of the generated gpg key
# GPG_PW <= set to the passphrase which was used for generating the gpg key
# set the necessary ftp credentials
nano -w .ftplicity/exclude
# insert all directories which should be excluded from the back (each on a single line), for example: /dev /proc /sys /tmp /var/tmp /var/run
nano -w .ftplicity/pre
# insert all commands you want to execute before backup; for example dump of all mysql databases: mysqldump –all-databases -u admin -p’
chmod u+x .ftplicity/pre
chmod og-rwx .ftplicity/*#create first backup
ftplicity backup

#create crontab entries

# run the backup every night at 5am (incrementally)
00 5 * * * root /usr/local/bin/ftplicity backup

# run a full backup and delete old incrementals once a month
00 6 1 * * root /usr/local/bin/ftplicity full && /usr/local/bin/ftplicity purge –force

————————————————————————-


7 Responses to “FTP backup with duplicity/ftplicity”


  1. 1 ovidiu October 25, 2007 at 4:24 pm

    hello,

    I have been using these scripts for a long time, but then suddenly I got errors and never managed to get it working again. do you have any clue whats happening here:

    h898552:~# ftplicity backup
    Reading globbing filelist /root/.ftplicity/exclude
    Warning, found incomplete backup sets, probably left from aborted session
    No signatures found, switching to full backup.
    Error initializing file /var/www/web1/user/web1_renate/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web1/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web12/user/web12_catalin/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web12/user/web12_daniela/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web12/user/web12_elena/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web12/user/web12_francesca/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web12/user/web12_mada/var/run/mysqld/mysqld.sock
    Error initializing file /var/www/web12/var/run/mysqld/mysqld.sock
    Traceback (most recent call last):
    File “/usr/bin/duplicity”, line 373, in ?
    if __name__ == “__main__”: main()
    File “/usr/bin/duplicity”, line 366, in main
    if not sig_chain: full_backup(col_stats)
    File “/usr/bin/duplicity”, line 142, in full_backup
    bytes_written = write_multivol(“full”, tarblock_iter, globals.backend)
    File “/usr/bin/duplicity”, line 89, in write_multivol
    backend.put(tdp, dest_filename)
    File “/usr/lib/python2.4/site-packages/duplicity/backends.py”, line 349, in put
    self.error_wrap(‘storbinary’, “STOR “+remote_filename, source_file)
    File “/usr/lib/python2.4/site-packages/duplicity/backends.py”, line 335, in error_wrap
    except ftplib.all_errors, e: raise BackendException(e)
    duplicity.backends.BackendException
    h898552:~#

    I would be immensely grateful if you gave me any clues. I posted to a lot of forums and never found out how to fix it.

  2. 2 CB October 26, 2007 at 3:13 am

    It’s the same for me and I neither found a solution. :-(

  3. 3 ovidiu October 26, 2007 at 6:36 am

    I don’t believe this. I really posted in 2-3 forums dealing with linux server administration and I followed any advice I got => no result.

    The stupid thing is, after giving up I switched to reoback which ran for a few month perfectly, then stopped working too => same result: no one could help me :-)

  4. 4 ovidiu October 29, 2007 at 8:41 am

    hello, I was just wondering if you have another idea for a backupsystem? I have a root server and my provider provides ftp backupspace so I have no console access to the backupserver, therefore I had chosen ftplicity as it is perfect for the task.

    But I really need a backup system so if you have any ideas :-)

  5. 5 Robin February 16, 2008 at 6:28 pm

    For the people that still care, I had this problem too, and found a fix.

    This bug is caused because of a bug in ftplib. Sometimes, when the remote folder on the ftp server you are trying to backup to, is empty, then ftplib will crash. Just put a file or folder in the remote dir and you’ll be good to go…

    • 6 Tim Vaillancourt September 22, 2009 at 2:48 pm

      Amazon s3 + duplicity, hands down.

      There are lots of docs out there. Nice part is you only pay for usage to the GB, it’s http based so you can server http off of it such as static html, images, files (unrelated to backups, I know) and the data is guaranteed to replicated to 3 locations in the world.

      Tim Vaillancourt


  1. 1 simplificator » Blog Archive » Duplicity, FTPlicity and Python version troubles. Can not restore backup ? Trackback on December 6, 2007 at 6:11 pm

Leave a Reply





Archives

del.icio.us links