[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1147
  • Last Modified:

Speeding up Robocopy

I am using robocopy to run some backups to a couple of NAS devices.

I switched to that after about 1 million people on here told me to make the change from xcopy.

This process takes FOREVER now. I am running it on Server 2003, so as far as I know it can't multi-thread.

How do you speed up Robocopy?
0
Sleestack90
Asked:
Sleestack90
  • 7
  • 3
  • 2
1 Solution
 
willettmeisterCommented:
what switches are you using to make the copy.  My intial thought is to cut down the number of retires and the wait time between retries.
0
 
Sleestack90Author Commented:
I have attached the script, have a look.
@echo off
REM Get the date for log files
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
    Set Month=%%A
    Set Day=%%B
    Set Year=%%C
)
set year=%Year:~2%
@echo FILESERVER DATA backup process for %Month%/%Day%/%Year%.

set LogFile="G:\FILESERVER_Backup_Logs\%Month%%Day%%Year%_NAS01_FILESERVER_DATA.log"
@echo Please wait: DATA backup to NAS01 in PROGRESS!
@echo Copying DATA to NAS02 and logging to \\FILESERVER\FILESERVER_Backup_Logs\
robocopy d:\data \\NAS01\DATA /zb /mir /NP /NDL /NFL /r:1 /w:1 /log:%LogFile%


if errorlevel 16 set result="***FATAL ERROR***" & goto nas01
if errorlevel 15 set result="OKCOPY + FAIL + MISMATCHES + XTRA" & goto nas01
if errorlevel 14 set result="FAIL + MISMATCHES + XTRA" & goto nas01
if errorlevel 13 set result="OKCOPY + FAIL + MISMATCHES" & goto nas01
if errorlevel 12 set result="FAIL + MISMATCHES" & goto nas01
if errorlevel 11 set result="OKCOPY + FAIL + XTRA" & goto nas01
if errorlevel 10 set result="FAIL + XTRA" & goto nas01
if errorlevel 9 set result="OKCOPY + FAIL" & goto nas01
if errorlevel 8 set result="FAIL" & goto nas01
if errorlevel 7 set result="OKCOPY + MISMATCHES + XTRA" & goto nas01
if errorlevel 6 set result="MISMATCHES + XTRA" & goto nas01
if errorlevel 5 set result="OKCOPY + MISMATCHES" & goto nas01
if errorlevel 4 set result="MISMATCHES" & goto nas01
if errorlevel 3 set result="OKCOPY + XTRA" & goto nas01
if errorlevel 2 set result="XTRA" & goto nas01
if errorlevel 1 set result="OKCOPY" & goto nas01
if errorlevel 0 set result="--no change--" & goto nas01
:nas01

blat -t DOMAIN-InformationServices@DOMAIN.com -f Backup6@DOMAIN.com  -s "FILESERVER DATA Backup to NAS01 finished with a result of %result%" -server EXCHANGE -body "FILESERVER DATA Backup to NAS01 completed with a result of %result%. Logs are available at \\FILESERVER\FILESERVER_Backup_Logs"

@echo DATA backup to NAS01 complete!

set LogFile="G:\FILESERVER_Backup_Logs\%Month%%Day%%Year%_NAS02_FILESERVER_DATA.log"
@echo Please wait: DATA backup to NAS02 in PROGRESS!
@echo Copying DATA to NAS02 and logging to \\FILESERVER\FILESERVER_Backup_Logs\
robocopy d:\data \\NAS02\DATA /zb /mir /NP /NDL /NFL /r:1 /w:1 /log:%LogFile%

if errorlevel 16 set result="***FATAL ERROR***" & goto nas02
if errorlevel 15 set result="OKCOPY + FAIL + MISMATCHES + XTRA" & goto nas02
if errorlevel 14 set result="FAIL + MISMATCHES + XTRA" & goto nas02
if errorlevel 13 set result="OKCOPY + FAIL + MISMATCHES" & goto nas02
if errorlevel 12 set result="FAIL + MISMATCHES" & goto nas02
if errorlevel 11 set result="OKCOPY + FAIL + XTRA" & goto nas02
if errorlevel 10 set result="FAIL + XTRA" & goto nas02
if errorlevel 9 set result="OKCOPY + FAIL" & goto nas02
if errorlevel 8 set result="FAIL" & goto nas02
if errorlevel 7 set result="OKCOPY + MISMATCHES + XTRA" & goto nas02
if errorlevel 6 set result="MISMATCHES + XTRA" & goto nas02
if errorlevel 5 set result="OKCOPY + MISMATCHES" & goto nas02
if errorlevel 4 set result="MISMATCHES" & goto nas02
if errorlevel 3 set result="OKCOPY + XTRA" & goto nas02
if errorlevel 2 set result="XTRA" & goto nas02
if errorlevel 1 set result="OKCOPY" & goto nas02
if errorlevel 0 set result="--no change--" & goto nas02
:nas02

blat -t DOMAIN-InformationServices@DOMAIN.com -f Backup7@DOMAIN.com  -s "FILESERVER DATA Backup to NAS02 finished with a result of %result%" -server EXCHANGE -body "FILESERVER DATA Backup to NAS02 completed with a result of %result%. Logs are available at \\FILESERVER\FILESERVER_Backup_Logs"


@echo DATA backup to NAS02 complete!

Open in new window

0
 
willettmeisterCommented:
Your script looks pretty good.  The only things that I can say is that my version of robocopy does support mutlithreading using the /mt switch.  
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Sleestack90Author Commented:
willettmeister: you must be running it on Windows Vista, Windows 7, or Windows Server 2008 then?

If not, I would REALLY like to know what version you are running, cause if there is one that supports multi -threading for Server 2003 .... that would solve me problem for sure.
0
 
willettmeisterCommented:
yep you are right.  It looks like the 2003 is not multi-threaded but the version I have is.  sorry
0
 
Sleestack90Author Commented:
no worries. I am wondering if it makes sense to break the backup up into multiple parts running at the same time.....

like folder that start with A-G, H-N, O-T, U-Z.....

This should cut the time by 1/4....or at least i'd think it would.
0
 
SysExpertCommented:
Any errors in the log file ?
0
 
Sleestack90Author Commented:
SysExpert:Yes and no....there are some errors, but these are related to files being open or standard stuff like that.

The problem is that there is ALOT of data to transfer.....
0
 
SysExpertCommented:
the /mir options will take a while to do the first time, especially if retry/ resync options are on.

But once it is done, after that it should run quickly since the data changes should be relatively minor, unless you have huge files that change often.

0
 
Sleestack90Author Commented:
SysExpert: understood i will give it time
0
 
Sleestack90Author Commented:
So ok.

New direction. I broke up each copy of each directory into seperate jobs, examples:

NAS01\USER = Job 1
NAS02\USER = Job 2

NAS01\DATA = Job 3
NAS02\DATA = Job 4

Each job looks very similar to the attached code snipet.

The problem now is....i can't tell is Robocopy is hanging or what...cause it gets through alot of the job, but it doesn't send the email like it's susposed to...and it never quite closes out....

Suggestions?
@echo off
REM Get the date for log files
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
    Set Month=%%A
    Set Day=%%B
    Set Year=%%C
)
set year=%Year:~2%
@echo FILESERVER DATA backup process for %Month%/%Day%/%Year%.

set LogFile="G:\FILESERVER_Backup_Logs\%Month%%Day%%Year%_NAS01_FILESERVER_DATA.log"
@echo Please wait: DATA backup to NAS01 in PROGRESS!
@echo Copying DATA to NAS02 and logging to \\FILESERVER\FILESERVER_Backup_Logs\
robocopy d:\data \\NAS01\DATA /zb /mir /NP /NDL /NFL /r:1 /w:1 /log:%LogFile%


blat -t DOMAIN-InformationServices@DOMAIN.com -f Backup6@DOMAIN.com  -s "FILESERVER DATA Backup to NAS01 finished with a error level of %errorlevel%" -server EXCHANGE -body "FILESERVER DATA Backup to NAS01 completed with a error level of %errorlevel%. Logs are available at \\FILESERVER\FILESERVER_Backup_Logs"

@echo DATA backup to NAS01 complete!

Open in new window

0
 
Sleestack90Author Commented:
well ok, one of these jobs sent an email...so maybe the jobs are hanging.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 7
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now