Events
29 Apr, 14 - 30 Apr, 19
Join the ultimate Windows Server virtual event April 29-30 for deep-dive technical sessions and live Q&A with Microsoft engineers.
Sign up nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article is a quick reference guide on how to calculate the minimum staging area needed for DFSR to function properly. Values lower than these may cause replication to go slowly or stop altogether.
Keep in mind these are minimums only. When considering staging area size, the bigger the staging area the better, up to the size of the Replicated Folder. See the section "How to determine if you have a staging area problem" and the blog posts linked at the end of this article for more details on why it is important to have a properly sized staging area.
The staging area quota must be as large as the 32 largest files in the Replicated Folder.
Initial Replication will make much more use of the staging area than day-to-day replication. Setting the staging area higher than the minimum during initial replication is strongly encouraged if you have the drive space available.
Use a PowerShell script to find the 32 or 9 largest files and determine how many gigabytes they add up to. Before beginning, enable maximum path length support, first added in Windows Server 2016 using Maximum Path Length Limitation
Run the following command:
Get-ChildItem c:\\temp -recurse | Sort-Object length -descending | select-object -first 32 | ft name,length -wrap –auto
This command will return the file names and the size of the files in bytes. Useful if you want to know what 32 files are the largest in the Replicated Folder so you can “visit” their owners.
Run the following command:
Get-ChildItem c:\\temp -recurse | Sort-Object length -descending | select-object -first 32 | measure-object -property length –sum
This command will return the total number of bytes of the 32 largest files in the folder without listing the file names.
Run the following command:
$big32 = Get-ChildItem c:\\temp -recurse | Sort-Object length -descending | select-object -first 32 | measure-object -property length –sum
$big32.sum /1gb
This command will get the total number of bytes of 32 largest files in the folder and do the math to convert bytes to gigabytes for you. This command is two separate lines. You can paste both them into the PowerShell command shell at once or run them back to back.
Running command 1 will return results similar to the output below. This example only uses 16 files for brevity. Always use 32 for Windows 2008 and later operating systems.
Name | Length |
File5.zip | 10286089216 |
archive.zip | 6029853696 |
BACKUP.zip | 5751522304 |
file9.zip | 5472683008 |
MENTOS.zip | 5241586688 |
File7.zip | 4321264640 |
file2.zip | 4176765952 |
frd2.zip | 4176765952 |
BACKUP.zip | 4078994432 |
File44.zip | 4058424320 |
file11.zip | 3858056192 |
Backup2.zip | 3815138304 |
BACKUP3.zip | 3815138304 |
Current.zip | 3576931328 |
Backup8.zip | 3307488256 |
File999.zip | 3274982400 |
First, sum the total number of bytes. Next divide the total by 1073741824. Microsoft Excel is an easy way to do this.
From the example above the total number of bytes = 75241684992. To get the minimum staging area quota needed you need to divide 75241684992 by 1073741824.
75241684992 / 1073741824 = 70.07 GB
Based on this data you would set my staging area to 71 GB if you round up to the nearest whole number.
While a manual walkthrough is interesting it is likely not the best use of your time to do the math yourself. To automate the process, use command 3 from the examples above. The results will look like this
Using the example command 3 without any extra effort except for rounding to the nearest whole number, you can determine that you need a 6 GB staging area quota for d:\docs.
Changes to the staging area quota do not require a reboot or restart of the service to take effect. You will need to wait on AD replication and DFSR’s AD polling cycle for the changes to be applied.
You detect staging area problems by monitoring for specific events IDs on your DFSR servers. The list of events is 4202, 4204, 4206, 4208 and 4212. The texts of these events are listed below. It is important to distinguish between 4202 and 4204 and the other events. It is possible to log a high number of 4202 and 4204 events under normal operating conditions.
Event ID: 4202 Severity: Warning
The DFS Replication service has detected that the staging space in use for the replicated folder at local path (path) is above the high watermark. The service will attempt to delete the oldest staging files. Performance may be affected.
Event ID: 4204 Severity: Informational
The DFS Replication service has successfully deleted old staging files for the replicated folder at local path (path). The staging space is now below the high watermark.
Event ID: 4206 Severity: Warning
The DFS Replication service failed to clean up old staging files for the replicated folder at local path (path). The service might fail to replicate some large files and the replicated folder might get out of sync. The service will automatically retry staging space cleanup in (x) minutes. The service may start cleanup earlier if it detects some staging files have been unlocked.
Event ID: 4208 Severity: Warning
The DFS Replication service detected that the staging space usage is above the staging quota for the replicated folder at local path (path). The service might fail to replicate some large files and the replicated folder might get out of sync. The service will attempt to clean up staging space automatically.
Event ID: 4212 Severity: Error
The DFS Replication service could not replicate the replicated folder at local path (path) because the staging path is invalid or inaccessible.
Events 4202 and 4208 have similar text; i.e. DFSR detected the staging area usage exceeds the high watermark. The difference is that 4208 is logged after staging area cleanup has run and the staging quota is still exceeded. 4202 is a normal and expected event whereas 4208 is abnormal and requires intervention.
There is no single answer to this question. Unlike 4206, 4208 or 4212 events, which are always bad and indicate action is needed, 4202 and 4204 events occur under normal operating conditions. Seeing many 4202 and 4204 events may indicate a problem. Things to consider:
We usually counsel customers to allow no more than one 4202 event per Replicated Folder per day under normal operating conditions. “Normal” meaning no Initial Replication is occurring. We base this on the reasoning that:
While allowing for only one 4202 event per RF per day is conservative, it greatly decreases your odds of running into staging area problems and better utilizes your DFSR server’s resources for the intended purpose of replicating files.
Events
29 Apr, 14 - 30 Apr, 19
Join the ultimate Windows Server virtual event April 29-30 for deep-dive technical sessions and live Q&A with Microsoft engineers.
Sign up nowTraining
Module
Implement a hybrid file server infrastructure - Training
Implement a hybrid file server infrastructure using Azure Files and Azure File Sync, and migrate SMB file servers to Azure.
Documentation
Understanding (the Lack of) Distributed File Locking in DFSR
This article discusses the absence of a multi-host distributed file locking mechanism within Windows, and specifically within folders replicated by DFSR.
Learn how to use the Distributed File System (DFS) Replication role service in Windows Server to replicate folders across multiple servers and sites.
Unsupported DFS-R and DFS-N deployment scenario - Windows Server
This article describes a DFS-R and DFS-N deployment scenario that Microsoft does not support.
DFSR Health Report shows Event ID 4302 - Windows Server
Describes a problem that occurs when you run the DFSR Diagnostics Report (DFSR Health Report). Many entries of Event ID 4302 are reported even though the files have already been replicated.