Link to home
Start Free TrialLog in
Avatar of Chip Levinson
Chip LevinsonFlag for United States of America

asked on

Robocopy messed up my file server - how do I restore?

Help!  What did I do to my file server?

Now that I got out my frustrations, let me explain.  A few months ago I manually copied all of the files from a W2K file server to a new 2003SBS file server.  By this I mean I copied them across the network via Explorer.  Everything worked great except that all of the folders had their dates updated to May 1 2008.  This was not good as my files/directories have been created over the past 10 years.  I thought I found the solution to this in Robocopy XP026 (see my other questions).  It had a attribute called /DCOPY T that copied the folder date attribute as well.  After getting some great help on this forum I came up with a command line that I thought would update the folder's date stamp without making any other changes.  I tested it out on a few small folders and it SEEMED to work.  

My servers have a couple of partitions (one is called G drive).  On these partitions I maybe have 20 or so first level folders, each with many sub folders.  Here is the robocopy command that I used that was initiated on my old file server where the G drive is simple D.

robocopy.exe D:\ "\\Theoracle2\G Drive" /DCOPY:T /E /ZB /r:2 /log+:c:\dirdatelog.txt

I tested this several times.  First I used a variation to copy of folder from my old server's d drive to my old server's c drive.  Everything copied perfectly, including the folder's date time stamp.  Then I copied another folder, lets call it "test" from the d drive to the c drive using Explorer.  The files copied OK, but as expected the date on the c drives folder was 7/17/08 as opposed to 4/1/2006.  I then ran a variation of the above robocopy for that one folder and I saw the folder's date time stamp was correctly changed from 7/17/08 to 4/1/06.  I thought I was OK so I used the above for my whole server.  Last night I checked many of the folders on the old and new after the change.  All of the folder dates seemed correct and the file count and file sizes matched.

This morning is when the ---- hit the fan.  I logged into my email which is a simple Outlook PST and all of my emails from the past few months were gone!  It seems that the robocopy did not just update the date time stamp.  It replaced the newer file with an older file.  After recovering from a mild heart attack I realized that I had a backup file from BackUp Exec that was 24 hours old.  I did my first restore in a real life crisis and it worked.  My email is now correct.  Now I wondered what I did to the rest of my file server.  I would say that 95% of the files on my file server were never edited or touched in the past 4 months.  For these I think I am OK with what I did.  I have created some new files recently and they seem to be OK too.  I think robocopy did not touch these because they were not on the old server.

But what about files that were edited/updated in the past three months?  Have all of them be reverted back in time?  How can I identify the ones that were messed up and restore them with my BackUp Exec backup file?  

Anyone who can help will not only get 500 points - but they will have my eternal thanks!.

As a minor aside, I suspect I was missing some simple command in robocopy.  Would this have worked as intended if I used either the /XC (eXclude Changed files), or /XN (eXclude Newer files) or /XO (eXclude Older files)
Avatar of oBdA

robocopy will by default copy everything from the source folder to the target folder that is different (time stamp or size).
You could simply have used "/xf *.*" which would have excluded all files (you only wanted to correct the folder time stamps). /xn doesn't make much sense when the source hasn't been touched in the meantime. /xc is rather rarely of importance, it indicates files with the same time stamp, but different file sizes. /xo would have helped.
You can identify which files were copied by looking at the log file you created. You didn't use /np, so there will be a lot of garbage characters in there, but basically every file in the log file which is indicated as "Older" will have to be restored.
The summary at the end will tell you how many files have been copied over and will have to be restored.
For the next time, use of the /L switch for testing, which will simulate a run (including creating a complete log file) without actually copying anything.
I don't quite understand - you say you copied the entire D:\ on the old server to the G:\ on the new server, right? Therefore, your pst file should be exactly the same file on the new server as it was on the old server.

Are you sure your Outlook was configured to look at the right pst file when you had this problem this morning? I assume you will have to point it to G:\somefiles\outook.pst

I can't see how this is a robocopy issue as you've simply configured it to copy all files and folders as they are (including empties) and retaining their timestamps.
Avatar of Chip Levinson


Thank you oBdA,

I wish I would have had you review my robocopy command BEFORE I ran it.  I am going to leave this open for a bit while I check my logs to see if I have any questions.  If not, I will consider this answered and will award you points.

Since you are such an expert on this, may I ask two more questions?

Q1: I plan to use Robocopy to create a mirror copy of my server on a RD1000 removable hard disk.  Since the disk will be clean, what is the best command line for me to use with all of the correct options and archive bits?

Q2. Then I want to set up a batch file I can run to update this backup.  It will act as an incremental backup, backing up any files that have changed since the last backup (in this case Q1, in future cases the batch file).  What would the command line be for that?

Please note I am running VSS on the file server, if that has any impact.  
Hi jonathen,

Thanks for looking into this so quickly.  You are right.  The problem is that my old server has been essentially offline for two months.  So the 2 month old PST on the old server was written over the current PST on the new.  It was an obvious difference because when I started email this morning I had no emails for the past 2 months and my PST mysteriously shrunk by 100K.

You are not kidding!  I looked at my log file and it has over 51,000 lines in it!  This is because it was set to show the percent progress.  Here is the summary at the end:

Total    Copied   Skipped  Mismatch    FAILED    Extras

Dirs :       821         0       821         0         0         5
Files :     10124      1218      8906         0         0        30
Bytes :   6.528 g   2.180 g   4.347 g         0         0  258.12 m
Times :   0:04:07   0:04:00                       0:00:00   0:00:07

Does this mean what I am afraid it means?  That I have 1,218 files that need to be restored?
Avatar of oBdA

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.  If I could I would have rated this answer an A++.  I am going to read through the answer in detail this weekend when I have some free time and work out a strategy for restoring the 1,000 files.

It took me 20 minutes, but I was able to strip out all of the % progress reports from the log file.  This collapsed my 51,000 lines down to about 6,000.  I know this question is closed, but would you mind helping me interpret the file?  In essence, I see the following types of entries:

Extra DIR
Extra File
New File

Which ones do I need to restore?  I know it may sound obvious, but I ran the original operation in batches and have a lot of stuff to go through.  I almost feel like restoring my entire server from the backup.  But I have never done that before and it makes me a bit nervous.

Thanks again for awesome help!

Here are a few lines from the log, if it helps:

      *EXTRA Dir        -1      \\NewServer\G Drive\Directory name\
        *EXTRA File                83856      filename
          New File                15.0 m      filename

          Older                     6144      Thumbs.db
                                    14      D:\0 Thumb Drive\BackUp Exec Screen Shots - Working\

The important ones are the ones tagged "Older"; these are the ones where files have been replaced with older versions.
"New" files are files that have been deleted since you copied the first time. These should be deleted, otherwise users might be surprised that deleted files are showing up again.
"Extra" are files and folders that are present in the target, but not in the source, that is, files/folders that have been created since the initial copy.
You might want to look for robocopy.doc (don't know where it is for the XP026 version, for the XP010 it was in the Resource Kit installation folder), which explains robocopy in detail.