A VHD (Virtual Hard Disk) file is a file format that represents a virtual hard disk drive (HDD). VHD files are typically used with virtualization software like Microsoft Hyper-V or Oracle VirtualBox to act as hard drives for virtual machines. There are a few different tools available to create VHD files, depending on your needs.
Quick Answers
The main tools for creating VHD files are:
- Disk Management in Windows
- Hyper-V Manager in Windows
- Disk Utility in macOS
- qemu-img command line tool
- VirtualBox graphical tool
The choice depends on your operating system and whether you need a graphical tool or are comfortable with the command line. VirtualBox and qemu-img work across Windows, Mac, Linux. The Windows and Mac built-in tools are easiest for beginners.
Purpose of VHD Files
Before looking at specific tools, it’s helpful to understand what VHD files are used for.
VHD files aim to virtualize hard disk storage. They provide an image or container file that emulates a physical hard drive. The VHD can then be attached to virtual machines created in virtualization platforms like Hyper-V, VMware, VirtualBox, etc.
This allows virtual machines to access virtualized disk storage space for installing operating systems, applications, and storing data. The end result is VHD files provide an easy way to give virtual machines storage capabilities without needing a physical disk drive directly attached.
Primary Uses of VHD Files
Some of the most common uses of VHD files include:
- Providing storage for virtual machine operating system drives
- Adding virtual disks to virtual machines for data storage
- Migrating physical server storage to virtualized storage
- Running backup images of disks or system clones
- Booting operating systems directly from VHD files
VHD File Tools in Windows
Windows includes some built-in options for creating and managing VHD files.
Disk Management
The Disk Management utility built into Windows provides basic VHD creation capabilities. This tool can be accessed by running “diskmgmt.msc” from the Run dialog or search bar.
In the Disk Management UI, you can right-click in the blank space of the disk list and select “Create VHD”. This launches a wizard that lets you create a new dynamically expanding VHD file by specifying location, size, and format.
Advantages:
- Simple wizard interface
- Built into Windows already
Disadvantages:
- Limited options compared to other tools
- Does not support creating differencing VHDX files
Hyper-V Manager
The Hyper-V Manager tool is another option included in Windows. It provides more advanced creation and management of VHD and VHDX files.
In the Hyper-V Manager, VHD/VHDX files can be created by right clicking on a Hyper-V host or cluster node and selecting “New Hard Disk”.
This provides options to specify VHD type (dynamically expanding, fixed size, differencing), choose between VHD/VHDX format, specify path, and enter desired size.
Advantages:
- Create all types of VHDX files
- Built into Windows as part of Hyper-V role
- Advanced options for splitting and compacting VHDs
Disadvantages:
- Requires Hyper-V role installed
- Not as simple as the Disk Management wizard
VHD Tools in MacOS
MacOS includes built-in utilities for creating and managing VHD files as well.
Disk Utility
The Disk Utility application included with MacOS provides capabilities to create VHD files.
To create a new blank VHD file, click File > New Image > Blank Image. This will launch a dialog window to specify the save location, name, size, encryption options, and format for the VHD image.
Advantages:
- Simple graphical tool built into MacOS
- Option for encryption when creating VHD
Disadvantages:
- Limited to dynamically expanding VHD format
- No options for differencing disks
hdiutil
The hdiutil command line utility included with MacOS also provides some capabilities for creating and managing VHD files.
For example, to create a dynamically expanding VHD file, you can use:
hdiutil create -type UDIF -size 10g -fs HFS+ -volname "name" -uid "user" path/to/file.vhd
Advantages:
- Command line interface provides scripting options
Disadvantages:
- Not as straightforward as a graphical utility
- Limited VHD creation options compared to other tools
Cross-Platform Open Source Tools
There are also open source command line tools that work across Windows, Mac, and Linux for creating/managing VHD files.
qemu-img
The qemu-img tool from the QEMU virtualization project can create VHD files from the command line on any platform.
For example, to create a new 20GB dynamically allocated VHD file:
qemu-img create -f vpc -o dynamic_size=20G path/to/disk.vhd
qemu-img can create many VHD formats like VPC, dynamic/fixed VHDs, differencing disks, etc.
Advantages:
- Cross-platform command line tool
- Support for multiple VHD types
- Scripting capabilities
Disadvantages:
- No graphical interface
- Less user-friendly than native tools
VirtualBox
Oracle VM VirtualBox includes capabilities to create VHD files through its graphical tool as well as VBoxManage command line.
In the VirtualBox Manager GUI, you can create a new VHD via File > Virtual Media Manager. This provides a wizard to set VHD properties and save location.
VBoxManage can do the same from the CLI:
VBoxManage createhd --filename path/to/disk.vhd --size 20000 --format VHD
Advantages:
- Graphical and command line interfaces
- Cross-platform support
Disadvantages:
- Primarily focused on VirtualBox, less flexible than qemu-img
Third Party GUI Tools
There are also various third party tools available for creating/managing VHD files with graphical interfaces.
StarWind V2V Converter
StarWind V2V Converter provides an easy to use GUI for creating VHDs as well as converting between physical machines and VHDs.
It allows creating simple dynamic or fixed VHD files as well as more complex scenarios like cloning existing disks/volumes into VHD files.
Advantages:
- Intuitive graphical interface
- Options for cloning disks and P2V/V2P conversions
Disadvantages:
- Requires downloading and installing separate software
- More focused on conversions vs just VHD creation
WinImage
WinImage is a longtime VHD manipulation tool for Windows with support for creating, editing, and converting VHD files through an easy to use UI.
It provides options to create dynamic, differencing, and fixed VHDs along with tools to explore and edit VHD internals.
Advantages:
- User-friendly Windows GUI
- Advanced VHD editing capabilities
Disadvantages:
- Windows only
- Primarily focused on VHD editing vs creation
Summary
There are a variety of tools available for creating VHD files depending on your needs. Here’s a quick summary:
Tool | Platform | Pros | Cons |
---|---|---|---|
Disk Management | Windows | Simple wizard, built-in tool | Limited features |
Hyper-V Manager | Windows | Create all VHD types | Requires Hyper-V installed |
Disk Utility | MacOS | Built-in MacOS tool | Limited VHD options |
qemu-img | Cross-platform | Robust CLI tool | No GUI |
VirtualBox | Cross-platform | Graphical & CLI interfaces | Primary focus is VirtualBox |
StarWind V2V | Windows | Intuitive GUI | Separate download |
WinImage | Windows | Advanced VHD editing | Windows only |
For simple VHD creation on Windows, Disk Management provides an easy option that comes built-in. On MacOS, Disk Utility allows creating VHDs through a graphical tool.
For power users or scripted uses cases, qemu-img gives you a cross-platform command line tool with tons of flexibility. VirtualBox also provides a combination of GUI and CLI tools for VHD creation and management.
And utilities like StarWind V2V Converter or WinImage give you additional third party graphical tools focused on making VHD creation and manipulation more user-friendly.
Conclusion
VHD files provide versatile, portable virtualized storage for virtual machines. There are built-in tools in Windows and MacOS for basic VHD creation, along with cross-platform open source tools like qemu-img and VirtualBox for power users.
Graphical third party tools can also simplify creating and working with VHDs. Overall there are a good variety of options to fit different needs and skill levels when it comes to generating VHD files.