The Distributed File System Replication (DFSR) service is a multi-master replication engine that keeps folders synchronized across multiple servers. Proper sizing of the staging folder and the conflict and deleted folder is critical for replication performance. An undersized staging folder causes excessive CPU and disk usage, while an oversized one wastes disk space. This guide explains how to calculate the right sizes and monitor them over time.

Understanding the DFSR Staging Folder

When DFSR needs to replicate a file, it does not send the file directly from the replicated folder to the partner. Instead, it first compresses the file (or the file’s deltas) and places it in a staging folder. The staged file is then sent to the replication partner. After successful transfer, the staged copy is cached for a period in case other partners also need it.

The staging folder serves as a buffer and cache:

  • Buffer: Files are prepared for transfer here before being sent to partners.
  • Cache: Recently replicated files remain in staging so they can be sent to additional partners without reprocessing.

If the staging folder quota is too small, DFSR must evict cached files prematurely and regenerate them when another partner requests them, resulting in additional CPU, disk I/O, and slower replication.

Calculating the Staging Folder Size

Microsoft’s Recommendation

Microsoft recommends sizing the staging folder based on the largest files in your replicated content:

  • Read-write members: Sum of the 32 largest files
  • Read-only members: Sum of the 16 largest files

Using PowerShell to Calculate the Size

Run this command on each replicated folder to determine the recommended staging size:

# Calculate recommended staging size (32 largest files for read-write)
$path = "D:\SharedFolder"
$sizeGB = (Get-ChildItem $path -Recurse -Force -ErrorAction SilentlyContinue |
    Sort-Object Length -Descending |
    Select-Object -First 32 |
    Measure-Object -Property Length -Sum).Sum / 1GB

Write-Host "Recommended staging size: $([math]::Round($sizeGB, 2)) GB"

For read-only members:

# Calculate for read-only members (16 largest files)
$sizeGB = (Get-ChildItem $path -Recurse -Force -ErrorAction SilentlyContinue |
    Sort-Object Length -Descending |
    Select-Object -First 16 |
    Measure-Object -Property Length -Sum).Sum / 1GB

Write-Host "Recommended staging size (read-only): $([math]::Round($sizeGB, 2)) GB"

Practical Considerations

The calculated value represents the theoretical maximum needed during initial replication or after major data changes. In practice:

  • Initial replication: The full calculated size is beneficial because many large files will be staged simultaneously.
  • Day-to-day operation: The actual staging needs are typically much lower, based on the rate of change rather than total file sizes.
  • Approach: Start with the calculated value, then monitor and adjust downward if the staging folder consistently uses much less space.

Configuring the Staging Folder Quota

Using DFS Management Console

  1. Open DFS Management from Server Manager or Administrative Tools.
  2. Navigate to Replication > your replication group > Replicated Folders.
  3. Right-click the replicated folder and select Properties.
  4. Click the Staging tab.
  5. Set the Quota to your calculated value (in MB).
  6. Click OK.

Using PowerShell (DFSR Module)

# View current staging quota
Get-DfsrMembership -GroupName "MyReplicationGroup" -ComputerName "Server01" |
    Select-Object ContentPath, StagingPath, StagingPathQuotaInMB

# Set staging quota (in MB)
Set-DfsrMembership -GroupName "MyReplicationGroup" `
    -FolderName "SharedFolder" `
    -ComputerName "Server01" `
    -StagingPathQuotaInMB 51200  # 50 GB

Understanding the Conflict and Deleted Folder

How Conflicts Occur

DFSR uses a “last writer wins” conflict resolution strategy. When the same file is modified on two or more members before replication completes:

  1. DFSR detects the conflict during replication.
  2. The file with the most recent modification time wins.
  3. The losing version is moved to the ConflictAndDeleted folder.

What Is Stored

The ConflictAndDeleted folder contains:

  • Conflict losers: The versions of files that lost the conflict resolution.
  • Deleted files: When a file is deleted from the replicated folder and a manifest record is maintained.

The folder is located at the root of the replicated folder under DfsrPrivate\ConflictAndDeleted.

Default Size and Configuration

The default ConflictAndDeleted quota is 660 MB. You can adjust this based on your environment:

# View current conflict and deleted quota
Get-DfsrMembership -GroupName "MyReplicationGroup" |
    Select-Object ComputerName, ContentPath, ConflictAndDeletedQuotaInMB

# Set the conflict and deleted quota
Set-DfsrMembership -GroupName "MyReplicationGroup" `
    -FolderName "SharedFolder" `
    -ComputerName "Server01" `
    -ConflictAndDeletedQuotaInMB 4096  # 4 GB

Sizing the Conflict and Deleted Folder

Size this folder based on:

  • Frequency of conflicts: Environments with many users editing the same files need larger quotas.
  • Compliance requirements: If you need to retain conflict copies for auditing, increase the quota.
  • Available disk space: The folder is on the same volume as the replicated content.

Monitoring DFSR with Event Logs

Key Event IDs

Event IDSeverityDescription
4202InformationThe staging space high watermark was reached
4204WarningThe staging space is at its configured size; oldest files are being purged
4206InformationThe staging space has dropped below the low watermark
4208ErrorThe staging quota is exceeded and DFSR cannot stage files for replication
4212WarningThe ConflictAndDeleted folder has exceeded its configured size

Watermark Behavior

DFSR uses a watermark system for the staging folder:

  • Low watermark (60%): Staging folder usage is normal. No action needed.
  • High watermark (90%): DFSR begins purging the oldest staged files to free space.
  • At quota (100%): Event 4208 is logged. Replication may stall for files that cannot be staged.

Monitoring with PowerShell

# Check DFSR staging folder usage
Get-DfsrBacklog -GroupName "MyReplicationGroup" `
    -FolderName "SharedFolder" `
    -SourceComputerName "Server01" `
    -DestinationComputerName "Server02"

# Check DFSR health
Get-DfsReplicationGroup | Get-DfsrMembership |
    Select-Object GroupName, ComputerName, StagingPathQuotaInMB,
    ConflictAndDeletedQuotaInMB

# Check for DFSR staging events in the event log
Get-WinEvent -FilterHashtable @{
    LogName = "DFS Replication"
    ID = 4202, 4204, 4206, 4208
    StartTime = (Get-Date).AddDays(-7)
} | Format-Table TimeCreated, Id, Message -AutoSize

Adjusting Sizes Over Time

After initial replication completes, follow this process to right-size the staging folder:

  1. Monitor for one to two weeks during normal operation.
  2. Check event logs for staging-related events (4202, 4204, 4208).
  3. If Event 4208 occurs multiple times per hour: Increase the staging quota by 20%.
  4. If the staging folder consistently stays below the low watermark: Consider reducing the quota to reclaim disk space.
  5. Repeat the monitoring cycle after any significant changes to the replicated content.

Best Practices

  • Over-size rather than under-size: If you must choose, a larger staging folder wastes some disk space but maintains performance. An undersized staging folder degrades replication performance and can cause failures.
  • Place the staging folder on a fast drive: If possible, use an SSD or a dedicated volume for the staging folder to improve replication throughput.
  • Monitor regularly: Set up alerts for Event IDs 4204 and 4208 so you can react before replication degrades.
  • Account for initial replication: Use the full calculated size during initial replication, then optimize afterward.
  • Separate staging from data volumes: If disk space is limited, you can move the staging folder to a different volume using the DFSR management tools.
  • Clean up the ConflictAndDeleted folder: Review its contents periodically. If you do not need the conflict copies, reducing the quota forces DFSR to purge them more aggressively.

Summary

Proper DFSR staging folder sizing is essential for reliable replication performance. Calculate the recommended size based on the 32 largest files (read-write) or 16 largest files (read-only) in your replicated folder. Start with this calculated value and adjust based on monitoring data. Watch for Event ID 4208 as an indicator that the staging quota is too small, and Event IDs 4202/4206 for watermark transitions. The conflict and deleted folder defaults to 660 MB and should be sized based on the frequency of conflicts and compliance requirements. Regular monitoring with PowerShell and event log alerting ensures your DFSR environment maintains optimal performance.