One of the tasks you may need to accomplish when working with a Windows Server 2016 Hyper-V host is adding local storage to the host. Often, VMs will be housed on a volume that is separate from the operating system volume that contains Windows Server 2016. Let’s take a quick look at how to add local storage in Windows Server 2016 Hyper-V. If you have installed the Server Core install using the Windows Server 2016 Standard or Datacenter edition, or if you have installed the free Hyper-V Server 2016, we will be accomplishing this from the commandline.
Add Local Storage in Windows Server 2016 Hyper-V
To bring a new storage volume online in Windows Server 2016 Hyper-V, we can use the diskpart utility which is the commandline tool that allows us to manipulate storage in Windows Server. The following is a sample of the diskpart commands you would use to bring an extra volume online.
DISKPART> list disk DISKPART> select disk <disk number> DISKPART> online disk DISKPART> attributes disk clear readonly DISKPART> clean DISKPART> convert gpt DISKPART> create partition primary DISKPART> select volume <volume number> DISKPART> format fs=refs label=VMs quick DISKPART> assign letter d DISKPART> list volume
The above commands are straightforward. However, just a quick walk through here. We begin by listing out the available disks on the server. We select the disk that we want to use as Hyper-V storage, bring it online, clean it, and then convert it to a GPT disk. Then we create a partition, format it, and finally assign it a drive letter. You can then list the volumes and should be able to see the newly created ReFS volume online with the appropriate drive letter.
Also, in listing the volume we can see that we have our volume online and ready, formatted, and we have a drive letter assigned to the volume. We should now be able to configure this volume in Hyper-V settings to store the VM disks as well as the configuration files.
Attach using Disk Management MMC Console
Remote management on the Hyper-V host still requires that we put any firewall rules in place to allow connecting to the server. If we want to use a remote Disk Management Console session to manage the storage on our Hyper-V host, we need to add a firewall exception both on the server AND the workstation side.
netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes
Using diskpart to add local storage in Windows Server 2016 Hyper-V is an easy way to effectively add a volume to the Windows Server 2016 Server core install or the Hyper-V Server 2016 which is essentially Server Core with the Hyper-V role already installed. Both are GUI’less so we must use the commandline tools to manage the server from the console.