locked
Hyper-V - Fixed Size Functionality of the Dynamically Expanding VHD in Windows 2012 RRS feed

  • Question

  • Hi there!

    It's always recommended using the fixed size VHDs and avoiding the dynamically expanding VHDs in production. I have a question related to the following scenario for Windows 2012:

        • Create dynamically expending VHD which size is 30 GB and attach it to the VM.
        • From within the VM copy a payload file which has size of approximately 5.8 GB to that VHD. This will increase the physical size of the VHD to let's say 6 GB.
        • Delete that payload file and defragment or format the VHD file from within the VM, but do not compress the VHD from the Hyper-V Manager Console.
        • Install the software which consumes 4 GB of space on that VHD file.
        • It is possible to run defrag on the volume with VHD periodically, if needed.
        • No increase of space consumption by the software beyond 5 GB is expected.

    My questions are:

    1. Will the above mentioned operations provide approximately the same performance as if the VHD would be originally setup as a fixed size VHD?
    2. Is algorythm of how data is written to the VHD referenced somewhere (for Windows 2008/R2 or 2012)?

    Many thanks in advance for your help!

    Jenn


    • Edited by Jennifer2B2 Tuesday, October 9, 2012 7:04 PM
    Tuesday, October 9, 2012 6:51 PM

Answers

  • Hi,

    Fixed VHDs are recommended for production instead of dynamically expanding or differencing VHDs for the following reasons:

    • The I/O performance is highest for fixed VHDs because the file is not dynamically expanded.
    • When a dynamically expanding disk is expanded, the host volume could run out of space and cause the write operations to fail. Using fixed VHDs ensures this does not happen.
    • The file data will not become inconsistent due to lack of storage space or power loss. Dynamically expanding and differencing VHDs depend on multiple write operations to expand the file. The internal block allocation information can become inconsistent if all I/O operations to the VHD file and the host volume are not complete and persisted on the physical disk. This can happen if the computer suddenly loses power.

    Dynamically expanding VHDs are useful in nonproduction environments where flexible storage requirements and frequently changing the VHD image is more of an advantage than the reliability of the data within the VHD. In addition, dynamically expanding VHDs are best for testing environments because there is less impact if you have to rebuild the VHD.

    Using dynamically expanding VHDs in a test environment provides the following benefits:

    • Flexible use of disk space. You can use free space for the VHD to expand during native VHD boot. This space would have been unavailable if the volume hosted multiple VHDs in a fixed format.
    • Faster transfer time when copying VHDs between locations. The file size for a dynamically expanding VHD that is not using its maximum capacity, 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 dynamically expanding VHDs in production environments if 1) all of the content of the dynamically expanding VHD can be regenerated from other sources and 2) critical data is stored on volumes outside the dynamically expanding VHD.

    Your mentioned operation may provide approximately system performance with a fixed VHD, but it seems complex and cost lots of work. Its result is increase the risk of system failure and data loss. It’s not recommended to implement that in production environment.

    For more information please refer to following MS articles:

    Frequently Asked Questions: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2
    http://technet.microsoft.com/en-us/library/dd440865(v=WS.10).aspx
    Avoid Using Dynamically Expanding VHD Files in a Production Environment
    http://technet.microsoft.com/en-us/magazine/ff458359.aspx
    Hyper- V Dynamic Expanding or Fixed Size VHD?
    http://blogs.technet.com/b/mghazai/archive/2009/09/04/hyper-v-dynamic-expanding-or-fixed-size-vhd.aspx

    Lawrence

    TechNet Community Support

    • Marked as answer by Jennifer2B2 Wednesday, October 10, 2012 12:58 PM
    Wednesday, October 10, 2012 7:26 AM
  • The performance is a little bit impacted when the VHD is increasing; if you copy or make operations that does not require the VHD to increase the performance is the kinda the same as a fixed one.

    Hyper-V and VHD Performance - Dynamic vs. Fixed

    http://blogs.technet.com/b/winserverperformance/archive/2008/09/19/hyper-v-and-vhd-performance-dynamic-vs-fixed.aspx


    Adrian Costea - MCP, MCTS, MCSA 2003, MCITP: Windows 7

    My Blog: www.vkernel.ro/blog

    • Marked as answer by Jennifer2B2 Wednesday, October 10, 2012 12:58 PM
    Wednesday, October 10, 2012 7:26 AM

All replies

  • Hi,

    Fixed VHDs are recommended for production instead of dynamically expanding or differencing VHDs for the following reasons:

    • The I/O performance is highest for fixed VHDs because the file is not dynamically expanded.
    • When a dynamically expanding disk is expanded, the host volume could run out of space and cause the write operations to fail. Using fixed VHDs ensures this does not happen.
    • The file data will not become inconsistent due to lack of storage space or power loss. Dynamically expanding and differencing VHDs depend on multiple write operations to expand the file. The internal block allocation information can become inconsistent if all I/O operations to the VHD file and the host volume are not complete and persisted on the physical disk. This can happen if the computer suddenly loses power.

    Dynamically expanding VHDs are useful in nonproduction environments where flexible storage requirements and frequently changing the VHD image is more of an advantage than the reliability of the data within the VHD. In addition, dynamically expanding VHDs are best for testing environments because there is less impact if you have to rebuild the VHD.

    Using dynamically expanding VHDs in a test environment provides the following benefits:

    • Flexible use of disk space. You can use free space for the VHD to expand during native VHD boot. This space would have been unavailable if the volume hosted multiple VHDs in a fixed format.
    • Faster transfer time when copying VHDs between locations. The file size for a dynamically expanding VHD that is not using its maximum capacity, 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 dynamically expanding VHDs in production environments if 1) all of the content of the dynamically expanding VHD can be regenerated from other sources and 2) critical data is stored on volumes outside the dynamically expanding VHD.

    Your mentioned operation may provide approximately system performance with a fixed VHD, but it seems complex and cost lots of work. Its result is increase the risk of system failure and data loss. It’s not recommended to implement that in production environment.

    For more information please refer to following MS articles:

    Frequently Asked Questions: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2
    http://technet.microsoft.com/en-us/library/dd440865(v=WS.10).aspx
    Avoid Using Dynamically Expanding VHD Files in a Production Environment
    http://technet.microsoft.com/en-us/magazine/ff458359.aspx
    Hyper- V Dynamic Expanding or Fixed Size VHD?
    http://blogs.technet.com/b/mghazai/archive/2009/09/04/hyper-v-dynamic-expanding-or-fixed-size-vhd.aspx

    Lawrence

    TechNet Community Support

    • Marked as answer by Jennifer2B2 Wednesday, October 10, 2012 12:58 PM
    Wednesday, October 10, 2012 7:26 AM
  • The performance is a little bit impacted when the VHD is increasing; if you copy or make operations that does not require the VHD to increase the performance is the kinda the same as a fixed one.

    Hyper-V and VHD Performance - Dynamic vs. Fixed

    http://blogs.technet.com/b/winserverperformance/archive/2008/09/19/hyper-v-and-vhd-performance-dynamic-vs-fixed.aspx


    Adrian Costea - MCP, MCTS, MCSA 2003, MCITP: Windows 7

    My Blog: www.vkernel.ro/blog

    • Marked as answer by Jennifer2B2 Wednesday, October 10, 2012 12:58 PM
    Wednesday, October 10, 2012 7:26 AM