Link to home
Start Free TrialLog in
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.
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

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
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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)
Avatar of WORKS2011

ASKER

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.
Avatar of oBdA
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).
@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.
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).
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.
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.
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
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

------------------------------------------------------------------------------
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.
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.
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.
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"
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

It's still copying data in the E$ folder, any other ideas?
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

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?
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.
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.
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.
OUTSTANDING help worked great, thank you.