Back up like an expert with rsync

By Joe ‘Zonker’ Brockmeier  on July 17, 2007 (9:00:00 AM)

Printer friendly page Print
Comment on this article Comments

In the last two months I’ve been traveling a lot. During the same period my main desktop computer went belly up. I would have been in trouble without rsync at my disposal — but thanks to my regular use of this utility, my data (or most of it, anyway) was already copied offsite just waiting to be used. It takes a little time to become familiar with rsync, but once you are, you should be able to handle most of your backup needs with just a short script.

What’s so great about rsync? First, it’s designed to speed up file transfer by copying the differences between two files rather than copying an entire file every time. For example, when I’m writing this article, I can make a copy via rsync now and then another copy later. The second (and third, fourth, fifth, etc.) time I copy the file, rsync copies the differences only. That takes far less time, which is especially important when you’re doing something like copying a whole directory offsite for daily backup. The first time may take a long time, but the next will only take a few minutes (assuming you don’t change that much in the directory on a daily basis).

Another benefit is that rsync can preserve permissions and ownership information, copy symbolic links, and generally is designed to intelligently handle your files.

You shouldn’t need to do anything to get rsync installed — it should be available on almost any Linux distribution by default. If it’s not, you should be able to install it from your distribution’s package repositories. You will need rsync on both machines if you’re copying data to a remote system, of course.

When you’re using it to copy files to another host, the rsync utility typically works over a remote shell, such as Secure Shell (SSH) or Remote Shell (RSH). We’ll work with SSH in the following examples, because RSH is not secure and you probably don’t want to be copying your data using it. It’s also possible to connect to a remote host using an rsync daemon, but since SSH is practically ubiquitous these days, there’s no need to bother.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s