Add Hyper-V 2016 storage using DiskPart

Here we are with the configuration step to provision Hyper-V 2016 storage using DiskPart. This is a follow up article exploring the deployment of nested Hypervisors. In this case for this home lab we are using Hyper-V 2016 Server as a VMware vSphere Guest.

In this part we are going to add and manage storage for the Hyper-V 2016 Server. Since the Hyper-V 2016 Server Core installation has no GUI we can use PowerShell and in particular DiskPart utility to manage the storage.

The steps in this case are very easy to follow. Essentially we can add new virtual Disks to the Hyper-V 2016 VM. This is the usual process as per ordinary VMware Guests. Once added we then move the to command line inside the Guest and run the PowerShell cmd-lets to configure DiskPart.

At the end of the process we can than configure Hyper-V 2016 storage to use this new virtual Disks as the default new location to store it’s own VMs. So in practice let’s make sure we initially create a VMware virtual Disk big enough to store the intended Hyper-V2016 VMs. Next use DiskPart to initialise this Disk and format to NTFS or ReFS.

This will be the location where all the .vhd and .vhdx along with XML files will be located.

 

Configure Hyper-V 2016 Storage with DiskPart

Hyper-V 2016 Server Core installation does not include a full Windows GUI. This helps limiting the number of updates and number of components to manage. Last but not least also the fact that by reducing the amount of resources needed (for example RAM Memory) is resulting also in a smaller footprint. Which is great as this resources can be used by VMs instead.

This is the perfect scenario also for our home lab. Ultimately we need to provide resources to VMs running inside Hyper-V now running as a VMware Guest!

Pretty much everything is using the command line. Luckily we have PowerShell already built-in with all the basic modules. So first thing would be to start PowerShell with a user with local admin rights.

Hyper-V 2016 Storage powershell

And the “Hardware Management” makes no exception. For this task we can leverage the built-in PowerShell commands to invoke the standard commands. In this case DiskPart.

Hyper-V 2016 Storage diskpart

Next let’s issue a List Disk command to verify the new virtual Disk is attached to the Hyper-V 2016 Guest. In this case shows as Disk 1.

Hyper-V 2016 Storage list disk

Let’s Select Disk 1 now.

Hyper-V 2016 Storage diskpart select disk

Next is to create a Primary Partition with the command Create Partition Primary.

Hyper-V 2016 Storage diskpart create partition

In the next step we are now ready to format the new partition in order to create a Volume. By default it is using NTFS. It is also possible to select ReFS. A new file system which includes a dedupe mechanism. Very useful for such Volumes storing VMs and Backups.

So in this example the command will look like format FS=NTFS label=”VMStore” quick

The format will take a few seconds to complete.

Hyper-V 2016 Storage diskpart format disk

At this point we can assign a new letter to the Volume. In this example with the command assign letter=E

Hyper-V 2016 Storage diskpart assign letter

As a confirmation everything worked as expected with list partition command we can now see the newly created partition including size and type.

Hyper-V 2016 Storage diskpart list partition

And finally with a list volume we can see all volumes available on the Hyper-V 2016 Server.

Hyper-V 2016 Storage diskpart list volume

And this concludes this very quick article on how to use DiskPart to add or manage storage for Hyper-V 2016 Server. Next is to configure Hyper-V 2016 Server to use this new Volume as the default location to store it’s own Virtual Machines. We’ll cover this topic in the next article.

There are plenty of other commands we can run, also outside the DiskPart context. This is something we’ll discover in the next articles.

Michele Domanico

Passionate about Virtualization, Storage, Data Availability and Software Defined Data Center technologies. The aim of Domalab.com is sharing with the Community the knowledge and experience gained with customers, industry leaders and like minded peers. Always open to constructive feedback and new challenges.

Leave a Reply

%d bloggers like this: