Technology weblog

IT-Essence
Sunday Jun 10, 2007

That useful rsync utility

Since some weeks, I own a housing for an external USB hard disk, and recently bought a 320 Gig hard disk to go with it for my backups. I didn't know 320 Gigs were that much though :)

Instead of all the hassle with DVDs (or even worse CDROMs), I now merely "rsync" my folders containing e.g. my pictures on a regular basis:

/usr/bin/rsync --verbose --progress --stats --compress --times --perms --delete -a \
srcDir/ /mnt/ext/partition2/destDir/

Actually, I already use rsync to backup this blog to the server of my provider. In this case, rsync seamlessly incorporates synchronization over SSH, see for example the following excerpt of my script that is started with cron every night:

 #!/bin/bash

BACKUP_LOCATION="username@xs4all.nl:backup"
RSYNC_COMMAND= "/usr/bin/rsync --verbose --progress --stats --compress --times \
--perms --delete -a -e ssh"

cd /tmp

#
# Backup Blog database
#
/usr/bin/pg_dump roller > rollerDB
/bin/bzip2 rollerDB
$RSYNC_COMMAND rollerDB.bz2 $BACKUP_LOCATION
/bin/rm rollerDB.bz2

#
# Backup uploaded files
#
$RSYNC_COMMAND ssh /usr/local/apache-roller-3.1/webapp/roller/roller_data/uploads $BACKUP_LOCATION

Comments:

Post a Comment:
Comments are closed for this entry.

Hire us
Archives
Tags
Links
Stats
Referrers