Avatar of WORKS2011
WORKS2011Flag for United States of America asked on

robocopy copy files from one server to another...?

I have a 2003 server and would like to copy data, over 800G to a new 2012 server. Question, my experience with Robocopy is it works better local drive to local drive, with this understanding can I use it to copy data from server to server?

Question #2 are these the correct commands to copy data with permissions?

 Robocopy "D:\data1" "E:\data1" /E /SEC
 
/e: Copies subdirectories includes any empty directories.
 
/sec: Copies files with security.
Windows Server 2012Windows Server 2003

Avatar of undefined
Last Comment
WORKS2011

8/22/2022 - Mon
David Johnson, CD

Local is faster than over the network for sure. And yes those are the correct commands. I would use /ZB as well to use backup mode (vss) for files that the user I am logged in as may not have permissions.
ASKER CERTIFIED SOLUTION
oBdA

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Mohammed Khawaja

Also lower the retry time and attempts to lower number, put in the parameter to continue if error is generated and to log the results to a text file.  (I am working off a tablet and don't have access to robocopy to provide you the syntax but if you need it, let me know and I will fire up the good old laptop)
ASKER
WORKS2011

quick question can I do this while the server is in production or do I have to take it off the network and join the two servers together through a separate switch? I believe there's a command that allows to copy while in production...note it being the weekend there's not allot going on with this particular server.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
oBdA

You can just start it whenever; any files open will be logged as errors, but most of them should copy fine. Then you can just copy over the rest in a second run.
While in production, you might want to leave out the /mt switch, and if it slows down your network still too much, stop the copy with Ctrl-C and try the /ipg: switch (a formula to start with is at http://en.wikipedia.org/wiki/Robocopy).
ASKER
WORKS2011

@oBda \\W2k3Server\SomeShare" "D:\SomeSharedFolder"....concerned with this part, I don't have a folder to copy data into I'd like to copy to the root on the new server. There aren't any folders yet.
oBdA

Personally, I'd create a root folder "Data" or whatever and put all the user/department files in tis folder. Otherwise, just D:\ (no quotes).
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
WORKS2011

I know, agree but there is several apps that run with the data so changing anything does more harm than good.

For some reason it's saying robocopy does not exist or is not a valid command.
oBdA

If you're running that on the W2k3 server, that's normal; robocoopy was part of the Resource Kit Tools (http://www.microsoft.com/en-us/download/details.aspx?id=17657); this version will not support /mt.
On the W2k12 server, it should be in "C:\Windows\system32", which should be in the "Path" environment variable.
ASKER
WORKS2011

the word "purge" scares me, it's thinking with a curser right now but I don't see any data showing up in the destination.

did I mention the word purge scares me
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER
WORKS2011

This is all that happens for the last hour in the log and in the DOS prompt.

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows     ::     Version XP010
-------------------------------------------------------------------------------  

Started : Sat Sep 07 15:14:55 2013

   Source : \\server123\D$\
     Dest : R:\E$\

    Files : *.*
          
  Options : *.* /NDL /NFL /TEE /S /E /COPYALL /PURGE /MIR /NP /R:1 /W:1

------------------------------------------------------------------------------
oBdA

There should be data showing up in R:\E$.
You don't see anything because of the /nfl and /ndl. If you want to have the complete output, remove these. Since you've chosen to not write to a log file anyway, it doesn't really matter.
"/Purge" is coming from the /mir; robocopy "translates" /mir into "/purge /e". It just means that it will delete existing files in the target that are not in the source. If you're starting with an empty target folder, then it will delete nothing.
ASKER
WORKS2011

thanks now I can see all the files moving problem now is everything is copying to a folder named E$ on the target, it's hidden in this folder which I can get too if I choose to see hidden files but some workstations won't as well I prefer to have it copy to the E drive on the target which is not shared without the $ sign. In other words I need to get the data not to show up in the folder E$ on the target.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
oBdA

The hidden attribute is an error in robocopy that seems to happen when copying into or from a drive root. Never had it happen when copying from a folder to a folder.
Anyway, to correct it on the current folder, you can use
attrib -s -h R:\E$ /s /d
assuming that there are no real system files in this folder.
You can add /A-:SH to your robocopy command line to prevent this from happening on further copies.
Another possibility is to make a batch file with several robocopy commands, one for each folder in the root that you want to copy, then that attribute issue shouldn't happen.
And robocopy copies into the target folder you specify; it will create this folder if it didn't exist before the copy. So what is this "R:"? Is this a mapped drive on yet another machine? If so, then you just need R:\ (don't use quotes for this) as target folder.
If there is already other data on the root of the target drive, you can't do a root to root "mirror" (because the target drive will look exactly like the source drive after the copy, with the former contents gone), so you'd have to revert to the batch script above with one copy command per folder in the drive root you want copied. That's why it's useful to keep all the user files inside one dedicated folder instead of the drive root.
ASKER
WORKS2011

THANK YOU for all your help, do you mind helping letting me know where it would go in this

C:\Program Files\Windows Resource Kits\Tools>robocopy \\server123\D$ R:\E$ *.* /mir /copy:DATSOU /r:1 /w:1 /tee /np /log:"robocopy_20130908.log"
oBdA

The attribute removal? Options for robocopy can go pretty much anywhere after the first three arguments (source, target, filemask):
robocopy.exe \\server123\D$ R:\E$ *.* /mir /copy:DATSOU /a-:SH /r:1 /w:1 /tee /np /log:"robocopy_20130908.log"

Open in new window

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
WORKS2011

It's still copying data in the E$ folder, any other ideas?
oBdA

As I said before: if you want to copy directly to the root, specify the root as target folder (and with /mir, make sure the target drive doesn't contain any data you don't want deleted, because it will be a mirror of the source after the copy!)
robocopy.exe \\server123\D$ R:\ *.* /mir /copy:DATSOU /a-:SH /r:1 /w:1 /tee /np /log:"robocopy_20130908.log"

Open in new window

ASKER
WORKS2011

oBdA I ended up creating a folder and moved the data into this. THANK YOU for all your knowledge and sharing this.

If I need to open another question let me know, it looks like the 1T data is close, it's around 780G copied over however the server goes into production in about an hour. Am I right thinking that letting the data finish copying then run the same command again this evening will copy over any data that changed today? Then I all I have to do is change computer name, IP address and disconnect the source server?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
oBdA

If with "the server goes into production in about an hour" you mean the source server, then yes, just run the same command again. robocopy will not copy files that already exist in the target again (based on time stamp and size), so the second run will be significantly faster, and with the /mir, it will delete all files in the target that your users will delete today.
ASKER
WORKS2011

I'm assuming it will run through all the files again, it appears there is allot going I'm curious how long it will take to verify 1T data.
oBdA

Yes it'll have to compare source and target. How long it'll take depends obviously on the amount of files and folders, the network speed, and the storage speed on the old server.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER
WORKS2011

OUTSTANDING help worked great, thank you.