Computer Backup With Robocopy

There are lots of backup solutions out there but a lot of them seem to be overly complicated to me. A lot of the software we have now days seems to be overly complicated but that is a rant for another time. That is why I started using a simple robocopy script to do most of the work when I am backing up data on Windows.

Backup Hard Drives With Robocopy

I have always been a little obsessive when it comes to backups but I have never lost data I could not get back. So I guess that means I am lucky or I am doing something right.

Organized Your Files To Make Backups Simpler

The first step is to make sure your files are well organized and not scattered all over your computer. Otherwise, it is easy to miss things and you end up not having them backed up.

For example, I try to save everything in my documents folder other than pictures and music. This way I can just back up the documents folder and know I have almost everything.

Ones your files are organized into just a few locations then you only have a few places to backup. It makes things much easier to work with.

My Robocopy Backup Routine

I have a simple backup script on my desktop. When used it starts to robocopy everything on my Desktop to a network share. It also copies everything in Documents, Music, and Pictures. I even add game save locations of the current game I am playing if it is not already in the documents folder.

This script currently copys my files to a network share. I have a script on all my computers copying to their own folder on the network share.

The reason I do it this way goes back to organizing your data to make it easier to backup. You see just leaving a copy on a share is better than nothing. But I have had shares and servers die so I take it a few steps further.

I have another script that robocopys the whole backup share to a 2TB hard drive I have. In fact I have a few big hard drives laying around so I kind of rotate them.

Then the last step to my robocopy backup routine is to take one of the hard drives to my parents house when I go to visit. That way if god forbid my house ever burned down I would still have my file safely at another location.

Making Your Own Robocopy Backup Script

Ok so now that you know my process lets show you how to make your own script.

Robocopy is very easy to use. You just have to open up a command prompt and type the command or save the commands to a .bat file to be clicked later.

If you open a command prompt and type robocopy it will give you some info on how to use it.

Robocopy usage

And here is an example of copying my documents folder to my network share.

robocopy "C:\Users\Zack\Documents" "\\10.16.20.5\nas\Backups\Zack\Computer Backup\Documents" /MIR

And here is how you could backup to an extra hard drive.

robocopy "C:\Users\Zack\Documents" "D:\Backup\Documents" /MIR

Robocopy Options

There are also lots of other options other than /MIR that mirrors the source folder. But I have not really had much need for them.

I have used “/XJD” and “/XJF” to keep my backup clean by ignoring junction points in the file system. But now days I do not think this is a big deal. I still have it on my saved scripts but I don’t use it when typing a command in.

The other one I have used is to limit the retry attemps. /r:<N> Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).

If a file is being used you may want your script to move on instead of waiting forever.

Things to watch out for

Always double check the command before you hit enter. If you reversed the source and destination then all the files you want to backup could be deleted.

I have also noticed some file system issues creeping in on my big hard drives. Maybe because my backup is so big, the disk was getting full, or NTFS is not very good. I am not sure at this point.

Whatever the case I decided to add a check disk command to my script to catch any problems before they get bad.

CHKDSK D: /F /V

One more thing to watch out for is there is no file versioning when backing up files with robocopy. This is why I like to rotate my backup drives.

My Backup Script

Here is the script on my desktop to backup to my network share. REM stand for remark and is just a way to comment your code.

robocopy "C:\Users\Zack\Desktop" "\\10.16.20.5\nas\Backups\Zack\Computer Backup\Desktop" /MIR /XJD /XJF
robocopy "C:\Users\Zack\Documents" "\\10.16.20.5\nas\Backups\Zack\Computer Backup\Documents" /MIR /XJD /XJF
robocopy "C:\Users\Zack\Music" "\\10.16.20.5\nas\Backups\Zack\Computer Backup\Music" /MIR /XJD /XJF
robocopy "C:\Users\Zack\Pictures" "\\10.16.20.5\nas\Backups\Zack\Computer Backup\Pictures" /MIR /XJD /XJF

REM Game Backups
robocopy "C:\Games\Steam\steamapps\common" "\\10.16.20.5\nas\Backups\Zack\Computer Backup\Steam" /MIR /XJD /XJF

REM SVN Server
robocopy "\\10.16.20.4\svn" "\\10.16.20.5\nas\Backups\Zack\SVN Server" /MIR /XJD /XJF

REM Game Saves
robocopy "C:\Games\VtMB\Unofficial_Patch\save" "\\10.16.20.5\nas\Backups\VtMB Saves" /MIR /XJD /XJF
pause

And here is the script to backup the network share to a hard drive.

CHKDSK D: /F /V

robocopy "\\10.16.20.5\nas" "D:\NAS Backup" /MIR /XJD /XJF

pause

Cloud Backup

I will still recommend a cloud backup as a final line of defense. There is always a chance that a major disaster will destroy your house and backups.

You could put the cloud backup software on the computer hosting the network share. Or if one of your backup hard drives is in your computer then the cloud backup software could run on your computer.

Then you still have the benefits of a cloud backup for all your devices. But you only have to install and manage the software on 1 computer. Then use the simple robocopy scripts to do everything else!

I personally use robocopy and iDrive to backup my most precious data. Things like family pictures that can never be replaced. But I just use my robocopy scripts to back up the other big data.

Would you kindly share this post?

Leave a Reply

Your email address will not be published. Required fields are marked *