Everyday Virtualization

How To Deduplicate Hyper-V VMs with Windows Server 2012 R2

Some handy tips to save space and keep Hyper-V VMs from bogging down the rest of your systems.

I've been working a lot on Hyper-V recently, and I've been happy to find that there are plenty of good community resources on Hyper-V that can help people get started with it.

One feature I've spent a lot of time working on is the Windows Server 2012 deduplication feature. This feature was introduced with the base release of Windows Server 2012 and was targeted to file shares and "unstructured" data profiles. What this means is, don't run Exchange or SQL Server on it!\

Windows Server 2012 R2 introduced an additional flavor of deduplication aimed at Hyper-V VMs. The new iteration is aimed at VDI VMs, but that doesn't necessarily exclude regular VMs. Further, Clustered Shared Volumes are supported (but not required) for running deduplication on Hyper-V VMs. Fig. 1 shows a volume being enabled for deduplication.

The deduplication role can do both general purpose files and virtual machines in Windows Server 2012 R2.
[Click on image for larger view.]
Figure 1. The deduplication role can do both general purpose files and virtual machines in Windows Server 2012 R2.

Virtual machines, done well, are excellent candidates for deduplication. Enabling this role can save some space (in many cases, a lot of disk space) allocated to VMs. This is in particular applicable to C:\ drive VHDs and VHDXs of VMs that come from the same libraries.

Here are a few tips on using Windows Server 2012 R2 deduplication. First of all, don't put your Hyper-V VMs VHDs and VHDXs on the C:\ drive of the Hyper-V hosts, deduplication isn't supported there. Make a designated drive letter and run deduplication there.

The next tip is to set the scheduler to run at an appropriate time. There can be as much as 25 to 50 percent CPU assigned to Windows Server 2012 deduplication to traverse terabytes of data. Make sure that's done at a time that the hosts can take the CPU hit. There's also multipathing hit as well. Configure the deduplication schedule in the File and Storage Services section of Server Manager and additionally in Task Scheduler (see Fig. 2).

The deduplication role has three scheduler entries in the task scheduler.
[Click on image for larger view.]
Figure 2. The deduplication role has three scheduler entries in the task scheduler.

The additional tip is to look in at the task scheduler over time to make sure it is finishing in requisite time and that you are getting substantial savings on your Hyper-V hosts. If you don't like what you see, you can turn off the deduplication role or do selective expansion tasks with the Expand-DedupFile PowerShell cmdlet.

Also, I want to (virtually) introduce you to Dave Kawula. He's based in Canada and a Hyper-V MVP and has got me hooked on a number of Hyper-V things! I encourage you follow him on Twitter at @DaveKawula and his blog is http://www.nitandgritofit.com/.

I've been using Windows Server 2012 deduplication extensively since it has been available -- and hopefully you can give it a look in your environment. Have you considered it? If you've used it, what did you think of the new feature? Comments welcome and encouraged.

About the Author

Rick Vanover (Cisco Champion, Microsoft MVP, VMware vExpert) is based in Columbus, Ohio. Vanover's experience includes systems administration and IT management, with virtualization, cloud and storage technologies being the central theme of his career recently. Follow him on Twitter @RickVanover.

Featured

Subscribe on YouTube