Solved

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

Posted on 2013-01-17
17
1,064 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
 

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 500 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

707 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

17 Experts available now in Live!

Get 1:1 Help Now