Print View

How to Copy Large NTFS Volumes

Issue

Copying large NTFS volumes can have a number of issues in relation to path lengths, permissions available timeframe and availability of domain local groups in a mixed mode domain.

The NTFS volume can be copied using ROBOCOPY and SUBINACL to resolve any permissions issues

256 Character Limit
Use Robocopy version XP010 available in the Windows Server 2003 Resource Kit Tools. Previous versions of Robocopy would fail to copy any pathname longer than 256 characters. The program has now been enhanced to handle pathnames of any length, up to the internal Windows limit of nearly 32,000 characters.

Minimizing Directory Fragmentation with Robocopy
When you copy a directory tree for the first time, the files contained in each directory are copied into it as it is created. The directory entry for each file is created first, and then the file data is copied. If the tree contains large directories, however, this sequence can cause fragmentation of the directory structure. When disk allocation for the directory itself is expanded, the new directory extent can be separated from the rest of the directory by large amounts of file data, which can reduce later file system performance significantly. Use the /CREATE switch to minimize directory fragmentation when you copy a large tree for the first time. When /CREATE is specified, Robocopy creates only the directory tree and zero-length files as placeholders for the actual files. No file data is copied. Immediately following a Robocopy command containing /CREATE, run the same command again without /CREATE to copy the file data to the destination.

SubInACL in the Windows Server 2003 Resource Kit Tools may incorrectly return 0 files. Use the latest download below.

Resolution

1) Replace groups as required in mixed mode using SubInACL

subinacl.exe /noverbose /subdirectories \\server\share\*.* /replace=Domain\Administrators="Domain\Domain Admins"


2) Creating directory structure to avoid directory fragmentation
ROBOCOPY <source> <destination> /S /E /CREATE /R:1 /W:1 /NP /XD "RECYCLER" "SIS Common Store" "System Volume Information" /LOG:<logfile>


3) Performing inital file copy
ROBOCOPY <source> <destination> /S /E /COPY:DATSO /B /R:1 /W:1 /NP /XD "RECYCLER" "SIS Common Store" "System Volume Information" /LOG+:<logfile>


4) Resolve any "Access Denied" messages with setinacl:
"ERROR 5 (0x00000005) Copying NTFS Security to Destination Directory"
"ERROR 5 (0x00000005) Copying File"

To add Administrators to the permissions (no need to take ownership):

subinacl.exe /noverbose /subdirectories "\\server\share\directory\*.*" /grant=Administrators=F


To add Administrators to the permissions and take ownership for directories with a broken owner:

subinacl.exe /noverbose /subdirectories "\\server\share\directory" /grant=Administrators=F /setowner=Administrators


5) Performing additional copies
ROBOCOPY <source> <destination> /S /E /COPY:DATSO /B /R:1 /W:1 /NP /XD "RECYCLER" "SIS Common Store" "System Volume Information" /LOG+:<logfile>


6) Performing Final Copy
Export the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares registry key in case shares are accidentally removed when changing drive letters.

Either stop the server service, or alternatively export and delete the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares key from the original server, then restart the server. This will prevent the shares being used while the final copy takes place.

ROBOCOPY <source> <destination> /S /MIR /ZB /COPY:DATSO /B /R:3 /W:1 /NP /XD /XD "RECYCLER" "SIS Common Store" "System Volume Information" "\SIS Common Store" "\System Volume Information" /LOG:<logfile>


Restart the server service, or reimport the exported shares registry key and restart the server.

References

Products

Microsoft Windows XP (any)
Microsoft Windows Server 2003 (any)
Microsoft Windows 2000 (any)

Created: 5th April 2007
Updated: 2nd April 2010

Print View

© 2005-2024 Jamie Morrison