Saturday, February 24, 2007

How to backup your computer with rsync or robocopy

when you store lots of data on your computer it is necessary to do backups of some kind. And least if you care for your data. For most users this task is not trivial. Today I will talk about two simple ways to backup your computer if you have either two computers at home or have an external disk drive you can map to your computer.

The tools used is either Microsoft® Robocopy or a tool called rsync.

Backup device (external storage)

The goal

The goal is to copy your files from one computer to another computer (or disk drive). How you choose to do so is up to you, here I'll talk about two ways to do so.

The backup solution here is designed to protect your data from disasters like stolen laptop, hard drive failures and so forth. It is not a tool to recover an old version of your document if you need so.

About backup

You can loose your family pictures forever.

In a computer, hard drives is the component that is most exposed to failures.

Both tools are relatively fast as only changed files are sent off the computer. As so, the first copy is always the slowest.

Robocopy

Robocopy is a free tool from Microsoft. It comes with their resource kits. If you don't have this tool you can download Robocopy from me.

Robocopy is a client-only tool. So you just need this one executable on your Windows powered computer. Just map your external drive as a drive letter and copy away. The syntax should be like this:

robocopy c:\ z:\backup-c /mir /np /r:0 /w:0

Your local drive is c:\ and the remote network drive is z:\. The /mir parameter ensures that if you delete a file on your local drive it will be deleted from the network drive as well.

Rsync

Rsync is primarily a client/server tool. You will need a (GNU/Linux) server running with the rsync server part to backup your files this way. The benefit of a client/server tool is that it works better on slow lines and that it can compare the content of a file and only transmit the changes to a file instead of the whole file. It also supports compression of data.

This article will not focus about how to set up the server part. There are lots of articles on the Internet that do so. My /etc/rsyncd.conf looks like this:

[nx9420]
comment=Backup nx9420
path=/data/nx9420
list=false
uid=root
gid=helge
use chroot=true
read only=false
write only=true

There are some Windows versions of rsync available, but the easiest and best is probably to install Cygwin and rsync from them.

When the server is up and running, I backup my drive with a command like this:

rsync -azv --delete-after . 192.168.1.2::nx9420

You have to be in your local drive root directory for this command to work. You will also need to substitute the IP address with your server's IP address.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home