I recently purchased a home lab server. After fiddling around with different hypervisors I decided to go with Hyper-V server 2012 R2.

One of the benefits of using Windows Server 2012 R2 with the hyper-v Role installed is that an administrator can use data deduplication to reduce the used storage for the VHD(X) files on the storage system.

Hyper-V server 2012 R2 natively. Reading a few articles on the internet I found a few describing how to get data deduplication on Windows 8.1. I figured, why not try it on Hyper-V server 2012?

I started out downloading the files needed to enable data deduplication on Server 2012 R2. The files are extracted from a 2012R2 File Server, and will not work on previous versions of windows (Win8 or Server2012, only 2012R2 or win8.1). The files can be downloaded here.

After the download I copied the extracted files to my hyper-v Server. The next step is to RDP into the server, browse to the location of the previously downloaded and extracted files and run the next commands:

dism /online /add-package /packagepath:Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab /packagepath:Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab /packagepath:Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab /packagepath:Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab /packagepath:Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab /packagepath:Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab
dism /online /enable-feature /featurename:Dedup-Core /all

So now Dedup is installed and enabled.

The next part is to enable dedup on a volume and schedule dedup.

Enable dedup on a volume
On the volume where I store my VM's I have enabled dedup for hyper-v by entering the following command in powershell.
enable-dedupVolume D: -Usagetype HyperV

Start dedup job
After enabling dedup on the volume, I started to run an optimization job in the same powershell window.
Start-DedupJob -Volume D: -Type Optimization

After a while the dedup job has finished, show the status of the dedup job.
get-dedupStatus Dedup_HyperVServer

Setting schedules to maintain deduplication
Now that the files are optimized, files should be deduplicated on a regular base. In powershell we enter the following commands:
New-DedupSchedule -Name "MyWeekendOptimization" -Type Optimization -Days Mon,Tues,Wed,Thurs,Fri -Start 01:00 -DurationHours 9
New-DedupSchedule -Name "OffHoursScrub" -Type Scrubbing -Start 23:00 -StopWhenSystemBusy -DurationHours 6 -Days Mon,Tues,Wed,Thurs,Fri -Priori
ty Normal

New-DedupSchedule -Name "OffHoursGC" -Type GarbageCollection -Start 01:00 -DurationHours 5 -Days Sun -Priority Normal

To show the schedules enter the following command:
Get-dedupschedule

Dedup_Schedule

Using Hyper-v server 2012 R2, with deduplication isn't supported in anyway by Microsoft, but it is a way to have this feature on a home lab, without having to invest in a full scale Windows Server license.