How to create VHD sets


In this blog post, I’m going to talk about a new feature Microsoft has brought to Hyper-V in Windows Server 2016 called VHD (Virtual Hard Disk) Sets and how to configure them.

A VHD Set is a type of disk that enables you to share Virtual Hard Disks between at least two virtual servers so you can implement a guest cluster such as SQL Server AlwaysOn, file server, or even a Hyper-V failover cluster for lab purposes.

With this new technology, you are finally able to perform an online resizing of the shared virtual disks, utilize Hyper-V native replication mechanism to duplicate your data, and include VHD sets in the application-consistent checkpoints. In Windows Server 2016, these are called production checkpoints.

VHD Sets have their own extension now which is .VHDS. VHD Sets use metadata to store information about checkpoints and all aspects of managing the checkpoint chain and merging shared VHD Sets. All of this is handled by Hyper-V.

VHD Sets have the same prerequisites as the older technology, Shared VHDs. The main pre-requisite is the .VHDS file that you want to share needs to be placed on either an SMB 3.0 share or a Cluster Shared Volume (CSV).

In Hyper-V Manager, click New in the Action Pane.

Click on Hard Disk...

Click Next

Select VHD Set and click Next

Choose what type of disk you would like. For this demo, I’m just going to use Dynamically expanding.

Enter a Name for the new .VHDS and a Location that you would like it saved to. Then click Next.

Enter a Size for the new .VHDS in GB. Then click Next.

Make sure everything is ok and click Finish

To create a new VHD Set in PowerShell, we use the  New-VHD cmdlet and specify the new file type .VHDS for the -path parameter.

Open PowerShell with elevated permissions and type:

New-VHD -Path "V:\Hyper-V\guestcluster01\Virtual Hard disks\shared02.vhds" -SizeBytes 100GB -dynamic

What this command does is create a .VHDS file in the –Path you specify,  -SizeBytes sets the size of the .VHDS file, and –Dynamic sets the disk type. -Dynamic can be changed to –Fixed if you want to use a fixed disk type.

Now that we have created our virtual machine set, we have to add it to a virtual machine. In this section, I will show you how.

In Hyper-V Manager, right-click the VM you want to add the .VHDS to and click Settings.

Navigate to SCSI Controller. Make sure Shared Drive is selected and click Add

Click Browse...

Locate your .VHDS file and click Open

Click OK.

Repeat the above steps on the other VM you would like to share this new .VHDS with.

Add-VMHardDiskDrive -VMName PIXEL-VHM02 -path "V:\Hyper-V\guestcluster01\Virtual Hard Disks\shared01.vhds" -SupportPersistentReservations

To add the .VHDS to another virtual machine, all you have to do is to change the –VMName.

If you get an error message like the one below, then you need to make sure that the .VHDS is stored on a CSV or a clustered file share.

If you want to test VHD Sets in your home lab/demo lab and only have one node and no CSVs, you can use the following command in an elevated PowerShell window to allow the usage of your current storage.

fltmc.exe attach svhdxflt V:

Just make sure you change the drive letter from V: to the one you have the shared VHD on.

And that's it. Microsoft has made this new feature very easy to use which has now made it easier for us sysadmins to easily create guest clusters without using complex technologies such as NPIV, virtual HBA, and virtual SANs.

Thank you for reading this post and I hope you found it useful. If you have any questions, please leave a comment.

Get 30 days trial of Veeam Backup & Replication now

About the author
VeeamVeeam Logo
Richard Hooper has been interested in computers since he was very young. His passion for technology continued to grow until he managed to turn it into a career. He has worked in IT for more than 10 years at a variety of companies, including Hewlett Packard Enterprise (HPE). He is currently at the UK's largest Business Energy Consultancy, which is based in Newcastle Upon Tyne. He works with Microsoft technologies: Azure Hyper-V, Failover Cluster Manager, SQL, SCCM, VMM, DPM and many more. Richard holds many Microsoft certifications including MCSE: Cloud Platform and Infrastructure. Follow him on his blog and on Twitter