How do I create a VM on a VHDX file?

How to Create a New VHD or VHDX File in Windows 10

Windows 10 supports virtual drives natively. It is able to recognize and use ISO, VHD and VHDX files. For ISO files, Windows 10 creates a virtual disk drive. For VHD and VHDX files, Windows 10 creates a new drive accessible via the This PC folder in File Explorer. Also, these files can be used in Hyper-V machines. Today we will review various methods that you can use to create a new VHD or VHDX file.

The Virtual Hard Disk (VHD) file format allows encapsulation of the hard disk into an individual file for use by the operating system as a virtual disk in all the same ways physical hard disks are used. These virtual disks are capable of hosting native file systems (NTFS, FAT, exFAT, and UDFS) while supporting standard disk and file operations. The maximum size of a VHD file is 2,040 GB.

VHDX is a new version of the VHD format which has a much larger storage capacity than the older VHD format. It also provides data corruption protection during power failures and optimizes structural alignments of dynamic and differencing disks to prevent performance degradation on new, large-sector physical disks. It supports for virtual hard disk storage capacity of up to 64 TB.

Windows 10 supports two virtual disk types:

  • Fixed—The VHD image file is pre-allocated on the backing store for the maximum size requested.
  • Expandable—Also known as "dynamic", "dynamically expandable", and "sparse", the VHD image file uses only as much space on the backing store as needed to store the actual data the virtual disk currently contains. When creating this type of virtual disk, the VHD API does not test for free space on the physical disk based on the maximum size requested, therefore it is possible to successfully create a dynamic virtual disk with a maximum size larger than the available physical disk free space.

There are a number of methods you can use to create a new VHD or VHDX file in Windows 10. After that, you can assign it to a virtual machine or mount to the running system.

  1. Press the Win + X keys together the keyboard.
  2. From the menu, select Disk Management.
    How do I create a VM on a VHDX file?
  3. In Disk Management, select Action > Create VHD from the menu.
    How do I create a VM on a VHDX file?
  4. Click on the Browse button to specify the desired VHD(X) file location.
  5. How do I create a VM on a VHDX file?
  6. Enter a file size you want to create a VHD file of.
    How do I create a VM on a VHDX file?
  7. Select the file type (VHD or VHDX).
  8. Select Fixed size or Dynamically expanding according to what works best in your case.
  9. Click OK and you are done.

Voila, you just created a VHD file. The disk will appear in the Disk Management console.

How do I create a VM on a VHDX file?

There are alternative options that you can use to create a new VHD file.

Create VHD(X) File using Hyper-V Manager

  1. Open the Hyper-V Manager app (Win + R > type virtmgmt.msc into the Run box).
  2. Select a server on the left.
  3. On the right, click on New under Actions, and select Hard Disk.
    How do I create a VM on a VHDX file?
  4. Click Next in the virtual disk wizard dialog.
    How do I create a VM on a VHDX file?
  5. Select VHD or VHDX for the disk format.
    How do I create a VM on a VHDX file?
  6. Select Fixed size or Dynamically expanding for the disk type you want.
    How do I create a VM on a VHDX file?
  7. Next, specify the directory path and the file name for your new VHD file.
    How do I create a VM on a VHDX file?
  8. Select Create a new blank virtual hard disk and enter the desired disk size in GB.
    How do I create a VM on a VHDX file?
  9. Verify that everything is correct, and click on Finish.
    How do I create a VM on a VHDX file?

You are done.

Now, let's look on how it can be done with PowerShell.

Note: These PowerShell commands work only when the Hyper-V feature is enabled.

Create New VHD(X) File Using PowerShell

  1. Open PowerShell as Administrator.
  2. Execute te following command to create a fixed size VHD file: New-VHD -Path "Full\path\to\vhd\file" -Fixed -SizeBytes <size>.
  3. To create a dynamically expanding VHD, issue the command New-VHD -Path "Full path of .vhd or .vhdx location" -Dynamic -SizeBytes <size>.
    How do I create a VM on a VHDX file?
  4. Substitute Full\path\to\vhd\file with the actual full path of the .vhd or .vhdx file where you want to store it.
  5. Substitute <size> with the maximum size (ex: "1GB") you want for the .vhd or .vhdx file. This can be expressed as in MB, GB, or TB.

Also, you can use the DiskPart tool to create a new VHD(X) file in Windows 10. Here's how.

Create New VHD or VHDX File with DiskPart

  1. Press Win + R shortcut keys on the keyboard to open the Run dialog.
  2. Type diskpart into the Run box and hit the Enter key. Confirm the UAC prompt.
    How do I create a VM on a VHDX file?
  3. Type the following command: create vdisk file="Full\path\to\vhd\file" maximum=<size> type=fixed. This will create a new fixed size VHD.
  4. To create a dynamically expanding VHD/VHDX file, execute the command: create vdisk file="Full\path\to\vhd\file" maximum=<size> type=expandable.
    How do I create a VM on a VHDX file?
  5. Substitute Full\path\to\vhd\file with the actual full path of the .vhd or .vhdx file for where you want to store it at.
  6. Substitute <size> with the maximum size you want for the .vhd or .vhdx file in megabytes. E.g. 1024 for 1GB.

You are done.

Regardless of the method you used to create a VHD file, you need to create a file system on it in order to store some data on it, e.g. install an operating system or just copy some files. Here is how it can be done.

To Create File System on VHD or VHDX File,

  1. Press the Win + X keys together on the keyboard. See the list of shortcuts with the Win key available in Windows 10.
  2. From the menu, select Disk Management.
    How do I create a VM on a VHDX file?
  3. If you do not see you VHD in the list, then select Action > Attach VHD from the menu.
    How do I create a VM on a VHDX file?
  4. Browse for you VHD file and click OK. Do not check the "read only" option.
    How do I create a VM on a VHDX file?
  5. The VHD file will appear as a new drive in the list.
  6. Right-click the attached VHD file, and select Initialize Disk from the context menu.
    How do I create a VM on a VHDX file?
  7. Select MBR or GPT for the partition style and click OK.
    How do I create a VM on a VHDX file?
  8. Right-click the unallocated space on your virtual drive and select New Simple Volume...
    How do I create a VM on a VHDX file?
  9. Select the partition size, file system, and specify the volume label for the new partition.
    How do I create a VM on a VHDX file?
    How do I create a VM on a VHDX file?
    How do I create a VM on a VHDX file?
  10. Now your VHD file is ready for regular tasks.

Alternatively, you can create the file system for your drive with DiskPart.

Create File System on VHD or VHDX File with DiskPart

  1. Press Win + R shortcut keys on the keyboard to open the Run dialog.
  2. Type diskpart into the Run box and hit the Enter key. Confirm the UAC prompt.
  3. In the diskpart prompt, type and run the command select vdisk file="Full path of .vhd or .vhdx location".
    How do I create a VM on a VHDX file?
  4. Type and run the command attach vdisk.
    How do I create a VM on a VHDX file?
  5. Create a new partition on the VHD using the following command: create partition primary.
    How do I create a VM on a VHDX file?
  6. Format the partition using the command format fs=FILE_SYSTEM_NAME label="disk label of your choice" quick.
    How do I create a VM on a VHDX file?
  7. Substitute FILE_SYSTEM_NAME with either FAT, FAT32, or NTFS. NTFS is strongly recommended.
  8. Replace "disk label of your choice" with some meaningful name, e.g. "my first VHD".
  9. To make the partition you have created on VHD visible in File Explorer, issue the command assign. Windows will assign any available drive letter automatically to the partition.
  10. Instead, you can execute the command assign letter=<Drive letter> (e.g. assign letter=Z) to make Windows assign a specific drive letter to the partition on your VHD.
    How do I create a VM on a VHDX file?

You are done. The drive is now visible in File Explorer and is ready for use.

How do I create a VM on a VHDX file?

That's it!

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Post navigation

Can I use a VHDX in VMware?

If you want to create a virtual machine using a virtual disk converted from the VHD (VHDX) format to the VMDK format in VMware Workstation, just create a new VM (or open an existing VM if you want to add a converted virtual disk as an additional virtual disk) and select that you wish to use an existing virtual disk.

What is VHDX in virtual machine?

A Hyper V virtual hard disk (VHDX) is a disk image file format used to create a virtual hard disk (VHD) within Windows Server 2012-based virtualization environments. VHDX enables creating and provisioning virtual/logical disk storage space to virtual machines.