How to create and set up a virtual hard disk on Windows 10

On Windows 10, a virtual hard disk (VHDX or VHD) is a file that can use a ".vhdx" or ".vhd" extension and acts like a physical hard drive, but with the difference that this is a file stored on a real disk.

Using either format (.vhdx or .vhd) for a virtual drive, you can store any files, including documents, pictures, videos, boot files, and an entire OS installation. The only differences between the two formats are that a .vhdx file supports a maximum size of 64TB, features resiliency against power failure, and provides better performance.

Typically, a VHD comes in handy to add extra storage to a Hyper-V virtual machine, and thanks to its ability to support other OS installations, you can even use this storage virtualization technology to create a dual-boot system without modifying an existing partition.

In this Windows 10 guide, we'll walk you through the steps to create and set up a virtual hard disk to store files on Windows 10.

How to create a VHDX or VHD on Windows 10

In order to create a VHD on Windows 10, do the following:

  1. Open Start.
  2. Search for Disk Management and click the top result to launch the experience.
  3. Click the Action button.
  4. Click the Create VHD option.

  1. Click the Browse button and locate the folder you want to store the virtual disk.
  2. In the "File name" field enter a name for the drive.
  3. Use the "Save as type file" drop-down menu and select Virtual Disk files (*.vhdx) . Or select Virtual Disk files (*.vhd) if you're planning to create a VHD file.
  4. Click the Save button.

  1. Under "Virtual hard disk size," specify the size of the drive in megabytes (MB), gigabytes (GB), or terabytes (TB).
  2. Under "Virtual hard disk format," select the VHDX option. (While using a VHDX format is recommended, you can also select the VHD format, but use it only if required.)
  3. Under "Virtual hard disk type," select the Dynamic expanding option. (If you have selected the VHD format in the previous step, it's recommended to select the Fixed size option when selecting a type.)

  1. Click OK.

Once you complete these steps, you'll have created a VHD that you can then set up and use with any compatible version of Windows.

How to set up a VHDX or VHD on Windows 10

Using the above steps, you created a VHD, but it's empty without any data or file system. To make it useful, you need to initialize the disk, create a partition, and format the drive using these steps:

  1. Right-click the newly created drive button on the far-left side, and click the Initialize Disk option.

  1. Select the disk from the list.
  2. Check the MBR (Master Boot Record) option. (You could also select the "GPT (GUID Partition Table)" option, but this option isn't supported by all versions of Windows.)
  3. Click OK.

  1. Right-click the Unallocated space, and select the New Simple Volume option.

  1. Click Next.
  2. Specify the size of the partition. (Leave this option unchanged if you're planning to use all the available space for the partition.)
  3. Click Next.

  1. Using the drop-down menu, select the drive letter you want to assign to the drive.
  2. Click Next.

  1. Under the Format this volume with the following settings section, make sure to use the following options:
    • File System - NTFS.
    • Allocation unit size - Default.
    • Volume label - Use the name of the drive file, but you can enter any name.
    • Perform a quick format - Formats the drive faster.
    • Enable file and folder compression - If it's not required, don't select it (optional).
  2. Click Next.

  1. Click Finish.

After completing these steps, the VHDX or VHD will be initialized, partitioned, and formatted. The VHD will mount automatically, and you can now access and save files using File Explorer.

How to mount a VHDX or VHD on Windows 10

Although during the setup process, Windows 10 will automatically mount a VHDX or VHD file to your device, that won't always be the case.

If you're creating a VHD for another device, or you're storing the file on an external hard drive, you'll need to know the steps to properly attach and detach the virtual drive.

Mounting

To mount or attach the virtual hard disk, do the following:

  1. Open Start.
  2. Search for Disk Management and click the top result to launch the experience.
  3. Click the Action button.
  4. Click the Attach VHD option.

  1. Click the Browse button, and locate the .vhdx or .vhd file.
    • Quick Tip: If you are only viewing and extracting files from the drive, you can also check the Read-only option to prevent accidental deletion or temper with the virtual drive's content.

  1. Click OK.

After completing these steps, you can access the VHD like any other drive using File Explorer.

Dismounting

It's important to save any files and applications located in the VHDX or VHD file before dismounting or detaching to prevent data loss.

  1. Open Start.
  2. Search for Disk Management and click the top result to launch the experience.
  3. Right-click the drive button on the far-left side, and select the Detach VHD option.

  1. Ensure you're detaching the correct drive, and then click OK.

Once you complete these steps, the VHDX or VHD file will no longer be mounted, and it'll no longer show up in File Explorer.

While this guide is focused on Windows 10, the ability to use a VHD has been available for some time, and you can use the same instructions on Windows 8.1.

More Windows 10 resources

For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:

Mauro Huculak

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.