Appendix: Tools and APIs for Virtual Hard Disks
Applies To: Windows 7, Windows Server 2008 R2
This appendix includes information about the tools and APIs that you can use as you work with virtual hard disks (VHDs).
In this topic:
Tools used to maintain VHD images
APIs
Tools used to maintain VHD images
This section describes the tools that you can use to perform common tasks such as creating and configuring VHDs. All of the following tools are included in Windows 7 and Windows Server 2008 R2 except for ImageX.exe and DISM.exe, which are included in the Windows Automated Installation Kit (Windows AIK).
BCDEdit
BCDEdit is a command-line tool that you can use to manage boot configuration data (BCD) stores. When you are configuring a computer to boot from a new VHD, you can use BCDEdit to create and edit BCD stores. For more information, see BCDEdit Command Line Options (https://go.microsoft.com/fwlink/?LinkId=155233).
BCDBoot
BCDBoot is a command-line tool that you can use to manage and create new BCD stores and boot entries. When you are configuring a computer to boot from a new VHD, you use BCDBoot to create a new BCD boot entry. For more information, see BCDBoot Command-Line Options (https://go.microsoft.com/fwlink/?LinkID=155166).
Deployment Image Servicing and Management Tool (DISM)
Deployment Image Servicing and Management (DISM.exe) is a command-line tool that you use to install, configure and update the features and packages in offline Windows images, offline Windows PE images, and VHD images.
For more information about DISM, see:
Walkthrough: Deployment Image Servicing and Management (https://go.microsoft.com/fwlink/?LinkID=155183)
Deployment Image Servicing and Management Technical Reference (https://go.microsoft.com/fwlink/?LinkID=155029)
DiskPart
DiskPart is a text-mode command interpreter that enables you to manage VHDs. DiskPart is included in Windows 7 and Windows Server 2008 R2. You use the following commands to configure VHDs:
Create vdisk. Creates a new VHD. The VHD can be empty or it can contain an image from an existing VHD. The new VHD can also be a differencing disk.
Attach vdisk. Attaches (sometimes referred to as “mounts” or “surfaces”) a VHD and assigns it a drive letter.
Detach vdisk. Detaches (sometimes referred to as “unmounts” or “unsurfaces”) a VHD.
Compact vdisk. Compacts or reduces the size of a VHD. This is useful if you need to reduce the size of a dynamically expanding VHD because these files increase in size as you add files, but they do not automatically reduce in size when you delete files.
Expand vdisk. Expands the maximum size available in a VHD.
Merge vdisk. Merges a differencing disk with its parent disk.
Detail vdisk. Displays information about a VHD, including the path and file name, state, virtual size, physical size, associated disk, whether it is a differencing disk, and the path and file name of the parent.
To start DiskPart, open an elevated Command Prompt window and type Diskpart. For more information, see DiskPart.
Disk Management MMC snap-in
Disk Management supports the following VHD operations:
Create VHDs. Creates a new VHD. The VHD can be empty or it can contain an image from an existing VHD. The new VHD can also be a differencing disk.
Attach VHDs. Attaches (sometimes referred to as “mounts” or “surfaces”) a VHD and assigns it a drive letter.
Detach VHDs. Detaches (sometimes referred to as “unmounts” or “unsurfaces”) a VHD.
To open Disk Management, click Start, type diskmgmt.msc in the Search box, and then press ENTER. For more information, see Disk Management (https://go.microsoft.com/fwlink/?LinkId=204252).
Hyper-V Manager
Hyper-V Manager supports VHD image creation. You can specify the type and size of VHD and install Windows from a CD or DVD, or from an .iso image file. The Hyper-V Manager is only available on computers that are running Windows Server 2008 or Windows Server 2008 R2 with the Hyper-V role installed. For more information about using Hyper-V Manager, see What’s New in Hyper-V (https://go.microsoft.com/fwlink/?LinkId=155234).
ImageX
ImageX is a command-line tool that you can use to capture, modify, and apply file-based disk images for deployment. ImageX works with Windows image (.wim) files (for copying to a network), or it can work with other technologies that use .wim images, such as Windows Setup, Windows Deployment Services, and the System Management Server (SMS) Operating System Feature Deployment Pack. For more information, see What Is ImageX? (https://go.microsoft.com/fwlink/?LinkId=155232).
Sysprep
The System Preparation Tool, or Sysprep, is a tool that is designed for corporate system administrators, OEMs, and others who need to deploy the Windows operating system on multiple computers. After performing the initial setup steps on a single operating system, you can run Sysprep to prepare the sample computer for cloning.
If you want to migrate VHD-based operating system images between physical computers, from physical to virtual environments, or from virtual to physical environments, you must first use Sysprep to prepare the operating system image for migration to another computer. Running Sysprep removes user and computer specific data from the operating system image, which enables you to clone or migrate the operating system image to other computers.
For more information, see the Sysprep Technical Reference (https://go.microsoft.com/fwlink/?LinkID=155027).
Windows Deployment Services
You can deploy VHD images to a physical (not virtual) computer by using Windows Deployment Services. To deploy VHD images, you need to create an image group and add images to it. Then you create an Unattend file and configure the server. After that, you are ready to deploy and image. For more information, see:
Deploying Virtual Hard Disk Images (https://go.microsoft.com/fwlink/?LinkId=146973)
The second scenario in Windows Native VHD Boot Deployment Scenarios (https://go.microsoft.com/fwlink/?LinkId=177538)
APIs
The following are the APIs that apply to VHDs:
Win32 APIs. Windows 7 and Windows Server 2008 R2 support a set of Win32 APIs for use by system components and other software to perform operations on VHDs. All higher level VHD APIs will be wrappers around these Win32 APIs. For more information about the Win32 APIs and data structures supporting VHD operations, see VHD Reference (https://go.microsoft.com/fwlink/?LinkId=155236).
VDS APIs. The Virtual Disk Service (VDS) exposes an API that supports operations on VHDs. For more information about the VDS interfaces, types, and data structures, see VDS Reference (https://go.microsoft.com/fwlink/?LinkId=155237).
Remote VHD management interfaces
VDS. Virtual Disk Service (VDS) provides an object model that supports DCOM as a remote communication transport. It enables remote invocation of VDS interfaces and management of VDS objects. For more information about the VDS object model and remote communication with DCOM, see Transport 2.1 (https://go.microsoft.com/fwlink/?LinkId=155238).
Hyper-V WMI provider. WMI supports remote access to management interfaces that are exposed by a WMI provider. The Hyper-V WMI provider supports remoting of VHD interfaces and operations to enable remote management of VHDs on computers with the Hyper-V WMI provider installed (the Hyper-V server role is required). For more information, see Virtualization WMI Provider (https://go.microsoft.com/fwlink/?LinkId=155629).