A bit about VHDs
Virtual hard disk or VHD is a way to provide storage medium for virtual machines, which is represented as a disk image in file format. Operating system for virtual machine is installed in VHD for it to store data within. VHDs can be of two types.
1. Fixed size
2. Dynamic size
Getting to know VHDX:
Windows server 2012 has introduced new Virtual hard drive file format named as VHDX for Hyper-V 3.0, which eliminates limitations posed by earlier VHD format. VHDX offers benefits like better performance, reliability and enhanced storage capacity. A VHDX file is divided in 3 sections.
1. Fixed size header
2. Non-overlapping objects
3. Free spaces
Header is always at the start of VHDX image, whereas the objects and free space are intermixed randomly.
All objects are 1MB aligned, named as BAT (Block allocation table), metadata, header, log, payload block and sector bitmap block. VHDX supports 3 types of disks
1. Fixed size
2. Dynamic size
3. Differential size
Header –
Header sector is examined first when VHDX file is opened. It is 1MB in size and divided in five sub-sections, each of 64 KB.
Log –
1MB aligned, variable sized, continuous ring buffer located anywhere after header section. Any update to object is logged except for header and payload object. This is to ensure safe updates to objects in occasions of system/power failure events.
BAT (Block Allocation Table) –
Stores state and physical file offset for each block. Payload blocks and sector bitmaps are stored in BAT at regular interval.
Metadata Region –
Infrequently accessed region, consumes less space and stores user and system metadata information. Update to metadata is logged to protect it from corruption.
Benefits of VHDX over VHD
Factor | VHDX | VHD |
Logical sector size | 4 KB | 512 Bytes |
Virtual disk size (Storage capacity) |
64 TB | 2 TB |
Shrinkable (trimming the physical size of dynamic VHDX files) |
Supported | Not supported |
Resiliency | yes | No |
Memory alignment | 1 MB | 512 byte |
Block size | Up to 256MB | Tested up to 4MB |
Important features supported in VHDX
1. Advantages of 4KB sector size –
Increasing sector size helps in improving performance, reliability and greater storage capacity. VHDX supports sector size of 4KB offering various benefits, and aligns well with industry moving towards 4KB physical sector size for HDDs. Key pointers:
a) Helps to map data structure read/write operation directly to one sector read/write on HDD.
b) Between two adjacent sectors small amount of space is used to store private information about corresponding sector. This information is used to detect and correct errors within each sector.
c) In case of disk having sector size as 512 bytes, it needs to perform 8 read/writes for single 4KB data structure read/write operation received from file system/application, whereas for 4KB disk sector size single read/write operation should help.
d) Writing data on multiple sectors of 512 bytes takes more time as data has to be read first, then modify the data followed by write it back to disk. So performance impact is seen more in write operation than read. Effectively both read/write operations have degraded performance for smaller sector size.
2.Support Larger Block size –
VHDX supports block size up to 256MB. This helps to improve the performance by matching the block size of the IO pattern from application. Choosing right block size helps to reduce the number of physical sectors read to retrieve the required data.
To Read –
• Small rows and random data access, use smaller block size
• Small rows and sequential data access use larger block
• Small rows and mixed data access, probably larger data block is effective
• Larger rows and larger objects (LOB) choose larger block size.
To Write –
• Choose appropriate values for INITRANS, MAXTRANS, and FREELISTS when using a larger block size. Block size of 8KB generally effective for most of the systems that process larger number of transactions.
3.Ability to shrink volume –
Using UNMAP/TRIM command application/System communicates to a disk that a certain sector or range of sectors are currently not in use and can be freed. This is useful for thin provisioned volumes.
TRIM and UNMAP both perform similar operations but on different set of disks. TRIM is defined in T13 specification which is for ATA devices and UNMAP is defined in T10 specification which is for SCSI devices. These commands are generally used for SSD drives or storage array as SSDs.
Blocks that need editing are written to some free place and existing block handed for garbage collection. Only over written sectors are marked as dirty and handed for garbage collection but sectors which are not over written and not in use still consume space unless UNMAP/TRIM operations are performed.
4.Resiliency
Logging mechanism provided for VHDX helps to handle corruptions that can occur in the event of system or power failure. After an unplanned power/system restore log entries helps to rewrite valid data to VHDX. This helps to protect file from corruptions.
VHDX, hence, seems to be giving a serious competition to 5.0 VMDK owing to the features it offers. It will not be too late when VMWare would want to step-up with a competitive strategy to safeguard its market share.
Write to us at marketing@calsoftinc.com
Contributed by: Jitendra Sayanekar | Calsoft Inc.