Faq VHD
Faq VHD
This article provides answers to common questions about Virtual Hard Disks (VHDs) in Windows 7 and
Windows Server 2008 R2.
There are three types of VHDs: fixed, dynamic, and differencing. You can create these files using the
Hyper-V Manager or (in Windows 7) using the Windows disk-management tools.
Type Explanation
Fixed A fixed VHD has an allocated size that does not change. For example, if you
create a fixed VHD that is 2 gigabytes (GB), the file will be approximately 2 GB
(with some space used for the internal VHD structure) regardless of the data
written to it.
Dynamic The size of a dynamic (or expandable) VHD is as large as the data written to it.
As more data is written to a dynamic VHD, the file dynamically increases up to
a maximum size. For example, a 2 GB dynamic VHD is initially around 2
megabytes (MB) on the host file system. As data is written to the VHD, the file
grows with a maximum size of 2 GB.
Differencing A differencing VHD is similar to a dynamic VHD, but contains only the modified
disk blocks of the associated parent VHD. The parent VHD is read-only so you
must modify the differencing VHD. A differencing VHD is sometimes referred to
as a “child” VHD. The file type of the parent VHD can be any of the three VHD
types, including another differencing VHD. Multiple differencing VHDs create a
differencing chain. Note the following requirements for differencing VHDs:
You should not modify the parent of a differencing VHD. If the parent
VHD is changed or replaced by a different VHD (even if it has the same file
name), the block structure between the parent and differencing VHD will no
longer match and the differencing VHD will be corrupted.
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009
Frequently Asked Questions: Virtual Hard Disks in Windows 7 Page 2 of 7
You should keep both files (the parent VHD and the differencing
VHD) on the same volume for native-boot scenarios. For native-boot
VHDs, the parent VHD and the differencing disk cannot reside on different
volumes even if they reside on the same local disk. However, when you
attach a differencing VHD that is not used for native boot (for example, for
image management), the parent VHD can be on a different volume or even
on a remote share. For more information, see the What is a native-boot
VHD? topic later in this topic.
Fixed VHDs are recommended for production instead of dynamic or differencing VHDs for the following
reasons:
The I/O performance is highest for fixed VHDs because the file is not dynamically
expanded. Also write operations to fixed VHD files are not going to fail due to the underlying host
volume of the VHD file runs out of free disk space if a dynamic VHD required expansion.
The file data will not become inconsistent due to lack of storage space or power loss.
Dynamic and differencing VHDs depend on multiple write operations as well as internal block
allocation information. This data may become inconsistent if all I/O operations to the VHD on the
host volume and physical disk are not completed and persisted on the physical disk. This can
happen when the underlying disk runs out of storage space or the computer suddenly loses power.
Microsoft recommends that you use dynamic VHDs in non-production environments where lower
storage requirements and the convenience of replacing the VHD is more of an advantage than the
reliability of accessing the data within the VHD. In addition, testing environments are best for dynamic
VHDs because there will be less impact in the event that you have to rebuild the VHD. Using dynamic
VHDs in a test environment provides the following benefits:
Maximizes disk space because you can use the space that would have been unused if the VHDs
were in a fixed format.
Enables you to transfer VHDs between locations faster. For example, if a dynamic VHD is not
using its maximum size, it will transfer in less time between a network share and a local disk than
a fixed VHD of equivalent maximum size.
Although rare, you may consider using dynamic VHDs in production environments if all of the contents
of the dynamic VHD can be regenerated from other sources, and critical data is stored on other
volumes outside the dynamic VHD.
The disk management tools (the DiskPart command-line tool and the Disk Management console) allow
you to create, attach, and detach VHDs.
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009
Frequently Asked Questions: Virtual Hard Disks in Windows 7 Page 3 of 7
Create . You can create a new VHD of the type and size you specify. When you first create a VHD
it is similar to an uninitialized hard disk. You can then create one or more partitions in the VHD
and format the partition(s) using FAT, ExFAT, or NTFS.
Attach . Attaching a VHD activates the VHD so that it appears on the host computer as a local
disk drive. This is sometimes called “surfacing a VHD” because the VHD is now visible to users. If
the VHD already has a disk partition and file system volume when you attach it, the volume inside
the VHD is assigned a drive letter. The assigned drive letter is then available for use, similar to
what happens when you insert a USB disk drive into a USB connector. All users (not just the
current user) can use the attached VHD in the same way they use other volumes on local physical
disks (depending on security permissions). Furthermore, because you can attach a VHD that is
located on a remote SMB share, you can manage your images remotely.
You must have volume management privilege (which is granted by default only to
administrators) in order to attach a VHD because attaching a VHD is equivalent to bringing a
disk or volume online.
You can only attach a VHD that is located on an NTFS volume. However, if you already
have a VHD, you can place the file on any FAT, ExFAT, NTFS or UDFS volume for storage or
transfer.
You cannot attach a VHD that has been either compressed by NTFS or encrypted
using Encrypting File System on the host volume . However, you can compress or
encrypt the volumes inside the VHD if otherwise supported.
You cannot configure two attached VHDs to be a dynamic disk. A dynamic disk is a
physical disk that you have initialized for dynamic storage and contains dynamic volumes,
such as simple, spanned, striped, mirrored volumes or RAID-5 volumes.
You cannot attach a VHD located on a Network File System (NFS) or File Transfer
Protocol (FTP) . As mentioned above, however, you can attach a VHD that is located on a
SMB share.
You can only attach two nested VHDs. A nested VHD is when you create a VHD within
another VHD. The limit for attaching nested VHDs is two. That is, you can attach a VHD
within another attached VHD, but you cannot attach a third. For example, you have a fixed
VHD on a computer at C:\vhd\ExampleFixed.vhd. Inside the ExampleFixed.vhd, you create a
partition, initialize an NTFS file system volume, and assign the drive letter M: to the volume.
You then create a VHD at M:\vhd\AnestedFixed.vhd. The AnestedFixed.vhd file is called a
nested VHD because it is created on the file system volume inside the first VHD. If you
attach both .vhd files (first C:\vhd\ExampleFixed.vhd and then M:\vhd\AnestedFixed.vhd),
then both N: and M: drives would be available on the computer for users to use.
When you native boot to a VHD, only the file system partitions contained in the
VHD are automatically attached. If there are other VHDs on the physical volume that
were attached during a previous boot, they are not automatically attached.
Detach . Detaching a VHD will stop the VHD from appearing on the host computer.
In Windows 7 and Windows Server 2008 R2 you can configure a VHD for native boot. This means that a
VHD can be used as the running operating system on designated hardware without any other parent
operating system, virtual machine, or hypervisor. Furthermore, with native-boot, you will have full
access to all devices and file system volumes on the physical computer including the volumes inside the
VHD. In contrast, when Windows runs in a virtual machine, only one file system volume in the virtual
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009
Frequently Asked Questions: Virtual Hard Disks in Windows 7 Page 4 of 7
disk (the C: volume) is available to the guest machine unless explicitly shared to the virtual machine.
You can create VHD images of all versions of Windows Server 2008 R2, Windows 7 Enterprise, and
Windows 7 Ultimate.
The VHD must be on a local disk. That is, you cannot boot from a remote share.
When you native boot, file system partitions contained in the VHD are automatically attached and
the virtual volumes are made visible. However note that if there are other VHDs on the physical
volume that were attached during a previous boot cycle, they are not automatically attached.
Native VHD boot supports all three VHD file types: fixed, dynamic, and differencing. When you
native-boot from a dynamic VHD, the VHD is automatically expanded to the maximum size. If the
physical host volume of the VHD file does not have enough free disk space for the maximum size
of the dynamic VHD, the boot process will fail.
For instructions on performing a native boot, see Walkthrough: Deploy a Virtual Hard Disk for Native
Boot (FWLINK).
You should do the following as needed when using VHDs for native boot.
Store all critical data outside VHDs used for native boot. If critical data is stored outside the
VHD that contains the Windows boot image, it will be easier for you to recover the data in the
event the VHD is no longer usable. Note that this recommendation does not apply if your backup
application can recreate VHDs in bare metal restore scenarios.
Use fixed VHDs for production environments. You can native-boot using all three VHD file
types (fixed, dynamic, and differencing) but Microsoft recommends fixed VHDs for production, and
dynamic/differencing VHDs for development and test environments. This recommendation is
because when a dynamic VHD is booted, the file is automatically expanded to its maximum size. If
the physical host volume of the file does not have enough free disk space for the maximum size,
the boot process will fail.
Ensure there is sufficient space on the host volume for paging files (Pagefile.sys). Unlike
with a Hyper-V virtual machine, paging files must be stored on the host volume outside an
attached VHD. This provides better boot performance than if the files were stored inside the VHD.
During a native VHD boot, Windows locates space on the host volume outside the VHD file for a
paging file. If the host volume does not have enough free space for a paging file, Windows will
attempt to find free space on another volume. You should ensure the host volume has enough
space for paging files. Each file can be 2-4 GB (sometimes more) in size, depending on how much
physical RAM memory is configured on the system. Note that when Windows is running in a
Hyper-V virtual machine, a paging file is created inside the VHD because the virtual disk is used as
a normal system volume.
Before copying a VHD to run on a different computer, run Sysprep to generalize the
image. Sysprep updates the device configuration state and prepares the Windows image so that it
can boot on a different computer. Once you run Sysprep, you can copy the VHD to multiple
physical computers or virtual machines for native boot. During the first boot from the VHD,
Windows completes the specialize-configuration pass to detect the hardware devices and initializes
Windows for the first time. For more information about preparing an image for deployment, see
the Windows Setup Configuration Passes topic in the Windows Automated Installation Kit for
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009
Frequently Asked Questions: Virtual Hard Disks in Windows 7 Page 5 of 7
Windows 7 RC [ http://technet.microsoft.com/en-us/library/dd349343(WS.10).aspx ] .
The following scenarios are not supported for native boot using VHDs:
Previous versions of Windows do not support native VHD boot. Windows Vista and
Windows Server 2008 (and previous versions of Windows) do not support native boot. Native boot
from VHD requires significant changes to the operating system and these changes are new in
Windows 7.
Using compressed or encrypted VHDs for native boot is not supported. VHDs that have
been compressed by NTFS or encrypted using Encrypting File System on the host volume are not
supported for native boot.
Configure native VHD boot if the host volume is protected by Bitlocker. You can save a
VHD on a host volume that is BitLocker protected but you cannot use the VHD for native boot or
enable Bitlocker on the volume(s) contained inside a VHD.
Booting to a VHD that is located on a remote share or a USB disk drive. The VHD must be
on a local disk, not on a remote share. Furthermore, you native booting from a USB disk drive is
not supported; however, you can save VHDs to a USB disk drive. The exception to USB boot
support is the Windows Pre-installation Environment (WinPE), which is designed for deployment
and servicing scenarios. However, booting WinPE from a VHD is not supported.
Hibernate functionality is not supported. Native VHD boot is primarily targeted for
deployment scenarios where hibernate is not a critical feature.
Upgrading the operating system from within a VHD. If you boot into a VHD, you cannot
upgrade the Windows version in the VHD to a newer version.
Existing backup and restore software may not support backing up or restoring volumes contained in
attached VHDs. The storage configuration of physical volumes that host VHD files, and volumes that are
available to the system by attached VHDs requires careful planning to correctly backup the data on
these volumes. The schematic below illustrates an example of the relationship of a host (or parent)
volume. The VHD file is located on C:, and the file system volume inside the VHD after the attach
operation is D:. In the example, the host volume has a directory for VHD files. The VHD file,
Example.vhd, contains a Windows 7 image.
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009
Frequently Asked Questions: Virtual Hard Disks in Windows 7 Page 6 of 7
If the VHD file, Example.vhd is not attached, a volume snapshot can backup the host volume, C: and
include the Example.vhd file and other data on the host volume. However, if you attach Example.vhd
then the virtual volume D: will be available. A snapshot of the host volume C: will not correctly backup
the contents of Example.vhd while it is attached. Snapshots of a host volume with attached VHDs will
result in an inconsistent snapshot image of the VHD file and the associated virtual volumes. The VHD
driver does not participate in snapshot creation process. Hardware or software snapshots of a physical
volume with an attached VHD file may result in the VHD file and virtual volumes captured on the
snapshot being in an inconsistent state. During a snapshot, cached data in a virtual volume will not be
flushed to the host volume and hence result in a VHD in an inconsistent state.
Snapshots of a guest volume and the host volume for the VHD file in the same snapshot set are not
supported. Snapshots of a virtual guest volume will fail when the snapshot set includes both the guest
volume and its host volume. This limitation prevents creation of a point in time image for a data set
that includes both a virtual volume and host physical volume.
In order to backup your computer if your backup application is not VHD aware, Microsoft strongly
recommends that you detach any attached VHDs before you initiate the backup operation. This is
because Windows does not provide native support for simultaneously backing up a host volume and
guest VHD volumes at the same time.
In the example above, detach Example.vhd before shadow copying C:. Then copy Example.vhd from
the shadow copy of C: to backup media. If Example.VHD is still attached when C: is shadow copied, the
image of Example.vhd captured on the snapshot of C: may be inconsistent because:
1. The VHD driver did not participate in the snapshot creation causing inconsistent metadata.
2. The file system metadata in volume D: was not flushed to disk due causing inconsistencies when
the volume is mounted from the shadow copy.
You should first detach any attached VHD stored on the host volume, and then back up the host
volume. If the VHDs are not detached, it might result in an inconsistent copy of the VHD in the backup.
By backing up the VHD file in the host volume, the restore process is simple as the VHD is consistent in
the backup. After you restore of the host volume, re-attach the VHD file. If virtual disks are used to
store user data, plan the use of guest volumes carefully due to the limitations associated with creating
snapshots of guest volumes.
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009
Frequently Asked Questions: Virtual Hard Disks in Windows 7 Page 7 of 7
Because you cannot shadow copy both the hosting volume and the VHD volume in the same snapshot,
you should not store any data that must be backed up on the VHD. This allows you to backup all
system data in a single snapshot instead of needing to detach VHDs prior to backup.
In the example above, include volume D: in the snapshot while ensuring that C: is not included in the
snapshot. You can then backup files or directories as desired from the snapshot of D: as you would with
any other volume.
Shadow copy storage space is used to store the change information associated with a snapshot and you
can configure it to be on a volume other than the source volume of the snapshot. However, the shadow
copy storage space for a virtual volume must reside on the same virtual volume. A virtual volume
cannot be used as a target volume for shadow copy storage space of another volume. The virtual
volume can only contain the shadow copy storage space associated with its own snapshots.
See Also
Concepts
Walkthrough: Deploy a Virtual Hard Disk for Native Boot [ http://technet.microsoft.com/en-
us/library/dd744338(WS.10).aspx ]
Add a Native-Boot Virtual Hard Disk to the Boot Menu [ http://technet.microsoft.com/en-
us/library/dd799299(WS.10).aspx ]
Other Resources
What's New in Virtual Hard Disks [ http://technet.microsoft.com/en-us/library/dd440864
(WS.10).aspx ]
Tags:
Community Content
http://technet.microsoft.com/en-us/library/dd440865(printer).aspx 6/23/2009