How to Configure Windows Server 2019 Data Deduplication

Data Deduplication (dedup) on Windows Server 2019 reduces storage consumption by identifying and removing duplicate data blocks within a volume, replacing duplicate copies with references to a single shared copy. Deduplication is particularly effective for file shares, virtualization storage (VDI, Hyper-V), and backup repositories, where data duplication rates of 50–95% are common. Windows Server 2019 supports deduplication on both NTFS and ReFS volumes for backup workloads.

Installing Data Deduplication

# Install the Data Deduplication role feature
Install-WindowsFeature -Name FS-Data-Deduplication -IncludeManagementTools

# Verify installation
Get-WindowsFeature -Name FS-Data-Deduplication | Select-Object Name, InstallState

# Import the Deduplication module
Import-Module Deduplication

Enabling Deduplication on a Volume

Deduplication supports several usage profiles optimized for different workloads. Choose the appropriate profile:

# Enable deduplication on D: drive for a general file server
Enable-DedupVolume -Volume D: -UsageType Default

# Enable for Hyper-V VDI workloads (live dedup during active access)
Enable-DedupVolume -Volume D: -UsageType HyperV

# Enable for backup repositories
Enable-DedupVolume -Volume D: -UsageType Backup

# Verify which volumes have deduplication enabled
Get-DedupVolume | Select-Object Volume, Enabled, UsageType, MinimumFileAgeDays, MinimumFileSize

# Configure minimum file age (days before a file is eligible for dedup)
Set-DedupVolume -Volume D: -MinimumFileAgeDays 3

# Configure minimum file size eligible for deduplication (default 32KB)
Set-DedupVolume -Volume D: -MinimumFileSize 32768

# Exclude file extensions from deduplication (already-compressed files)
Set-DedupVolume -Volume D: -ExcludeFileType "zip","7z","rar","mp4","mkv","jpg","png"

# Exclude specific folders from deduplication
Set-DedupVolume -Volume D: -ExcludeFolder "D:ISO-Files","D:Temp"

Running Deduplication Jobs Manually

# Trigger an optimization job immediately (background process)
Start-DedupJob -Volume D: -Type Optimization

# Run a garbage collection job (reclaims space from deleted or changed files)
Start-DedupJob -Volume D: -Type GarbageCollection

# Run a scrubbing job (checks dedup store for corruption)
Start-DedupJob -Volume D: -Type Scrubbing

# Run with high priority to complete faster
Start-DedupJob -Volume D: -Type Optimization -Priority High

# Monitor job progress
while ($true) {
    $job = Get-DedupJob -Volume D:
    if ($job) {
        Write-Host "$(Get-Date -Format HH:mm:ss) | Type: $($job.Type) | Progress: $($job.Progress)% | State: $($job.State)"
        if ($job.State -in @("Completed","Failed")) { break }
    } else {
        Write-Host "No active dedup jobs"
        break
    }
    Start-Sleep -Seconds 10
}

Viewing Deduplication Savings

# View deduplication statistics
$dedupStatus = Get-DedupStatus -Volume D:
$dedupStatus | Select-Object Volume, OptimizedFilesCount, OptimizedFilesSavings, 
  SavedSpace, SavingsRate, DataChunkStoreSize, LastOptimizationTime

# Human-readable summary
$status = Get-DedupStatus -Volume D:
Write-Output @"
Volume: $($status.Volume)
Optimized Files: $($status.OptimizedFilesCount)
Saved Space: $([math]::Round($status.SavedSpace/1GB,2)) GB
Savings Rate: $($status.SavingsRate)%
Last Optimization: $($status.LastOptimizationTime)
"@

# Get dedup volume settings
Get-DedupVolume -Volume D: | Format-List *

Configuring Deduplication Schedule

# View existing dedup schedules
Get-DedupSchedule

# Modify the default optimization schedule
Set-DedupSchedule -Name BackgroundOptimization `
  -Days @("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday") `
  -Start "22:00" `
  -Duration 4 `
  -Priority Normal `
  -Memory 50

# Create a weekend garbage collection schedule
New-DedupSchedule -Name WeekendGC `
  -Type GarbageCollection `
  -Days @("Saturday","Sunday") `
  -Start "02:00" `
  -Duration 6 `
  -Priority High

# Create a weekly scrubbing schedule
New-DedupSchedule -Name WeeklyScrub `
  -Type Scrubbing `
  -Days @("Sunday") `
  -Start "04:00" `
  -Duration 4

Deduplication for Hyper-V VDI Environments

# Enable dedup on Hyper-V storage volume with VDI profile
Enable-DedupVolume -Volume V: -UsageType HyperV

# The HyperV profile enables in-place dedup of VHD/VHDX files
# even while they are open (no file age restriction)
Set-DedupVolume -Volume V: -MinimumFileAgeDays 0

# For VDI, also enable dedup on differencing VHDs
# Differencing disks pointing to the same parent see high dedup ratios

# Check VHDX files that have been deduped
Get-DedupFileMetadata -Path "V:VMs*.vhdx" | 
  Select-Object Path, OptimizedSize, InStoreSize, DedupMode

Disabling Deduplication and Reverting

# Disable deduplication on a volume
Disable-DedupVolume -Volume D:

# This removes optimization settings but does NOT unoptimize the data
# Files remain stored in deduplicated form even after disabling

# To fully unoptimize (restore files to their original non-deduplicated form)
# WARNING: this can take significant time and requires free space
Start-DedupJob -Volume D: -Type Unoptimization -Full

# Monitor unoptimization
while ($true) {
    $job = Get-DedupJob -Volume D:
    if ($job) {
        Write-Host "Unoptimizing: $($job.Progress)% - $($job.State)"
        if ($job.State -ne "Running") { break }
    } else { break }
    Start-Sleep -Seconds 15
}

Data Deduplication works best on volumes that contain many similar files, such as VDI gold images and their derivatives, file server home drives, and backup data. Monitor the savings rate after the first week of operation — if savings are below 20%, review whether the workload is a good candidate for deduplication. For volumes with highly unique data such as database files, video content, or already-compressed archives, deduplication will provide minimal benefit and should be disabled to avoid unnecessary CPU overhead.