Automated Backups with Windows and Ubuntu, Part 1

To me, one of the most important things is keeping consistent backups of all of my data. Years ago, it was easy enough to keep data backed up on a couple of floppy disks. After that, data began spanning a couple of Iomega Zip disks. Once CD burners became popular, I ended up burning my files to a couple of CD’s each month. In the past few years, it’s become necessary to keep information stored on a separate hard drive just in case another one fails.

For a few months, I was using DriveImage XML to keep weekly snapshots of my important data. It worked fine; however, I began to notice that the level of file fragmentation on my hard drive following a snapshot was ridiculously high. Over the past couple of weeks, I’ve been investigating a couple of different reliable backup solutions. The most important thing to me is to be able to keep frequent - as in weekly - snapshots of my data, have it stored in a location that is easily accessible, and have a low risk of having the storage medium fail.

At first, I heavily considered using Amazon S3 . It would allow me to store my data in the cloud in a very secure, very reliable medium. I’m still considering using it at some point, but I’ve opted for a slightly simpler solution. Although it’s not quite as attractive as S3, it’s cheaper and, for now, that was the ultimate selling point. Before going into the details of how I automate my backups, it’s worth noting my setup.

My System Setup

I’ve got two computers - one running Windows XP and another running Ubuntu Linux. The XP machine contains two hard drives. One drive contains the operating system and all of the program files, and the other drive contains all of the data that I deem worth backing up. My Linux box acts as a local web server and local file server. It currently serves as a place on which to test various web development projects, and also a place to host other various files.

The primary reason that my files reside on my Windows machine is because I use that box for most of my projects. Considering the majority of the stuff that I do is oriented in web development, and, as much as I love Linux, the majority of people that use the web are still using Internet Explorer, Windows is a larger target for web development. This can be debated, but that’s another post so I digress. Anyway, to that end, I need to have fast access to some of my files while working on things.

How I Backup My Data

Introducing SyncToy

Since Windows 95, Microsoft has released free, small utilities for its operating system known as PowerToys . While investigating alternative backup solutions, I came across one called SyncToy . It’s an extremely easy-to-use, utterly simplistic PowerToy. At first, I was really skeptical as to if something this simple would serve as a solid backup solution. Because it would take next to no time to download and install it, I gave it a try. Surprisingly enough, I’ve been really pleased. In fact, I’ve ended up using SyncToy to automate my backups for the past couple of weeks.

The thing about SyncToy is that it serves one purpose and fully recognizes what it is. It doesn’t try to do more than it should, or attempt to present itself as the end-all-be-all of backup software. I like it because it knows its place, so to speak. With that said, SyncToy offers several options for backing up your data. These options include…

  • Synchronization. This option will take the newest files from either drive and copy them to the drive that has an older or non-existent version. It will also make sure that each drive as the most updated filenames, and no drive has files that the other does not. This option is useful if you frequently save data to more than one drive.
  • Echo. This option will take all files from a source drive and copy them to the destination drive. If a file has been renamed or deleted on the source drive, this change will be reflected on the destination drive.
  • Subscribe. This option will take files that have been updated on the “right drive” (typically the destination drive) and copy them over to the “left drive” (typically the source drive).
  • Contribute. Contribute is similar to subscribe; however, the drive from which operations are performed is reversed. Files that are new and/or updated on the “left drive” (again, typically the source drive) are copied to the “right drive” (which is usually the destination drive). No files are deleted in Contribute mode.
  • Combine. This operation will combine new and updated files from either drive much like synchronization mode; however, no renamed files or deleted files will be handles.

For my purposes, Echo works the best. I keep all of my data on an internal drive and want that data replicated to two locations - more on this in a bit.

Automating Backups with SyncToy

Of course, backups should be automated - no one wants to initiate a backup of their data while they are at their computer because it’s inconvenient. Operations like this not only take time, but it’s usually lame to be working on a system while it’s busy performing a bunch of file operations. Luckily, SyncToy can be run via the command-line and, thus, can be setup as a scheduled task in Windows to run automatically.

For those of you that are interested, setting up SyncToy to perform automatic backups it easy. Assuming that you’ve already setup your folder pairs (or your source drive and destination drive within SyncToy). here’s how to schedule an automatic backup…

  1. Launch the Scheduled Tasks applet from the Start | Programs | Accessories | System Tools menu and double-click on the Add Scheduled Task icon. This will launch the Scheduled Task Wizard.
  2. When you’re asked to select the application for Windows to run, click Browse.. and find the SyncToy executable on your hard drive. Mine is located in C:\Program Files\SyncToy\SyncToy.exe .
  3. On the next screen, select how often you want the task to run. I have mine set to Weekly .
  4. Next, you’ll be asked to pick details about the task. Select a time, how many weeks, and the day(s) during which you want your backups to occur.
  5. Enter in your Windows username and password to complete the scheduled task.
  6. On the final screen, check the option that reads Open advanced properties for this task when I click Finish and then click Finish .
  7. In the Run field of the advanced properties, you’ll need to make a modification. Make sure that it contains this (including the quotation marks): “C:\Program Files\SyncToy\SyncToy.exe” -R . The -R parameter instructs SyncToy to backup all folder pairs as you’ve configured them.
  8. Click OK and confirm your Windows username and password.
  9. Click Apply and then OK . You’re done.

Based on the scheduled settings that you’ve specified and assuming that you leave your machine running all of the time, SyncToy will now regularly backup your data based on the folder pairs that you’ve configured within the application.

Backing up in multiple locations?

As previously mentioned, I actually have SyncToy backing up to two locations - since I’m not going to have the security of data redundancy that a larger service can provide, I decided it best to perform a scheduled backup to two separate locations rather than just a single drive. Call me paranoid of losing my data.

One of the automated backups goes to an external hard drive that I have connected to my machine. This allows me to keep one copy of my files that I can take with me if I ever need to do so. The other backup is sent to my Linux file server via a network drive. This network drive matched with SyncToy’s automated backups provides a really easy way to keep your files on a secondary Linux machine while simultaneously having access to some of those files should you ever need them on your local Linux installation.

In a follow-up post, I’ll explain how to map a network drive from a location on your Linux file server to your Windows machine and schedule your backups to that location. Of course, I’m always on the look out for other ways to reliably, securely, and inexpensively backup my data. If you’ve got one or have any suggestions for using SyncToy, feel free to recommend them.


 
 
 

2 Responses to “Automated Backups with Windows and Ubuntu, Part 1”

  1. Automated Backups with Windows and Ubuntu, Part 2 | Tom McFarlin
    7. June 2008 at 22:54

    [...] Select the synchronization configuration option as mentioned in Part 1. [...]

  2. How To: Setup a cloud-based development environment | Tom McFarlin
    7. November 2008 at 09:18

    [...] all other files are contained on a second internal drive. This storage drive is the drive on which I perform weekly back ups. Additionally, this drive was subject to the organizational modifications necessary for sharing my [...]

Leave a Reply