Backing-up with Rsync and Robocopy

Disclaimer: With great power comes great responsibility –improper use of rsync and robocopy may result in irreversible data-loss. If working on your OS X terminal or Windows command prompt takes you too far out of your comfort zone, then you may be better off with a tried and tested off-the-shelf solution.

Face it – there is no “undo button” in real life. Maybe it was your hard drive that suddenly died on you. Your precious memories now forever consigned to the digital wasteland. This then followed by the cruel realisation that there isn’t a spare copy lying around. Yes – just like many “oh s**t” moments in life – you didn’t see it coming. You could have made a backup.

A “backup”, in this context, is a copy of your files that you can put aside for safekeeping. There are many other off-the-shelf solutions that offer a variety of functions and we hear terminology like “delta copy”, “disk imaging” getting thrown around frequently. However, in the strictest sense of the word, a backup is just a duplicate of your files.

This is not meant to be an exhaustive guide on rsync and robocopy. Rather, I intend to illustrate how a simple backup operation can be performed with these two terminal commands.

What You Will Need

  1. An external storage device – preferably a hard drive.
  2. A computer running Microsoft Windows Vista and above, or a Mac.
  3. Some patience and common sense (see Additional Notes at bottom of page).

Introducing rsync and robocopy

If you haven’t figured out already, rsync and robocopy are terminal commands that can be used to perform simple to fairly advanced synchronization of files between two folders.

There is risk associated with using rsync and robocopy, but in my opinion, for that it more than makes up for in a few ways:

  • It’s FREE (comes with your operating system).
  • It’s powerful – plenty of sync options available (beyond the scope of this guide).
  • It’s smart – can be configured to sync only files that have been changed/updated.

Rsync – “Remote Sync”, use this on UNIX-based systems (eg. Linux, Mac OS X etc.)

rsync -option --delete --progress [source path] [destination path]

Robocopy – “Robust File Copy”, use this on Windows Vista, Server 2008 and up

robocopy /MIR [source path] [destination path]    

I will provide more examples and a detailed breakdown of the options available.

It is possible to use both rsync and robocopy in conjunction with the Automator on OS X and the Task Scheduler for Windows, but that is a topic for a future blog post.

Robocopy

Syntax format for robocopy is:

robocopy /MIR [source path] [destination path]

Example usage:

robocopy /MIR C:\src C:\dest

Copy the above line of text and paste it in notepad. The under filename, key in “robocopy-example.bat”. Include the double quote marks to force notepad to save the file with a .bat extension.

You may save the .bat file to your desktop or anywhere that is convenient. Make sure there are two folders in drive C:\ called src and dest as the script won’t work if these folders are not created beforehand.

Copy some files or folders into the src folder and double-click the .bat file that you earlier created. Notice the files and folders getting synced over to the destination folder. Because we invoked the “/MIR”, or “mirror” switch, note that any files or folders deleted from the source folder will also be deleted from the destination. Consider yourself warned.

Do note that you can assign any folder path for the source and destination folders. Note that this is a one-direction sync; adding files only to the destination folder, then running the script will result in the files being deleted from the destination as they don’t exist in the source folder.

Rsync

With rsync, things are a little less straighforward as you will need to configure file permissions in order to run your command script (more on this later). Notice that there are also more options. I’ll run through these one-by-one. Take note that rsync, like robocopy, syncs in one direction.

Syntax format is:

rsync -option --delete --progress [source path] [destination path]

The below example is what I am using to backup

rsync -av --progress --delete /Volumes/Seagate\ Backup\ Plus\ Drive/My\ Files/Photo\ Backups/2016/ /Volumes/Seagate\ FreeAgent/My\ Files/Photo\ Backups/2016

The -av option defines that the copying should preserve the file and folder attributes (eg. Date modified, created etc.) and that the copying process should output verbose logs. The –progress parameter indicates that rsync should output the progress of the copy process. And finally, –delete will remove any files or folders in the destination path that is not found in the source.

Note that the back slashes in the source and destination paths are used in conjunction with the spaces in the folder names.

Here’s a clearer picture:

Source: /Volumes/Seagate Backup Plus Drive/My Files/Photo Backups/2016/

Destination: /Volumes/Seagate FreeAgent/My Files/Photo Backups/2016

Note: The destination path is missing the terminating forward slash (/). This is intentional.

Save the above script in a text file with extension .command (example: rsync-sample.command). For simplicity, save this file to your desktop.

Now we’ll need to adjust the file permissions so we can execute the script in OS X via double-click.

In the OS X terminal, navigate to the desktop (or the location where the command script was placed) and enter the following:

chmod 775 rsync-sample.command

Then hit [Enter].

You should then be able to execute the file via double-click.

Additional Tips

  • Any files that are used by any open programs will not be synced. Make sure to close all applications before syncing.
  • Be careful when specifying the source and destination folders. Reversing the order may cause irreversible data loss.
  • The examples provided here are based on my usage and workflow. There are many other options switches available for rsync and robocopy.
  • I recommend doing a few practice runs before trying out rsync or robocopy on your actual data.

iWork for the Rest of Us

I had been an early adopter of Google’s online productivity suite, Google Docs (now Google Drive). Microsoft followed shortly after with their web version of their Office suite. And now, it seems that Apple has joined the bandwagon. Well, better late than never right?

iWork Beta. Now available for non-developers!

The iWork applications are still tagged as beta, and performance is sluggish at best, but it’s a bold move especially for a company that had for a long time been trying to crack into the web services niche, something that Google had mastered a number of years back. Let us sit back and wait for more news this 10th September.

Vintage Phones Going For A Song

It would definitely be a crazy idea to sell a vintage phone for a tidy sum of RM 1499.00, but that is exactly what Digi did. The phones were definitely NOT going for a song, but I had to choose word that rhymed with the rest of the title. With April Fool’s day lurking just around the corner, I just couldn’t help glancing at Digi’s latest ‘offerings’ with suspicions. I’m not sure if the company has done this before, but it seems that the folks at Digi are not without a sense of humor. The first device that caught my eye was the ever-venerable Nokia 3310, which was what Nokia made they married a tank with a microchip (it was tough and state-of-the-art at the time). The phones definitely have their selling points, chiefly being the toughness of the devices, and in their own words, with one model even sporting a ‘super thick’ antenna. Who needs to carry a weapon when you can just use your phone in self-defense? Another selling point? Check.

In no order of specific importance, some of the features found across the range are as follows:

  1. Awesome snake game.
  2. Vibration alert (yeah right).
  3. Real buttons you can press (wow! Long time no see!).
  4. Looks cool when you answer phones (and I thought only BlackBerry users were dinosaurs).

Also, Digi is being such a darling for throwing in a whopping 30GB of Internet for the devices. Internet done right? Maybe, except that it may take till the next Ice Age to spend all 30 gigabytes of the allotted quota, which is hardly surprising since, you know, the phones come equipped ultra-modern WAP browsers. Not.

 

The Mobile Shall Inherit the Earth

The mobile shall inherit the earth they say. At least, judging by how often some people fondle and caress their mobile devices, that might be going to happen some time soon in the future. In fact, it’s already happening as I am writing this. Image credits: www.bonkersworld.net.

20130220-130518.jpg

I’m not getting all biblical about this, but have you ever tried leaving the house without your mobile device? It doesn’t feel good for me, because it makes me feel ‘naked’.

Downtime

Just some time between noon and about 8pm today, you may have noticed that it was difficult, if not impossible, to enter my website. The problem was eventually traced back to a memory allocation error with the server. Apparently this was caused by a ‘server migration’, which the service provider informed me about some 2 days earlier. In other words, it was mainly a configuration issue.

After performing countless reinstalls of the WordPress package, I realized that installing the JetPack plugin caused the wp-admin login module to not load properly. I was not even able to access the dashboard; I got a blank white page instead. I noticed an anomaly with the stats bar above (in the WordPress toolbar at the top – you see this only when logged in as an admin) in that the stats were hardly showing and I suspected the problem was caused by the JetPack plugin was consuming too much memory. I proceeded to delete the module (the whole folder) in the wp-contents/plugins folder via the CPanel file manager and the problem was solved. Anyway, I’m back online and glad to be so.

 

 

Flickr for iOS

Marissa Mayer has made good her word on turning Yahoo! into a more mobile-centric company. After much speculation, the company has finally released the much-awaited (and long expected) mobile app for Flickr. Better late than never, right?

What seems to be a case of ‘too little too late’ is compounded by the fact that Flickr for mobile appears to be yet another ‘me too’ when it comes to filters, which isn’t really a bad thing. It is hard to blame Flickr for being yet another Instagram ‘clone’, but Flickr has got to be given credit for being a pioneer in social-media and photo-sharing.

One thing that I really like about Flickr for mobile is that the photos it has on display in its feed are not limited to those in my contacts.

As I am not going to, and I never intended to write a review of the app, I will just list down a couple of pros and cons, from the perspective of an end-user.

Pros:

  1. Easy-to-use yet familiar user interface. Instagram users will feel right at home.
  2. Ability to save directly from the camera roll, or from the camera is a big plus point.

Cons:

  1. The app is a bit prone to crashes.
  2. Lack of pre-caching; photos load only on view.
  3. Lack of sharing options. An option to share directly to WordPress and blogger would have been nice.

A Mood for Instagram

It’s been a while since I had posted something here. Sorry about that, but work was literally keeping me at the office for longer hours for the past

weeks. I did manage to take some Instagram shots during the quick visit to the mall on Friday. Here they are.

Dropbox for iOS – New and Improved

The new update to the iOS version of Dropbox could not have come at a better time. While it was possible to upload full resolution pictures to Dropbox, re-downloading them to another device was less than ideal as the image quality was anything but stellar. The reason I use Dropbox was due to the fact that it liberated my workflow from cables. Everything worked just fine, at least until you wanted to download an image to an iOS device.

The new update changed all that (yay!) and I am able to download high quality images across all my devices. That certainly saves me the trouble of linking up with my laptop via Photo Transfer App, which by itself is also a brilliant app.

AirAsia App

It goes without saying that if you are not paying serious to the mobile market, you are asking to be left in the dust trail, especially with the volatile nature of the mobile market landscape.

AirAsia recently released a more polished version if their app and I must say that it is absolutely gorgeous. Compared to its stinky predecessor, the new app, which was released first for iOS, sports a predominantly white theme, which is better on the eyes. Unfortunately I do not currently have any screenshots of the older version of this app for comparison, but I believe many of you have used it before.

The iOS version works very well on my phone but there have been some word on the ground about this app performing sluggishly on Android devices. If you have experienced issues with this app, do share your experience with us by writing in the comments section below.