Feeds:
Posts
Comments

Posts Tagged ‘backup’

In part 1, I covered how to use robocopy, which is part of Windows Vista. Now we’ll use that knowledge to create a scheduled task and have regular backups.

Using Vista, you’ll want to run Task Scheduler (try pressing the windows key and typing this in, it should appear pretty swiftly). You’ll probably need to press continue to get past the UAC prompt. The Task Scheduler screen is very busy and has a lot of options. For our purpose, try looking on the right for an item called Create Basic Task. If you can’t find it there, it should be under the action menu.

This will launch the Create Basic Task Wizard, now give this a name (Backup is ok) and click Next.

This goes to the Trigger screen, which dictates how often the backup will be done. Take your pick, but I’ll go for Daily. You’ll then be asked about the exact time you want it to run and for this backup it doesn’t matter too much for most people, unless you know you’ll be doing something really important every day and you don’t want it disturbed. I’ll pick 9:00:00 am every 1 days and click Next.

Now we’re at the Action screen and we want to start a program, so click Next. Here’s the important part, you need to select the program to run, which is robocopy, you can either just type robocopy or click browse and find C:\Windows\System32\robocopy.exe. Now you need to enter the parameters into the Add arguments (optional) box. These will be whatever you’ve decided based on Part 1, in my case “C:\Users\MyUser\Pictures” “G:\MyBackup\Pictures” /MIR /XJD /R:5 /W:15

Click Next and then Finish and it’s all setup.

Now if you want to see if it will all work, you should be able to see you backup task, right-click it and choose Run. You should have a command prompt window appear, unless you disabled that in your robocopy command. You’ll also be able to see the Last Run Result, which will be the exit code robocopy gives. Generally you should get 0,1,2 or 3 (0x0, 0x1, 0x2, 0x3), but consult Robocopy exit codes if you’re not sure. At times I’ve gotten 16 (0x10) when my external drive hasn’t been connected too.

Happy backing up and don’t forget to check your backup is what you expect! Comments and suggestions welcome.

Read Full Post »

Backing up your important files is a smart thing to do. However, Windows Vista does not provide a simple way to backup specific folders or files built into the OS. There are number of third party tools that will do a decent job, including Microsoft’s Sync Toy, but I’ll focus on robocopy.

Robocopy has been around for some time, but is built into Vista. It is essentially a file copying program, but that’s all a backup is right? (Well, it is for our purposes). Robocopy is a command line utility, so you’ll need to be somewhat familiar with using the command line. Robocopy also has a lot of options, so we’ll stick to some important ones.

If you run a command prompt and type robocopy /? you’ll get a long list of the options, in fact there’s a document that details them all. Essentially you need to specify the source folder (what you want to backup), the destination folder (preferably a folder on an external drive) and any specific options.

So, a basic robocopy command looks like: robocopy “C:\Users\MyUser\Pictures” “G:\MyBackup\Pictures” and while this specifies the source and destination, it doesn’t specify an options, so it won’t do very much.

For this backup, I’d like to copy all folders inside Pictures, so I want to add /MIR, this option makes sure the backup ‘mirrors’ the source, so if I delete a picture from my source later on, it will delete it from the backup.

Vista also uses a concept of ‘junction points’, which you can basically ignore, but just so that our backup definitely also does, I’ll add /XJD to the command.

One last thing robocopy does is wait and try again if it can’t do what it’s supposed to (why it’s called Robust File Copy). By default, it will wait a long time (30 seconds) and try a lot of times (1 million) if something’s up. 30 million seconds is a bit too long for me to wait for a backup if something’s up. So, let’s change these to /R:5 /W:15 to retry 5 times and wait 15 seconds in between.

Putting all of this together, we can now run robocopy “C:\Users\MyUser\Pictures” “G:\MyBackup\Pictures” /MIR /XJD /R:5 /W:15 and it will backup my Pictures folder. Of course I’d check the backup is what you expect. If it’s not, check the folders you specified are right and of course you could check the exit code for some more information.

Next, I’ll look at how you can automate this backup so you don’t need to run it constantly

Read Full Post »

Robocopy exit codes

Robocopy is a great tool for copying files and is built into Vista. As a reference here is some information on the exit codes (not error codes – they provide information about what the program did), from http://kerpau.net/robocopy-exit-codes/

 

The return code from Robocopy is a bit map, defined as follows:

Hex Bit Value Decimal Value Meaning If Set

0×10 16 Serious error. Robocopy did not copy any files. This is either a usage error or an error due to insufficient access privileges on the source or destination directories.

0×08 8 Some files or directories could not be copied (copy errors occurred and the retry limit was exceeded). Check these errors further.

0×04 4 Some Mismatched files or directories were detected. Examine the output log. Housekeeping is probably necessary.

0×02 2 Some Extra files or directories were detected. Examine the output log. Some housekeeping may be needed.

0×01 1 One or more files were copied successfully (that is, new files have arrived).

0×00 0 No errors occurred, and no copying was done. The source and destination directory trees are completely synchronized.

You might get a code not listed here, like 3. If this is the case, all of the codes that add up to the value you received happened. Exit code 3 indicates that files were copied and that extra directories were detected. This might happen if you’re backing up a folder. I’ll talk about using robocopy for vista backups next time.

Read Full Post »