Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Atlanta, Georgia, USA
    Posts
    272
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Use robocopy to switch file servers

    Hi all. I have a massive file copy I need to do as I'm moving data from fileserver1 to fileserver2. There's so much data, and it copies so slowly, that it will take possibly as long as 24 hours for the robocopy to complete. Also, there's no way to keep the users out of the files while the copy is going on.

    Because of this I was wondering how I could use robocopy to get the job done. If I use the /MIR switch I know it will create an exact copy of what's in fileserver1 and place it on fileserver2. Once that's done I'd like to run another robocopy that only copies files that have changed since the last copy. I'd like to think that would result in a copy that would go very quickly. The only problem is I don't know how to do that.

    Can robocopy do that? If so, how?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    3,610
    Thanks
    7
    Thanked 229 Times in 217 Posts
    Robocopy is the answer to server migration. It needs to be done in 3 steps. 1st you copy the data - this can take several days. 2nd you update the data - copy new files and fix issues, usually permissions. Run step 2 overnight several times until you have fixed all the errors and are ready to go. 3rd you do a final update and apply permissions to the new server. I've attached the migration batch file I have used used for years.

    cheers, Paul

    Code:
    @echo off
    rem *****************************************************************************
    rem Script Robocopies the File Server files to a new Location
    rem 
    rem author 	: Lee
    rem .
    rem Edit History	: PT, added /NDL /NFL /NP to turn off file logging
    rem                         and progress indicator.
    rem                       Choose the required form of copy.
    rem                         Use create first, then schedule Update.
    rem                         Copy Security last.
    rem                       PT, added time and date to log file name.
    rem                       PT 7/2005, Added step numbers. Modified Copy security command.
    rem .
    rem Log File 		: 
    rem .
    rem *****************************************************************************
    
    REM CHANGE THIS to a new folder ; make sure there is enough space on the destination server.
    
    setlocal
    set Orig_Server=F:\
    set Dest_server=\\<servername>\c$\<folder>\
    
    for /f "tokens=1,2 delims=: " %%x in ("%time%") do set EFtime=%%x%%y
    for /f "tokens=2-4 delims=/ " %%x in ("%date%") do set EFdate=%%z%%y%%x
    set errorfile=DataError%EFdate%%EFtime%.txt
    
    Rem Edit the file for whichever command you want to use. 
    Rem Use steps in order for efficient copying.
    
    
    Rem STEP 1 - RUN MANUALLY
    Rem Create file/directory structure only, do NOT copy security.
    Rem Prevents directory fragmentation and improves file system performance.
    Rem Verbose output.
    robocopy %Orig_Server% %Dest_server% /NDL /NFL /NP /S /E /COPY:DAT /CREATE /V /TEE /R:1 /W:1 /log+:%errorfile%
    
    
    Rem STEP 2 - SCHEDULE TO RUN NIGHTLY
    Rem Update, only copy files that are newer than the destination.
    Rem Delete files not in source.
    Rem Do NOT copy security.
    Rem Quiet, log summary and errors only.
    ::robocopy %Orig_Server% %Dest_server% /NDL /NFL /NP /MIR /COPY:DAT /TEE /R:1 /W:1 /log+:%errorfile%
    
    Rem STEP 3 - RUN MANUALLY AFTER THE LAST RUN OF STEP 2
    Rem Copy Security, ownership and auditing data only.
    Rem Quiet, log summary and errors only.
    ::robocopy %Orig_Server% %Dest_server% /NDL /NFL /NP /S /E /IS /COPY:SOU /TEE /R:1 /W:1 /log+:%errorfile%
    
    
    Rem ALTERNATE COMMAND - PERFORM ALL 3 STEPS AT ONCE
    
    Rem Copy all data including security, delete files not in source.
    Rem Verbose output.
    rem robocopy %Orig_Server% %Dest_server% /MIR /COPYALL /ETA /V /TEE /R:1 /W:1 /log:%errorfile%
    
    
    Rem errorlevel checking
    
    if errorlevel 16  echo ERROR: ***FATAL ERROR***  >>%errorfile% & goto end
    if errorlevel 15  echo ERROR: FAIL MISM XTRA COPY >>%errorfile% & goto end
    if errorlevel 14  echo ERROR: FAIL MISM XTRA      >>%errorfile% & goto end
    if errorlevel 13  echo ERROR: FAIL MISM      COPY >>%errorfile% & goto end
    if errorlevel 12  echo ERROR: FAIL MISM           >>%errorfile% & goto end
    if errorlevel 11  echo ERROR: FAIL      XTRA COPY >>%errorfile% & goto end
    if errorlevel 10  echo ERROR: FAIL      XTRA      >>%errorfile% & goto end
    if errorlevel  9  echo ERROR: FAIL           COPY >>%errorfile% & goto end
    if errorlevel  8  echo ERROR: FAIL                >>%errorfile% & goto end
    if errorlevel  7  echo ERROR:      MISM XTRA COPY >>%errorfile% & goto end
    if errorlevel  6  echo ERROR:      MISM XTRA      >>%errorfile% & goto end
    if errorlevel  5  echo ERROR:      MISM      COPY >>%errorfile% & goto end
    if errorlevel  4  echo ERROR:      MISM           >>%errorfile% & goto end
    if errorlevel  3  echo ERROR:           XTRA COPY >>%errorfile% & goto end
    if errorlevel  2  echo ERROR:           XTRA      >>%errorfile% & goto end
    if errorlevel  1  echo * SUCCESSFUL COPY * >>%errorfile% & goto end
    if errorlevel  0  echo Notice:    --no change, no data copied--    >>%errorfile% & goto end
    :end

  3. #3
    New Lounger
    Join Date
    Dec 2009
    Location
    Plano Texas
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post
    The last move I did I used Microsoft Sync. It will do either one-way or two-way sync.

    http://www.microsoft.com/en-us/downl....aspx?id=15155.

    It allowed me to keep the two servers in sync during the transition from one server to the other.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •