backup files made easy (through rsync)

I just bought a little (RAID-1) SAN so I can backup (safely) the dozain of hard disks I had from the computers from the last 10 years or so.

Using Mac’s Finder is just impossible as I can’t select all the files and copy them from the old disk to the new one. Indeed in case of a problem (corrupted file, network going down), it just stops and I would have to do it all over again.

So there’s the Terminal and
cp -Rf /old /new
except that it’s unstable, I’ve read that another command was written because of that, named ditto
ditto /old /new
or better, with the verbose option to see what’s happening, as the process is usually very long.
ditto -V /old / new

The only issue is that a failure at some point is very likely to happen when you’re transferring files during several hours, and ditto overwrites files, so when you restart, it’ll start again from zero and overwrite files that were already backup’d. No way I’m gonna accept that.

Good old rsync is coming to the rescue, the best line I’ve cooked up is :
rsync -azvu --progress /old /new

so the meaning is :
-a : archive, i.e. keep permissions, timestamps and so on.
-z : compress data, so there’s less data to transfer, and it goes faster.
-v : verbose, so you know what is going on.
-u : updates only
– -progress : pretty explanatory, eh?

Of course this is recursive, creating directories, etc. You can let it run and do something else.
It works also on networks, e.g.
rsync -azvu --progress /old myuser@myhost:/new

What’s worth noting is that first rsync is copying files, and the next ones will only updates parts of the files that must be updated

There are lots of options, it’s really a cool tool, so don’t hesitate to explore.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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