Enabling data de-duplication can have a sizeable impact on your used storage space. But did you also know that enabling de-duplication is currently a recommended best practice for general purpose Hyper-V hosts? Follow along and I’ll show you how to enable Hyper-V de-duplication using only PowerShell.
If you are unfamiliar with installing Windows Features with PowerShell thats ok, I’ll show you how to display all windows features, then install and enable data de-duplication.
Getting started, we’ll use get-windowsfeature to display all available features and find the official de-duplication name.
The feature is under File and Storage Services and its name is FS-Data-Deduplication.
Next just to be sure we can use get-windowsfeature -name FS-Data-Deduplication and then use up arrow for the last command, then pipe that into Install-windowsfeature
Get-WindowsFeature -name FS-Data-Deduplication Get-WindowsFeature -name FS-Data-Deduplication | Install-WindowsFeature
Next, we’ll enable de-duplication for my Hyper-V volume, which is an ReFS volume. Note: Data De-duplication for ReFS volumes is only available in Server 2019 and above. Also if you are enabling this on a Failover cluster, there are some pertinent notes in that same link.
We use the Enable-DedupVolume command.
Enable-DedupVolume -Volume "F:" -UsageType HyperV
There are three UsageTypes to select from, default, backup and hyperv.
Because I’m impatient and wanted to start the job in my lab immediately I used Start-Dedupjob.
start-dedupjob -type optimization -volume "f:" -memory 50 -cores 50
This starts the job immediately and tells it to use 50% of the memory and 50% of the cores.
So how are the results? Pretty good I would say. This screen grab is from before I enabled de-duplication
and this one is from after.
It freed up over 500GB of space.
There are some more commands in the module for adding or modifying the de-duplication schedule.