Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to use Robocopy to resync two file servers and file/folder permissions

Posted on 2013-01-17
17
Medium Priority
?
1,258 Views
Last Modified: 2013-01-21
Hello,

I am putting a file server in a branch office.  I originally copied all of the file/folder data from the corporate file server onto the branch file server before shipping it out.  Now that it is onsite and they are ready to go live I'd like to resync from corporate to branch given I've made several changes to permissions and document changes within the corporate file server.

I tried \\hoppy\frshare \\hkfile\frshare /mir

but I'm getting access denied.  Is this the proper syntax or am I doing something wrong?
0
Comment
Question by:bergquistcompany
  • 7
  • 5
  • 5
17 Comments
 
LVL 23

Expert Comment

by:Erik Bjers
ID: 38787453
I would use total commander for this.  They have a nice sync tool that can sync up all the files on both sides, and it is free.

Here are some how to guides that will help

http://www.ghisler.com/advanced.htm

eb
0
 

Author Comment

by:bergquistcompany
ID: 38787563
does this sync user permissions and ownership on folders?
0
 
LVL 23

Expert Comment

by:Erik Bjers
ID: 38787631
If you use the copy function yes it will copy permissions and ownership (configurable option) but it appears it does not copy permissions and ownership when using the synchronize function.

If all the file synchronization is one way (old server to new server) then you can just tell total commander to do a copy and to overwrite older/ smaller files on the destination.  If there are files changed on both servers you need to use the sync function.

You can use setacl http://helgeklein.com/setacl/ to export and import file permissions and ownership if total commander does not copy them properly.

setacl has a free command line version and a very inexpensive GUI (setaclstudio).  I use this at lest once a week to fix permission issues so even if you don't need it for this job it is a good tool to have.
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:bergquistcompany
ID: 38787670
I'd like to use one program if possible to do this and I thought robocopy did.
YOu said copy in total commander will?  If so how do you copy I don't see that in commands?
0
 
LVL 26

Accepted Solution

by:
Leon Fester earned 2000 total points
ID: 38787723
I have used ROBOCOPY for this exact task many times.

Have a look at the following batch file from http://ss64.com/nt/robocopy.html

Backup a Server:
The script below copies data from FileServ1 to FileServ2, the destination holds a full mirror along with file security info. When run regularly to synchronize the source and destination, robocopy will only copy those files that have changed (change in time stamp or size.)

@ECHO OFF
SETLOCAL

SET _source=\\FileServ1\e$\users

SET _dest=\\FileServ2\e$\BackupUsers

SET _what=/COPYALL /B /SEC /MIR
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode. 
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree 

SET _options=/R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging

ROBOCOPY %_source% %_dest% %_what% %_options%

Open in new window


Run two robocopy jobs at the same time with START /Min

Start /Min "Job one" Robocopy \\FileServA\C$\Database1 \\FileServeBackupA\c$\Backups
Start /Min "Job two" Robocopy \\FileServB\C$\Database2 \\FileServeBackupB\c$\Backups

Or just use the command line version of the above script
Robocopy source destination /COPYALL /B /SEC /MIR /R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL

Open in new window


See the MS Storage Team blogs for more information:
http://blogs.technet.com/b/filecab/archive/2008/07/31/robocopy-mir-switch-mirroring-file-permissions.aspx
0
 
LVL 23

Expert Comment

by:Erik Bjers
ID: 38787738
Copy in total commander will, there are a few things you need to do.

First open it
and navigate to your source on the left pane and destination on the right]

Next select the files you want to copy from left to right then simply drag them over to the destination.

An options window will pop up and one of the options is to copy NTFS permissions.

BTW I also found this info on robocopy that should tell you how to do it with robocopy if you prefer.

http://burpee.smccme.edu/studenthowtos/robocopy.htm

eb
0
 

Author Comment

by:bergquistcompany
ID: 38787939
I didn't get the popup window

If I run the command line as follows
Robocopy \\hoppy\bqcorp1\frshare \\hkfile\bqcorp1\frshare  /COPYALL /B /SEC /MIR /R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL

This will copy everything under FRShare from Hoppyt to HKFile including permissions?
If contents are there from an original sync it will overwrite?
0
 
LVL 23

Expert Comment

by:Erik Bjers
ID: 38787976
See dvt_localboy's comments above there is a good script for doing it with robocopy.
0
 

Author Comment

by:bergquistcompany
ID: 38788024
So just create a batch file with this in it and all I have to change is the source and destination?
Is this using Robocopy?  Do I have to alter something in the last line or not?

If file changes and permission changes were made on the backup server they will be corrected by overwrites?
0
 
LVL 23

Expert Comment

by:Erik Bjers
ID: 38788048
Looks like it uses robocopy and you just need to change the source and destination and then run the .bat file.

If you are on Svr 2008 I would open CMD as an admin and run the .bat from there or you may run into some security issues.

eb
0
 

Author Comment

by:bergquistcompany
ID: 38788129
I do and get maximum setlocal recursion level reached over and over
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 38789147
Use the last Robocopy commands that I posted. The /Mir switch mirrors the content from source to destination. /sec says to copy security permissions. If any folders are added or deleted or permissions are changed then those changes will be replica to the destination folder
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 38789151
Use the last Robocopy commands that I posted. The /Mir switch mirrors the content from source to destination. /sec says to copy security permissions. If any folders are added or deleted or permissions are changed then those changes will be replicated to the destination folder. The batch file will explains the rest of the switches. Otherwise type robocopy /? For more help.
0
 

Author Comment

by:bergquistcompany
ID: 38790025
ok tried that and getting
2013/01/17 17:43:38 ERROR 5 (0x00000005) Creating Destination Directory \\hkfile\bqcorp1\frshare\Materials\SFE Cycle Count Data\whse SH1 FG\2009\feb 09\
Access is denied.
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 38791873
ERROR 5 (0x00000005) Creating Destination Directory \\hkfile\bqcorp1\frshare\Materials\SFE Cycle Count Data\whse SH1 FG\2009\feb 09\

Access denied is a permissions issue on the account that you're using to run the command.
You don't have sufficient permission to create the folders mentioned in the error message.
0
 

Author Comment

by:bergquistcompany
ID: 38792589
is it lack of permisison on the source or destination because from the source I can browse and manually create folders as tests
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 38792607
Destination folder

ERROR 5 (0x00000005) Creating Destination Directory \\hkfile\bqcorp1\frshare\Materials\SFE Cycle Count Data\whse SH1 FG\2009\feb 09\
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

810 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