Answered by:
vhdx file size after formatting

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 ServerInstalling 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
==
~
~
~
~
Red Hat Enterprise Linux 66.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
> 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 - Technical Background about the Issue
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 ServerInstalling 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
==
~
~
~
~
Red Hat Enterprise Linux 66.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
> 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 - Technical Background about the Issue
-
Awesome, thank you for detailed explanation.Wednesday, February 12, 2014 3:15 PM