Thursday, August 6, 2015

Moving a DFS-Replicated Share to a New Drive

Here is the process I've followed successfully several times:

Add drives/VMDKs to file server VM

In the Windows OS:

  •    I used 500GB VMDKs and created a Spanned Volume
  •    Use GPT partition style to allow volumes greater than 2TB (future-proof the volume)
  •    Use Dynamic type disk to allow for Spanned Volumes
  •    I named the volume "Spanned" so I could easily recognize the drive

Copy Data to the new volume

Create Robocopy batch file on C drive:

robocopy d:\home n:\home /E /DCOPY:T /COPYALL /R:1 /W:1 /NP /LOG:c:\scripts\HomeCopy.log
The source path should include the directory on the root drive (probably drive D) because of inherited permissions
Run this once per day to minimize the amount of files required to be copied for the final sync
Perform the final sync

Stop DFS Replication service

Stop DFS Namespace service

Delete the share

Run last robocopy batch file

Make sure to close all sessions (except yours) and open files.

Delete the old pagefile

wmic computersystem set AutomaticManagedPagefile=False
wmic pagefile (lists pagefiles)
wmic pagefileset where name="D:\\pagefile.sys" delete

Switch Drive Letters

Final Robocopy job must be complete!
Review the log file to ensure all files have been copied in the final pass.
Note that Robocopy will probably error on "desktop.ini" files - these are unimortant and will re-created by the OS so you can safely ignore these errors on these files.

Delete all data on the replicated share

DFSR will notice the drive has changed and will try to do a full sync.  If you don't perform this step the replicated share destination will likely fill up and run out of space.

Start DFS Replication service
Start DFS Namespace service

Create Pagefile on new drive

Create new instance:

wmic.exe pagefileset create name="D:\pagefile.sys"

Set Size:

wmic.exe pagefileset where name="D:\\pagefile.sys" set InitialSize=8191,MaximumSize=8191

Dont' use "MB" at end of size (ulike MS KB); Set for 8191MB (Good for 8GB system)
shutdown -r -f -t 0

For memory dump files and other settings, see:

Post Move Testing
Test namespace
Test replication
Test VSS


Check the log files at C:\Windows\Debug

If you see the message "content not set" in the log run the following command to set primary replication membership:
DFSRADMIN Membership Set /RGName:<replication group name> /RFName:<replicated folder name> /MemName:<member you want to be primary> /IsPrimary:True

See: - What happens during the initial replication

Check the DFS Management MMC

Re-add namespace server if its missing.
Also try disabling/re-enabling target folder.