VMFS Recovery™
Recover data from damaged or formatted VMFS disks or VMDK files
Recover data from damaged or formatted VMFS disks or VMDK files
Last updated: Jan 31, 2024

How to create a virtual hard disk on Windows 10

Creating a Virtual Hard Disk (VHD) on Windows is a powerful way to simulate a physical disk drive within your computer, allowing you to manage files, install operating systems, or perform disk operations without affecting your physical hardware. This capability is particularly useful for IT professionals, developers, and enthusiasts looking to test configurations, software, or system setups in a secure, isolated environment. This guide will walk you through the step-by-step process of creating a VHD on Windows, covering everything from the initial setup to configuring and managing your virtual disk. Whether you're looking to expand your technical skills or need a virtual environment for testing, this article will provide you with the knowledge and tools to successfully create and manage a VHD on a Windows system.

What Is Virtual Drive in Windows 10

In Windows 10, a Virtual Drive refers to a digital emulation of a physical disk drive. Unlike a physical hard drive that is tangible and occupies physical space, a virtual drive exists purely as a file on your system but behaves like a physical disk. This virtual disk can be a Virtual Hard Disk (VHD) or a Virtual Machine Disk (VMDK), among other formats, depending on the software used to create it.

A virtual drive allows you to mount disk images (such as ISO files), creating a "drive" that your system treats as if it were a real, physical disk. This feature is particularly useful for running different operating systems, testing software in isolated environments, backing up your system, or managing disk images without needing additional hardware.

Windows 10 includes built-in support for mounting, creating, and managing virtual drives through the Disk Management tool and PowerShell commands. For instance, you can mount an ISO file directly in File Explorer by double-clicking it, creating a virtual drive that allows you to access its contents as if you had inserted a physical disc into a disc drive. Similarly, you can use Disk Management or PowerShell to create and attach VHD files, which appear as new drive letters in File Explorer, enabling you to interact with them like any other disk drive.

This functionality enhances flexibility and convenience for users who need to access or test software, operating systems, and data stored in disk images without the need for additional physical drives, making it an invaluable tool for developers, IT professionals, and general users alike.

What Does the Virtual Drive Do

A Virtual Drive in a computer system emulates the functionality of a physical hard drive but exists entirely in software. It acts as a real disk drive from the perspective of both the operating system and the applications running on it, despite being just a file or set of files on your actual physical storage. Here are the key functionalities and advantages of using a virtual drive:

  • Disk Image Mounting: It allows you to mount disk images, such as ISO, BIN, or VHD files, making them accessible as if they were physical discs inserted into a computer. This is particularly useful for accessing the contents of software installations, system backups, or multimedia files without needing to burn them onto a physical medium.
  • Operating System Installation and Testing: Virtual drives enable the installation and running of different operating systems in a sandboxed environment. This is useful for software development, testing applications across different OS versions, or running applications that are only compatible with certain operating systems without having to partition your physical drive.
  • Software Testing and Sandboxing: By creating a virtual environment, developers and testers can run and test software in a controlled space that does not affect the main operating system or storage. This helps in ensuring that any potential software bugs or malfunctions do not compromise the integrity of the primary system.
  • Backup and Recovery: Virtual drives can be used to create snapshots or backups of your current system state, which can be quickly restored. This is invaluable for recovery purposes, as it allows you to return to a previous state without reinstalling the operating system or applications.
  • Disk Space Management: They allow for dynamic resizing and management of disk space. Unlike physical disks, where you are limited by the actual hardware capacity, virtual disks can be expanded or shrunk based on the requirements, providing more flexibility in managing storage resources.
  • Portability and Convenience: Virtual drives and the images they contain can be easily transferred between different machines or systems. This portability ensures that users can access their software, operating systems, or data without being tied to a single physical machine.
  • Performance Testing: They are used for performance testing under controlled conditions. By simulating different disk types or configurations, users can understand how applications perform under various storage conditions without the need for multiple physical drives.

How does a virtual hard drive work?

A Virtual Hard Drive (VHD) operates by simulating the functionality of a physical hard disk drive within a computer system, but it does so entirely within software. Here's an overview of how VHDs work:

Creation and Storage

  • File-Based Representation: A VHD is essentially a file or set of files that reside on a physical storage device, like an SSD or HDD. This file encapsulates the entire structure of a virtual disk, including the boot record, filesystem, files, and folders, mimicking the structure of a physical hard disk.
  • Dynamic or Fixed Size: When creating a VHD, you can choose between a dynamically expanding disk, which grows as data is added, or a fixed-size disk, which allocates all the designated space immediately. This flexibility allows for efficient storage management based on the user's needs.

Integration with the Host System

  • Mounting: The VHD file can be mounted by the operating system, making the virtual disk accessible as if it were a physical drive. Once mounted, it receives a drive letter, and users can interact with it—reading from and writing to it—using standard file operations.
  • Isolation: Despite being accessible from the host system, the contents and operations within a VHD are isolated from the host's physical disks. This isolation ensures that actions within the VHD do not directly affect the host system's data or operation, making VHDs ideal for testing applications or running separate operating systems.

Operation

  • File System Compatibility: Inside the VHD, a file system is maintained (such as NTFS for Windows), allowing software and operating systems within the VHD to operate as if they were on a physical disk. This includes executing programs, saving files, and performing disk operations.
  • Snapshot and Backup: Some virtualization platforms offer the ability to take snapshots of VHDs, capturing the exact state of the virtual disk at a specific point in time. This is particularly useful for backup and recovery purposes, as well as for testing different configurations or software states.

Virtualization Platforms

  • Hypervisors and Virtual Machines: VHDs are commonly used by virtualization software (like Microsoft Hyper-V, VMware, or VirtualBox) to create and run virtual machines (VMs). Each VM can use one or more VHDs as its storage, allowing for multiple, independent virtual systems to run on a single physical host.

Performance

  • Dependent on Physical Storage: While a VHD is virtual, its performance is still dependent on the underlying physical storage device's capabilities. Operations within a VHD can be slower than those on a direct physical disk due to the additional layer of abstraction and file system overhead.

In essence, a VHD functions by creating a virtual abstraction layer over physical storage, offering flexibility, safety, and isolation for various computing needs without requiring additional physical hardware. This technology enables diverse applications, from software testing and development to data portability and disaster recovery strategies.

Create a virtual hard disk (VHD or VHDX file) in Disk Management

Creating a Virtual Hard Disk (VHD or VHDX) in Windows using Disk Management is a straightforward process. Below are the steps to guide you through the creation of a new VHD or VHDX file:

Step 1: Open Disk Management

  • Method 1: Press Windows + X and select "Disk Management" from the menu.
  • Method 2: Press Windows + R to open the Run dialog, type diskmgmt.msc, and press Enter.

Step 2: Initialize the Creation Process

  • In the Disk Management window, go to the "Action" menu and select "Create VHD". This opens the Create and Attach Virtual Hard Disk dialog box.

Step 3: Specify VHD/VHDX Location and Size

  • Location: Click "Browse" to choose where you want to save the VHD/VHDX file. Enter a file name for your virtual disk and select a location on your computer.
  • Size: Enter the virtual disk size. You can specify the size in megabytes (MB), gigabytes (GB), or terabytes (TB). Remember, 1 GB = 1024 MB, 1 TB = 1024 GB.

Step 4: Choose the Disk Format

  • VHD vs. VHDX: Choose VHD for compatibility with older systems or VHDX for newer systems that support larger disk sizes (up to 64 TB) and have additional features, like protection against data corruption during power failures.
  • Dynamically Expanding vs. Fixed Size:
    • Dynamically expanding: The file grows as data is added to the VHD/VHDX, up to the maximum size you set.
    • Fixed size: Allocates all the space you specify for the virtual disk immediately, which can improve performance but takes more physical disk space right away.

Step 5: Create the Virtual Disk

  • After setting your preferences, click "OK" to create the virtual disk. Disk Management will create the VHD/VHDX file at the specified location and attach it.

Step 6: Initialize the Virtual Disk

  • Once the VHD/VHDX is created, you'll see it in Disk Management as an uninitialized disk. Right-click on the disk area (where it says "Unknown" and "Not Initialized") and select "Initialize Disk".
  • Choose the partition style: MBR (Master Boot Record) for compatibility with older systems or GPT (GUID Partition Table) for newer systems that support larger drives.
  • Click "OK" to initialize the virtual disk.

Step 7: Create a Volume

  • Right-click on the unallocated space of your new virtual disk and select "New Simple Volume".
  • Follow the New Simple Volume Wizard to specify the volume size, assign a drive letter, and format the volume with a file system (e.g., NTFS).
  • Complete the wizard and wait for the format process to finish.

Your VHD/VHDX file is now ready to use, acting as a real disk drive where you can store files, install software, or perform other disk operations.

Create a virtual hard disk (VHD or VHDX file) in Hyper-V Manager

Creating a Virtual Hard Disk (VHD or VHDX) using Hyper-V Manager in Windows involves a series of steps that allow you to set up a new virtual disk for use with virtual machines. Here's how to do it:

Prerequisites

Ensure that Hyper-V is enabled on your Windows system. Hyper-V is available on Windows 10 Pro, Enterprise, and Education editions, as well as on Windows Server versions.

Step 1: Open Hyper-V Manager

  • You can access Hyper-V Manager by typing "Hyper-V Manager" in the Start menu search bar and selecting it from the results.

Step 2: Access the Hyper-V Host

  • In the Hyper-V Manager, in the left pane, select the Hyper-V host (your computer) to manage. If you haven’t added a server, you might need to connect to one by right-clicking on "Hyper-V Manager" in the left pane and selecting "Connect to Server".

Step 3: Open the New Virtual Hard Disk Wizard

  • In the right pane, under the "Actions" section, click on "New" and then select "Hard Disk" to open the New Virtual Hard Disk Wizard.

Step 4: Choose the Disk Format

  • Choose Disk Format: On the "Choose Disk Format" page, select either VHD for compatibility with older systems or VHDX for newer systems that support larger sizes and have improved performance and resilience features. Click "Next" to continue.

Step 5: Choose the Disk Type

  • Select Disk Type: You have the option to create a dynamically expanding disk, a fixed size disk, or a differencing disk. A dynamically expanding disk starts small and grows as data is added (up to the maximum size you set), a fixed size disk allocates all the specified space immediately, and a differencing disk is a type of dynamically expanding disk that stores changes in relation to another disk. Choose the appropriate option and click "Next".

Step 6: Specify Name and Location

  • Specify Name and Location: Enter a name for your VHD/VHDX file and choose a location to store it. It’s a good practice to store virtual disks in a location with ample space. Click "Next" to proceed.

Step 7: Configure Disk

  • Specify the Disk Size: Enter the size for your new virtual hard disk. You can allocate the size in gigabytes (GB) or terabytes (TB), depending on your needs. For a dynamically expanding or differencing disk, this size is the maximum size the disk can grow to.
  • For a Differencing Disk: If you chose to create a differencing disk, you would also need to specify the parent disk.

Step 8: Complete the Wizard

  • Review your settings in the summary page, and if everything looks correct, click "Finish" to create the virtual hard disk.

Using the Virtual Hard Disk

After creating the VHD or VHDX file, you can attach it to a virtual machine by editing the VM's settings in Hyper-V Manager. Go to the "Settings" of the VM, add a hard drive under the SCSI Controller or IDE Controller, and then select the virtual hard disk you created.

This virtual hard disk can now be used by the virtual machine for storage, operating system installation, or other purposes, just like a physical hard disk.

Create a virtual hard disk (VHD or VHDX file) in PowerShell

Creating a Virtual Hard Disk (VHD or VHDX) using PowerShell is a powerful and flexible method that allows for automation and scripting. Here's how you can create a new VHD or VHDX file using PowerShell commands:

Step 1: Open PowerShell

  • As Administrator: Right-click the Start button, select "Windows PowerShell (Admin)" or "Windows Terminal (Admin)" to run PowerShell with administrator privileges.

Step 2: Use the New-VHD Command

PowerShell provides the New-VHD cmdlet to create virtual hard disks. Here’s the basic syntax and an example for creating both VHD and VHDX files:

Basic Syntax

powershell
New-VHD -Path -SizeBytes [-Dynamic | -Fixed | -Differencing]
  • -Path: The location and name of the VHD/VHDX file you want to create.
  • -SizeBytes: The maximum size of the VHD/VHDX file. You can specify the size in bytes, or use KB, MB, GB, or TB suffixes for convenience.
  • -Dynamic, -Fixed, -Differencing: Specifies the type of disk to create. If not specified, the disk will be dynamic by default.

Example: Create a Dynamic VHD

powershell
New-VHD -Path "C:\VirtualDisks\MyVirtualDisk.vhd" -SizeBytes 40GB

Example: Create a Fixed VHDX

powershell
New-VHD -Path "C:\VirtualDisks\MyVirtualDisk.vhdx" -SizeBytes 100GB -Fixed

Step 3: Verify the Creation (Optional)

After creating the VHD or VHDX file, you might want to verify that it was created successfully and check its properties. Use the Get-VHD cmdlet to retrieve information about the virtual disk:

powershell
Get-VHD -Path "C:\VirtualDisks\MyVirtualDisk.vhdx"

This command will display information about the virtual disk, including its size, type, and path.

Additional Tips

  • Running Scripts: If you're running a script or commands from a script file, ensure that your PowerShell session has the appropriate permissions to execute scripts (Set-ExecutionPolicy cmdlet might be needed).
  • Automating Disk Creation: PowerShell scripts can be used to automate the creation of multiple VHD/VHDX files, making it a powerful tool for managing virtual environments.

Creating VHD or VHDX files via PowerShell is an efficient way to handle virtual disk creation, especially when managing multiple virtual environments or automating setup processes.

Create a virtual hard disk (VHD or VHDX file) in Command Prompt

Creating a Virtual Hard Disk (VHD or VHDX) using the Command Prompt in Windows involves using the diskpart utility, a powerful command-line tool for managing disk partitions and volumes. Here's how you can create a new VHD or VHDX file using diskpart:

Step 1: Open Command Prompt as Administrator

  • Right-click the Start button and select "Command Prompt (Admin)" or "Windows Terminal (Admin)" to run the Command Prompt with administrator privileges. If "Command Prompt" is not directly listed, you might need to select "Windows PowerShell (Admin)" or use the Windows Terminal and then switch to the Command Prompt profile.

Step 2: Start DiskPart

  • At the Command Prompt, type diskpart and press Enter. This will start the diskpart utility.

Step 3: Create the VHD or VHDX

Within diskpart, you'll use the create vdisk command to create your virtual disk. Here are the commands step by step:

To Create a VHD:

cmd
create vdisk file="C:\path\to\your\newVHD.vhd" maximum=10000 type=fixed
  • Replace "C:\path\to\your\newVHD.vhd" with the path and file name where you want to save the VHD.
  • Change maximum=10000 to your desired size in megabytes. For example, 10000 for 10GB.
  • Use type=fixed for a fixed disk or type=expandable for a dynamically expanding disk.

To Create a VHDX:

cmd
create vdisk file="C:\path\to\your\newVHDX.vhdx" maximum=10000 type=fixed
  • The process is the same as for VHD, but ensure your file extension is .vhdx for the VHDX format, which supports larger disk sizes and is more resilient to power failure issues.

Step 4: Exit DiskPart

After creating your virtual disk, type exit to leave the diskpart utility.

Step 5: Attach the VHD/VHDX (Optional)

If you immediately need to use the newly created VHD or VHDX, you can attach it using diskpart by following these additional steps:

  1. Start diskpart again.
  2. Type select vdisk file="C:\path\to\your\newVHD.vhd" to select your VHD/VHDX file.
  3. Type attach vdisk to attach the virtual disk to your system.

Notes

  • The diskpart utility is very powerful and can make significant changes to your system's disks. Be cautious and ensure you're entering commands correctly.
  • Creating a VHD/VHDX via Command Prompt provides a scriptable and automatable approach to managing virtual disks, suitable for integration into batch files or automated deployment scripts.

This method gives you a quick way to create a virtual disk directly from the Command Prompt, leveraging Windows' built-in disk management capabilities.

How to mount a virtual hard disk (VHD or VHDX file) on Windows 10

Mounting a Virtual Hard Disk (VHD or VHDX file) on Windows 10 using DiskInternals VMFS Recovery involves a series of steps aimed at accessing the contents of the VHD/VHDX within the Windows environment. DiskInternals VMFS Recovery is a specialized software designed for recovering data from VMFS, VMDK, VHD, and VHDX files, typically used in VMware, Microsoft Hyper-V, and other virtualization software. Here's how you can mount a VHD or VHDX file using this tool:

Step 1: Install DiskInternals VMFS Recovery

  • Install the software on your Windows 10 computer by following the installation wizard.

Step 2: Launch DiskInternals VMFS Recovery

  • Open DiskInternals VMFS Recovery from your Start menu or desktop shortcut.
  • You may need administrative privileges to run the software properly.

Step 3: Locate the VHD/VHDX File

  • Once the software is open, navigate through its interface to locate the option for opening or mounting VHD/VHDX files. DiskInternals VMFS Recovery may categorize this under recovery or mounting options.
  • Use the built-in file browser within the application to navigate to the location of your VHD or VHDX file.

Step 4: Mount the VHD/VHDX File

  • Select the VHD/VHDX file you wish to mount and proceed with the option to mount or open the file. The specific steps may vary depending on the version of DiskInternals VMFS Recovery you are using, so look for buttons or menu options like "Mount," "Open," or "Recover."

Step 5: Access the Mounted VHD/VHDX Contents

  • After successfully mounting the VHD/VHDX file, DiskInternals VMFS Recovery will allow you to browse its contents. You can view, extract, and recover files from the virtual disk using the software's interface.
  • If you're performing data recovery, follow the on-screen instructions to recover data from the virtual disk.

Step 6: Unmount the VHD/VHDX File (Optional)

  • Once you are done working with the mounted VHD/VHDX file, it's a good practice to properly unmount it through DiskInternals VMFS Recovery. Look for an option to safely "Eject," "Unmount," or "Close" the virtual disk within the software.

Additional Notes

  • DiskInternals VMFS Recovery is designed for data recovery purposes, making it a great tool for accessing and recovering data from VHD and VHDX files that are not easily accessible through standard means.
  • For regular mounting and unmounting of VHD/VHDX files for everyday use, Windows 10's built-in Disk Management tool or PowerShell commands might offer a more straightforward approach.
  • Always ensure you have backups of your VHD/VHDX files before performing recovery operations, to avoid accidental data loss.

This guide outlines the basic steps for mounting a VHD/VHDX file using DiskInternals VMFS Recovery. The exact steps may vary slightly based on the software version and the specific configuration of your system.

Related articles

FREE DOWNLOADVer 4.19, WinBUY NOWFrom $699

Please rate this article.