Jump to content

Simplest Way to Keep a Running Mirror of User Folder?


Elliot77

Recommended Posts


Are you looking for instant backup, or would you be willing to settle for a backup done every so often (it could be hourly or less)?

 

And do you want a true mirror, or do you want an ever-accumulating backup, which would give you protection against deleted files?

 

You need to define your goals completely first, and keep in mind you can have multiple overlapping backup strategies.

 

If it's just a simple mirroring of files in folders you want, ROBOCOPY - supplied with the OS - is a pretty good tool.  It gets a bit geeky to get all the switches just right, but when you do it is kind of a set it and forget it solution.

 

As an example, just one facet of my backup strategy is to schedule a job to run periodically that executes a batch file containing commands like this:

 

ROBOCOPY  C:\SVN  D:\Backup\NoelC4\SVN  /MIR /B /DST /Z /NP /NDL /R:1 /W:2

 

The important aspects of this command are (this is from memory, so I apologize if I paraphrase a bit):

 

  • It's scheduled via Task Scheduler.  Whenever it runs, the C:\SVN folder is backed up to D:\Backup\NoelC4\SVN.
     
  • /MIR means that files that the whole subfolder structure under C:\SVN is copied, maintaining the same structure in the backup copy.
     
  • /MIR also means that files found to be deleted from C:\SVN should be automatically deleted from the backup area (a true mirror).  By contrast, if you wanted an ever-accumulating backup (which you would have to look over manually from time to time so it would not just accumulate data until the media filled up), you could use the /E switch, which would traverse subdirectories but not purge files found deleted in the source.
     
  • /B uses "backup mode", which is a mode of copying that's less likely to fail if a file is in use.
     
  • /DST allows there to be a one hour difference in the file modification time, which means that you shouldn't end up with a mess at the time when daylight savings time starts or stops.
     
  • /Z says to copy files in restartable mode, which is more robust if copying across a link that can fail (such as a network connection) - but this probably isn't particularly necessary if you're copying to a local drive.
     
  • /NP instructs ROBOCOPY not to display progress indicators for each file copy operation.  This makes sense if the program is running unattended and redirecting output to a log file.
     
  • /NDL says don't list directory names separately.  It just keeps the log a little more tidy.
     
  • /R:1 says if there's a failure, retry one more time.
     
  • /W:2 says if there's a failure, wait 2 seconds before retrying.

 

As a broader answer, my overall backup strategy on my main workstation is this:

  1. I run it 24/7 and schedule Windows System Image backups every night to an external MyBook USB drive dedicated to the task.  These images could be used to recover from a catastrophic failure onto bare metal.  The wbadmin command I use specifies -vssFull on the command line, so it is integrated with the Volume Snapshot Service.  This means that once the first image is stored, subsequent backups are incremental and the drive can accumulate a number of backups.  In practical terms, this means that if I had to restore the system image I would have choices of which day to restore, going back as many days as the drive holds.  At the moment I have backups on the drive that go back to January 6th, 2015.
     
  2. I have two internal and two external backup drives.  For maximum protection, I schedule a number of batch files that issue ROBOCOPY commands similar to those I listed above that mirror or accumulate various important folders.  For example, I back up my eMail folders to a mirrored G: and an accumulating H: folder, I back up my SVN data to D:, E:, G:, and H:, I back up my photo library to G: and H:, etc.
     
  3. Occasionally I unplug drive H: (my largest set of accumulated file backups), move it to a separate location and put in an alternate H: drive.  This helps protect against loss by a problem at or near the computer.

 

Setting up sufficient and effective backup is important.  Bravo to you for thinking about it.  Take the time to mull over what would happen if you had a failure, or if you accidentally did something boneheaded (like deleting all your files - we all make mistakes), or if you had malware corrupt or destroy your files.  In short, decide what you want to protect yourself from, and think through how to accomplish it.

 

One parting thought:  Most folks not working in a professional environment don't actually test their backups.  If you really, really want to be sure what you're doing is viable, force a situation where you have to test it.  A very good exercise, that minimizes your risk, could be to buy a new (e.g., larger/faster) hard drive, remove your old drive and put it somewhere safe, and see if you can restore all your system and data.  When you're done you have both a backup drive you could conceivably pop back into the system, and you've verified you can recover to bare metal.

 

Good luck.

 

-Noel

 

 

 

 

Edit:  I forgot one switch...

 

If you use ROBOCOPY to copy your Users area, it can be handy to exclude junctions - links you or the system have created that cause certain folders to point to other folders on the hard drive.  For some of my ROBOCOPY commands I include the "exclude junctions" switch:  /XJ

 

On a CMD line, type HELP ROBOCOPY for a complete list of the options.

Edited by NoelC
Link to comment
Share on other sites

DSYNCHRONIZE and ROBOCOPY seem like two excellent options - thank you both.

Noel,

It's cool to see your backup plan. My home PC has an SSD (with small user folder) and HDD (with extensive media files). I've been relying on FreeFileSync to manually back up the User folder to the HDD, and back up the entire HDD to an external drive, and certain files (music and system images) to yet a 3rd location. I've also been using Clonezilla a few times per year and keeping a catalog of system images along with a log of the changes in each one.

I'll most likely begin using DSYNCHRONIZE or ROBOCOPY to keep real-time backups of work-in-progress files in case something should get corrupted.

Edited by Elliot77
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...