locked
vhdx file size after formatting RRS feed

  • Question

  • Hi,

    we are using Windows Server 2012 R2 Hyper-V and installed CentOS5/6.

    So far we recognized that the size of the empty formatted vhdx file is much larger then the vhd-file. Also the filesystem of the CentOS (ext3 vs ext4) seems to play a massive role.

    A 127GB disk size, dynamically expanding

    RedHat 5.9 with ext3 file system
    vhdx file --> 35 GB
    vhd file ---> 2,6 GB

    RedHat 6.5 with ext4 file system
    vhdx --> 2,7 GB
    vhd file --> 270 MB

    RedHat 6.5 with ext3 file system
    vhdx --> 34 GB

    So, why are vhdx files always larger then vhd - files? An why does the virtual hard disk size explode with ext3 and is better with ext4?

    vhdx would be the file format to go, but with that size differnce its not feasable.

    Thanks,

    Thomas





    • Edited by hainzers Tuesday, February 11, 2014 10:40 AM
    Tuesday, February 11, 2014 10:06 AM

Answers

  • ~~

    we are using Windows Server 2012 R2 Hyper-V and installed CentOS5/6.

    So far we recognized that the size of the empty formatted vhdx file is much larger then the vhd-file. Also the filesystem of the CentOS (ext3 vs ext4) seems to play a massive role.

    A 127GB disk size, dynamically expanding

    RedHat 5.9 with ext3 file system
    vhdx file --> 35 GB
    vhd file ---> 2,6 GB

    RedHat 6.5 with ext4 file system
    vhdx --> 2,7 GB
    vhd file --> 270 MB

    RedHat 6.5 with ext3 file system
    vhdx --> 34 GB

    So, why are vhdx files always larger then vhd - files? An why does the virtual hard disk size explode with ext3 and is better with ext4?

    vhdx would be the file format to go, but with that size differnce its not feasable.

    ~

    ~

    https://www.suse.com/releasenotes/x86_64/openSUSE/12.1/

    ==


       Formatting Large Disk Partitions on Windows 8 Server

    Installing a guest hosted on Windows 8 Server may fail when a large virtual disk image (larger than 50 GB) in .vhdx format is assigned to the guest.
    To workaround this issue use either virtual disk images with a fixed size,
    or create the dynamically sized disk image using Powershell.

        
    Technical Background about the Issue
        

    The .vhd and .vhdx images are sparse files. When a dynamic .vhdx is created with a maximum size of 127 GB, the initial size is about 256 KB. Because the default block size for .vhdx files is 32 MB, writing one 512 byte sector will result in a 32 MB section of the sparse file being allocated. When ext3
    is allocating the MBR, the super block, the backup super blocks,
    inodes, directories, etc., space is being allocated in the sparse file.
    Because of ext3's suboptimal IO, how the data structures are laid out on disk, and the default block size, a large partition of the .vhdx file is allocated just by formatting. The workaround is to create a .vhdx file with a 1 MB block size rather than the default 32 MB.

    Changing the block size in the UI is not implemented. It can
    only be changed when the VHDx file is created through Powershell. To
    create a VHD with a modified block size, use this Powershell script (all
    in one line):

    New-VHD -Path C:\MyVHDs\test.vhdx -SizeBytes (127GB)
      -Dynamic -BlockSizeBytes (1MB) -VHDFormat vhdx

      

    ==

    ~

    ~

    ~

    ~

    https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/6.5_Technical_Notes/index.html

    ==

    Red Hat Enterprise Linux 6

    6.5 Technical Notes

      . . .

    6.4. Virtualization

    kernel component

    On Microsoft Windows Server 2012 containing large dynamic VHDX
    (Hyper-V virtual hard disk) files and using the ext3 file system, a call
    trace can appear, and, consequently, it is not possible to shut down
    the guest. To work around this problem, use the ext4 file system or set a
    logical block size of 1MB when creating a VHDX file. Note that this can
    only be done by using Microsoft PowerShell as the Hyper-V manager does
    not expose the –BlockSizeBytes option which has the default value of
    32MB. To create a dynamix VHDX file with an approximate size of 2.5TB
    and 1MB block size run:
    New-VHD –Path .\MyDisk.vhdx –SizeBytes 5120MB –BlockSizeBytes 1MB -Dynamic

    ==

    ~

    ~

    ~

    ~

    And interessant article:

    http://yamanxworld.blogspot.com/2013/01/centos-59-vhdx-ext3.html

    (

      Ja --} En

    http://translate.google.com/translate?hl=en&sl=ja&tl=en&u=http%3A%2F%2Fyamanxworld.blogspot.com%2F2013%2F01%2Fcentos-59-vhdx-ext3.html

    )



    > Awesome, thank you for detailed explanation.

      No problem :-)

    • Marked as answer by hainzers Wednesday, February 12, 2014 3:14 PM
    • Edited by Victor Miasnikov Wednesday, February 12, 2014 3:43 PM
    Wednesday, February 12, 2014 2:00 PM

All replies

  • ~~

    we are using Windows Server 2012 R2 Hyper-V and installed CentOS5/6.

    So far we recognized that the size of the empty formatted vhdx file is much larger then the vhd-file. Also the filesystem of the CentOS (ext3 vs ext4) seems to play a massive role.

    A 127GB disk size, dynamically expanding

    RedHat 5.9 with ext3 file system
    vhdx file --> 35 GB
    vhd file ---> 2,6 GB

    RedHat 6.5 with ext4 file system
    vhdx --> 2,7 GB
    vhd file --> 270 MB

    RedHat 6.5 with ext3 file system
    vhdx --> 34 GB

    So, why are vhdx files always larger then vhd - files? An why does the virtual hard disk size explode with ext3 and is better with ext4?

    vhdx would be the file format to go, but with that size differnce its not feasable.

    ~

    ~

    https://www.suse.com/releasenotes/x86_64/openSUSE/12.1/

    ==


       Formatting Large Disk Partitions on Windows 8 Server

    Installing a guest hosted on Windows 8 Server may fail when a large virtual disk image (larger than 50 GB) in .vhdx format is assigned to the guest.
    To workaround this issue use either virtual disk images with a fixed size,
    or create the dynamically sized disk image using Powershell.

        
    Technical Background about the Issue
        

    The .vhd and .vhdx images are sparse files. When a dynamic .vhdx is created with a maximum size of 127 GB, the initial size is about 256 KB. Because the default block size for .vhdx files is 32 MB, writing one 512 byte sector will result in a 32 MB section of the sparse file being allocated. When ext3
    is allocating the MBR, the super block, the backup super blocks,
    inodes, directories, etc., space is being allocated in the sparse file.
    Because of ext3's suboptimal IO, how the data structures are laid out on disk, and the default block size, a large partition of the .vhdx file is allocated just by formatting. The workaround is to create a .vhdx file with a 1 MB block size rather than the default 32 MB.

    Changing the block size in the UI is not implemented. It can
    only be changed when the VHDx file is created through Powershell. To
    create a VHD with a modified block size, use this Powershell script (all
    in one line):

    New-VHD -Path C:\MyVHDs\test.vhdx -SizeBytes (127GB)
      -Dynamic -BlockSizeBytes (1MB) -VHDFormat vhdx

      

    ==

    ~

    ~

    ~

    ~

    https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/6.5_Technical_Notes/index.html

    ==

    Red Hat Enterprise Linux 6

    6.5 Technical Notes

      . . .

    6.4. Virtualization

    kernel component

    On Microsoft Windows Server 2012 containing large dynamic VHDX
    (Hyper-V virtual hard disk) files and using the ext3 file system, a call
    trace can appear, and, consequently, it is not possible to shut down
    the guest. To work around this problem, use the ext4 file system or set a
    logical block size of 1MB when creating a VHDX file. Note that this can
    only be done by using Microsoft PowerShell as the Hyper-V manager does
    not expose the –BlockSizeBytes option which has the default value of
    32MB. To create a dynamix VHDX file with an approximate size of 2.5TB
    and 1MB block size run:
    New-VHD –Path .\MyDisk.vhdx –SizeBytes 5120MB –BlockSizeBytes 1MB -Dynamic

    ==

    ~

    ~

    ~

    ~

    And interessant article:

    http://yamanxworld.blogspot.com/2013/01/centos-59-vhdx-ext3.html

    (

      Ja --} En

    http://translate.google.com/translate?hl=en&sl=ja&tl=en&u=http%3A%2F%2Fyamanxworld.blogspot.com%2F2013%2F01%2Fcentos-59-vhdx-ext3.html

    )



    > Awesome, thank you for detailed explanation.

      No problem :-)

    • Marked as answer by hainzers Wednesday, February 12, 2014 3:14 PM
    • Edited by Victor Miasnikov Wednesday, February 12, 2014 3:43 PM
    Wednesday, February 12, 2014 2:00 PM
  • Awesome, thank you for detailed explanation.
    Wednesday, February 12, 2014 3:15 PM