Solved

Need Robocopy Help.

Posted on 2010-08-21
8
811 Views
Last Modified: 2012-05-10
Can someone be so kind as to give me the exact command line for coping files from server A to Sever B?  I need to retain NTFS permissions and log the transfer so that I can make sure everything was copied.
Thank you!
0
Comment
Question by:victor2008
8 Comments
 
LVL 12

Accepted Solution

by:
Rant32 earned 250 total points
ID: 33493020
ROBOCOPY "\\ServerA\d$\data" "\\ServerB\e$\destination" /E /COPYALL /LOG+:"c:\copy.log"

If you want to delete files from the destination that no longer exist in the source, add the /PURGE option.

Hope this helps.
0
 
LVL 1

Assisted Solution

by:perplexd
perplexd earned 125 total points
ID: 33493045
I'd do it like this:

robocopy "C:\server A Folder" "\\server B\C$\Target Folder" /MIR /SEC /V /NP /LOG:"<local log path>" /R:1 /W:2 /NFL /NDL

I run this as a nightly scheduled task to sync files daily until I am ready to cut over the network name. This lets you poke through the log every day and fix any perms or other errors until you are getting clean nightly copies.

Switches detail:

/MIR /SEC mirrors with ACLs copied. /R /W shortens the default wait time for locked files. This was making my jobs take all night at 30 second wait and 10 retries. /NP shows no progress to get rid of spam in your logs. /NFL /NDL are no file or directlory logging because, again, the successful copies are just spam in your log. So, with all this, your log shows you the errors, or just a summary if there was no error.
0
 
LVL 12

Assisted Solution

by:Rant32
Rant32 earned 250 total points
ID: 33493212
Yes, you get the ACL, but /SEC will not copy Owner information. If the Creator Owner group is used in the ACL, the effective permissions may not be the same. /COPYALL will copy ACL, Owner and Audit attributes.

Lowering the retries and waits from the default is a good idea though.

One other note: I also recommend to run the command as a member of the Backup Operators group on the source server.
0
 
LVL 4

Assisted Solution

by:TechnoButt
TechnoButt earned 63 total points
ID: 33497703
As an aside, purely because I"ve hit this recently myself, if your servers are running SMB 2.0 (ie, newer 2008 boxes) and are speaking over Cisco WAAS (ie, replicating files offsite), there is a bug right now that requires code patching oneither the Cisco WAAS or the Microsoft boxes that are both out of band fixes. If this applies, say so, and I'll try to pull the KB article numbers for you.

The reason I mention it, is that NTFS security lookups fail due to the bug, causing robocopy /sec  or robocopy /copyall or similar to fail (despite most file copies ro communications with SMB 2.0 to work fine).  Annoying somewhat rare issue that took me a bit to resolve recently.

This might be a stretch, but I dropped it here in case you run into the issue.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 2

Assisted Solution

by:johnnytanki
johnnytanki earned 62 total points
ID: 33498346
Simple usage as below:

net use v: \\serverA\xxx
net use u: \\serverB\yyy
robocopy v:\ u:\ /e /R:2 /W:1 /z /mir >> log.txt

Where V: drive is the source and U: is the destination. It will mirror what is on V to D: which include the NTFS permission. R is the switch for number of Retries on failed copies and W is the Wait time between retries.

User robocopy /??? for more information.
0
 
LVL 12

Assisted Solution

by:Rant32
Rant32 earned 250 total points
ID: 33498695
johnnytanki, your command line will certainly not copy file permissions.
0
 
LVL 1

Assisted Solution

by:perplexd
perplexd earned 125 total points
ID: 33501596
Yes, rant32 is correct, MIR alone will definitely not copy permissions. I never cared about owner permissions in the last few runs I had to do, but I am sure he is right about that as well.
0
 
LVL 12

Assisted Solution

by:Rant32
Rant32 earned 250 total points
ID: 33504547
Then may I suggest this version, a mix of perplexd's solution and mine?

robocopy "source" "destination" /MIR /COPYALL /NP /LOG:"logfile" /R:1 /W:2 /NFL /NDL

source, destination and logfile can be a local path or UNC path.
/MIR  Copy empty directories and delete files that don't exist in the source (same as /E /PURGE)
/COPYALL  Copy all regular file attributes (RSHA) and security, owner and audit attributes
/NP  No progress
/LOG(+)  Log output to file (use /LOG+: to append to existing file)
/R:1  number of retries
/W:2  Wait time
/NFL  No file list
/NDL  No dir list

I left out /V because it logs skipped files that already exist (spam as well).
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By default, Carbonite Server Backup manages your encryption key for you using Advanced Encryption Standard (AES) 128-bit encryption. If you choose to manage your private encryption key, your backups will be encrypted using AES 256-bit encryption.
How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now