Rsync and Carbon Copy Cloner

2

The one application I really miss on Windows is a utility that makes it easy to run backups and synchronize important files like all your folders. It is called Beyond Compare and is amazingly fast. I’ve tried a bunch of utilities but they are unsufferably slow on a Mac. So trying again:

Bob recommends Rsync as a command line utility. You just have to trust that the latest version of each file is what you want.

rsync -ncavu /source/ /destination
rsync -cavu /source/ /destination

The first line is a rest run to make sure what it is doing is sane and the next is the actually do the work and pray. The parameters are -c which means do a full checksum, not just date and length, -a means a full archive, -v means be verbose and -u means do an update so you are really replacing files.

Also bob says try grsync for a graphical front end and for wierd Unix reasons, you need a trailing slash in source but not on the destination. Finally, you should try

Carbon Copy Cloner is a shareware package that clones for backups, but doesn’t do what I need which is a two way sync with visual look to make sure the files are correct. Now for the commands.

I want a simple way to have say two Picture directories and to be able to sync them up. That is all the updated files from one side go to the other. That is because I edit photos are multiple machines and want to have two complete masters on the Drobo and a backup. It takes some work, but I think the correct command is to take the Pictures and then put it up. There is this wierd syntax on the trailing slash that I don’t completely understand, but this basically creates a directory /Volumes/Backup/Pictures which is a network drive and stuffs the contents of the /Pictures directory into it.

rsync -ravuz /Pictures /Volumes/Backup

Everything Linux – A Tutorial on Using Rsync

I’ll start with a commandline that I use in a script to synchronize a Web tree below from one local machine to another

rsync –verbose –progress –stats \
–compress –rsh=/usr/local/bin/ssh \
–recursive –times –perms –links –delete \
–exclude “*bak” –exclude “*~” \
/directory_to_sync/* \
webserver_ip_address:simple_path_name

Let’s go through it one line at a time. The first line calls rsync itself and specifies the options “verbose,” progress” and “stats” so that you can see what’s going on this first time around.

The “compress” and “rsh” options specify that you want your stream compressed and to send it through ssh (remember from above?) for security’s sake.

The next line specifies how rsync itself operates on your files. You’re telling rsync here to go through your source pathname recursively with “recursive” and to preserve the file timestamps and permissions with “times” and “perms.” Copy symbolic links with “links” and delete things from the remote rsync server that are also deleted locally with “delete.”

Now we have a line where there’s quite a bit of power and flexibility. You can specify GNU tar-like include and exclude patterns here. In this example, I’m telling rsync to ignore some backup files that are common in this Web tree (“*.bak” and “*~” files). You can put whatever you want to match here, suited to your specific needs. You can leave this line out and rsync will copy all your files as they are locally to the remote machine. Depends on what you want.

Finally, the line that specifies the source pathname, the remote rsync machine and rsync “path.” The first part “/www/*” specifies where on my local filesytem I want rsync to grab the files from for transmission to the remote rsync server.

The next word, “webserver” should be the DNS name or IP address of your rsync server. It can be “w.x.y.z” or “rsync.mydomain.com” or even just “webserver” if you have a nickname defined in your /etc/hosts file, as I do here. The single colon specifies that you want the whole mess sent through your ssh tunnel, as opposed to the regular rsh tunnel. This is an important point to pay attention to! If you use two colons, then despite the specification of ssh on the commandline previously, you’ll still go through rsh. Ooops. The last “www” in that line is the rsync “path” that you set up on the server as in the sample above.

Yes, that’s it! If you run the above command on your local rsync client, then you will transfer the entire “/www/*” tree to the remote “webserver” machine except backup files, preserving file timestamps and permissions — compressed and secure — with visual feedback on what’s happening.

Note that in the above example, I used GNU style long options so that you can see what the commandline is all about. You can also use abbreviations, single letters — to do the same thing. Try running rsync with the “–help” option alone and you can see what syntax and options are available.

Related Posts

2 Replies to “Rsync and Carbon Copy Cloner”

    1. @Paul: No I haven’t tried it. Frankly the command line was just easier as I was having lots of trouble with upgrade in place. I still like Beyond Compare better since you can visually see what is happening and it is super fast (but Windows only). Rsync seems pretty good and the -auv flag is perfect up mirroring files like my Music and Pictures to other drives for backup and multiple uses. I normally download some photos and then use rsync -auv to push it up to the home NAS.

Comments are closed.

© All Right Reserved