Quick and Easy Remote Backups

I backup my database, website, and my home directory on a daily basis to a remote server via SSH and rsync. Rsync is a tool that synchronizes directories. I also use it for grabbing current copies of slackware-10.1 and slackware-current.

It’s really easy to backup files to a remote server with these tools. I create tar archives of my needed directories and store the current ones in /opt/backups. I’ve made various bash scripts to do this on a daily basis for me automatically. After that’s complete, the code shown below is run. It transfers my /opt/backups directory to the remote server. It’s path on the remote server would be /home/tyler/backups. All you need to do is set the SERVER varaible to the hostname of the server you’re backing up to.

#!/bin/sh
SERVER=backup.server.com
rsync -avz --partial --delete --bwlimit=25 --progress --stats -e ssh \
/opt/backups tyler@$SERVER:/home/tyler/

The hardest part is finding a remote server that you’re able to backup to. If you’re lucky, your web host will allow you SSH access. There’s no need for the server end to have rsync installed. All it needs is SSH. I know BlueHost gives account holders SSH access. They’ve been hosting our sites at work for a while now and promptly gave me an SSH account. Their sites said they’d need an ID, but they didn’t require one from me for one reason or another. I backup to a freinds Linux box that’s located in a datacenter somewhere.

You might like these posts too::

  1. My remote control has arrived
  2. Upgrading
  3. PC’s at work
  4. Wankers
  5. Zend and IBM

3 Responses to Quick and Easy Remote Backups

  1. BestHosting says:

    This tool is handy and useful, I will write some artical about it for my visitors.

    :)

  2. [...] I sometimes display little snippets of code on this site. For example, here, here, and here. To do this, I use the Code Markup wordpress plugin. [...]

  3. Stephen Gilbert says:

    Hi,
    I’m interested in backing some machines up to my Bluehost account. Can you tell me how to do this without Bluehost running the server-side rsync? I’m used to doing something like:

    rsync -av /cygdrive/c/ @::backup

    with a different server, but this doesn’t work with Bluehost.

    Stephen

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>