Show
Creating a new virtual hard disk is almost always included as a step during the creation of the virtual machine that owns it. It’s certainly not the only time or the only way that you can create a VHDX. You don’t necessarily need to attach it to a virtual machine, however, as Hyper-V Manager has a complete management system for virtual hard disks whether or not they have a connection to a virtual machine. You can use it to create both standalone virtual hard disks and disks directly attached to a virtual machine. PowerShell also offers similar functionality. Use Hyper-V Manager to Create a New Virtual Disk Directly on a Virtual MachineTo get started, open Hyper-V Manager and choose your desired creation method from one of the next two sections.
Using Hyper-V Manager to Create a Standalone Virtual Hard DiskTo create a new standalone virtual hard disk, there’s only a single that that you need to do to open the wizard. In Hyper-V Manager, in the Actions pane at the far right, click New then Virtual Hard Disk. Add New VHD New Virtual Hard Disk WizardWhichever method you chose above, you’ll now be looking at the New Virtual Hard Disk Wizard. Follow the steps below to actually create the virtual hard disk.
Creating a VHDX in PowerShellUse the New-VHD cmdlet to create the VHD, then Add-VMHardDiskDrive to attach it. New-VHD -Path 'C:LocalVMsVirtual Hard Disksnewvdisk.vhdx' -SizeBytes 50gb -Dynamic | Add-VMHardDiskDrive -VMName svtest -ControllerType IDE -ControllerNumber 1 -ControllerLocation 1New VHD Creation NotesVHD creation is a fairly easy-to-understand process but there are a few things to be mindful of.
Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!
Applies To: Windows Server 2012 R2 Starting in Windows Server® 2012 R2, Hyper-V provides you with the ability to grow or shrink the size of a virtual hard disk while the virtual machine is still running. This topic creates a virtual hard disk (attached to a SCSI Controller), adds the virtual hard disk to the virtual machine and details the process for expanding and shrinking a virtual hard disk.
Note The user interface option to shrink a virtual hard disk is only visible for virtual hard disks that have been expanded previously. Online resize is exclusive to SCSI attached VHDX files. For more information about resizing virtual hard disks, see Virtual hard disk resizing. PrerequisitesBefore you attempt to edit the size of your virtual hard disk, make sure that you have the following:
To create a virtual hard disk for a virtual machineCreate a virtual hard disk (attached to a SCSI controller) for a virtual machine using the following procedure:
Adding a virtual hard disk to the virtual machineAfter adding a virtual hard disk, it is necessary to configure your virtual machine so that the operating system within the virtual machine can see the additional disk capacity. The disk must be brought online, initialized and formatted. These instructions assume a virtual hard disk has been created for a Windows Server® 2012 R2virtual machine.
The new virtual hard disk will now be visible to the virtual machines operating system. To expand the size of a virtual hard diskYou can expand the storage capacity of the virtual hard disk using the following procedure:
Expand the volume of a virtual hard disk connected to a virtual machineAfter expanding a virtual hard disk, it is necessary to configure the disk management within your virtual machine operating system so that it can see the new disk space. This space is currently residing as an unallocated volume created in the virtual disk. These instructions assume a virtual hard disk has been expanded and that it is connected to a Windows Server® 2012 R2virtual machine.
The operating system within the virtual machine will now see the expanded disk capacity. To shrink the size of a virtual hard diskYou can shrink the size of a virtual hard disk. However, you cannot shrink the size of the virtual hard disk below the size of the disk volume that is in use within the operating system of the virtual machine. Reduce the storage capacity of the virtual hard disk using the following procedure:
|