Synchronizing an external copy of folders and files

A simple way to maintain an updated backup of your folders and files on an external storage media, such as an external harddisk or another computer, can be to synchronize them automatically at regular intervals using rsync.

rsync is a fast tool for copying files.

It can copy locally and to other hosts.

It reduces the amount of data, sent over networks, by sending only the differences between the source and destination files.

It copies files, that has changed in size or time stamp.

It can delete files on the destination, that has been deleted from the source.

If not installed, it can be installed from the ports collection.

cd /usr/ports/net/rsync
make
make install

In our example, we want to attach and mount an external harddisk and synchronize it, that is, copy files, that has changed since last backup, and, delete files, that has been deleted from the source since last backup.

mkdir -p -m 0700 /mnt/backup/`hostname`/home
rsync -a --delete /home/source /mnt/backup/`hostname`/home

We recommend, that you store external backups at another physical location, so you will survive theft, fire and the likes.

Print

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

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