everything you need to know about

20
VHDX details and file format Mahesh Mankar www.ryussi.com .vhdx

Upload: ryussitech

Post on 07-Aug-2015

159 views

Category:

Software


6 download

TRANSCRIPT

Page 1: Everything you need to know about

VHDX details and file format

Mahesh Mankar

www.ryussi.com

.vhdx

Page 2: Everything you need to know about

Hyper-V VM Hyper-V VM consists following files

Configuration file○ VMGUID.xml

Running memory file ○ VMGUID.bin

Virtual disk file(s)○ VMNAME.vhdx

Page 3: Everything you need to know about

VM files VMGUID.xml

Consists all configuration of VM in xml format...<name type="string">Win8</name><notes type="string"></notes><type_id type="string">Virtual Machines</type_id>...<MacAddress type="string">00-15-5D-01-08-76</MacAddress>...<controller0>

<drive0><pathname type="string">D:\

Win8.vhdx</pathname>...<processors>

<count type="integer">1</count>...

VMGUID.bin Created when machine is running, consiste memory map. Used for save/pause the VM.

Page 4: Everything you need to know about

What is vhdx vhdx is a file format used by Hyper-V ( Server

2012)(Earlier with server 2008, it was .vhd)

This is the file formate used by hypervisor (Windows Hyper-V) and Windows Azure to create virtual disk drive for virtual machines.

Page 5: Everything you need to know about

History The .vhd format was created by Connectix for

Connectix Virtual PC product○ Acquired by Microsoft in 2003

Supported by○ Microsoft Virtual PC○ Microsoft Virtual Server○ Hyper-V○ Oracle VirtualBox○ Sun xVM○ VMware ESX○ VMware Workstation○ Citrix XenServer

.vhdx over .vhd○ From Windows 8 & Server 2012 Microsoft modified vhd format to vhdx

Page 6: Everything you need to know about

Types Fixed size

This type of disk are created with the specified size. Space is allocated at the time of creation

This gives higher performance

500 GB - actual

FixedDisk.vhdx (500 GB)

Page 7: Everything you need to know about

Types Dynamic expanding

Dynamically growing. Space is allocated as required This gives better space management but slower in performance

500 GB - logical

DynamicDisk.vhdx (500 GB)

50 GB -actual

Page 8: Everything you need to know about

Types Differencing

It freezes the parent disk and creates delta disk Used for snapshot purpose

FixedDisk.vhdx (100 GB)

100 GB

DiffDiskA.avhdx (10 GB)

10 GB

DiffDiskAA.avhdx (5 GB)

5 GB

DiffDiskB.vhdx (20 GB)

20 GB

Parent

Parent

Child

Child

Child

Page 9: Everything you need to know about

Features Maximum size supported is 64 TB.

With VHD it is 2 TB

Block size is 4k Improved performance Larger logical sector sizes for a virtual disk up to 4 KB Large block sizes for a virtual disk up to 256 MB that enables tuning block

size to match the IO

Updated metadata structures To prevent data loss during power failures

Page 10: Everything you need to know about

.vhdx file layout.vhdx file logical layout

Page 11: Everything you need to know about

.vhdx file layout

textHeader Log BAT Sector Bitmap Data Metadata

Region Data

Free Space

.vhdx file layout

Page 12: Everything you need to know about

.vhdx file layout Header

1MB -This is first object of file contains following sections ○ File type identifier

Contains a short, fixed signature to identify the file as a VHDX○ Two headers

Acts as a root of the VHDX data structure tree, providing version information, the location and size of the log, and some basic file metadata

Only one header is active at a time

VHDX_HEADERSignature(UINT32) Checksum(UINT32)

SequenceNumber(UINT64)FileWriteGuid(GUID) DataWriteGuid(GUID) LogGuid(GUID)LogVersion(UINT16) Version(UINT16)

LogLength(UINT32)LogOffset(UINT64) Reserved[4016](UINT8)

○ Two region table Lists regions, which are virtually contiguous, variable-size, MB aligned pieces of

data within the file

Header Layout

textFile

IdentifierHeader

1Header

2RegionTable 1

0 KB

64 KB

128 KB

192 KB

256 KB 1MB

Reserved

320 KB

RegionTable 2

Page 13: Everything you need to know about

.vhdx file layout Log

The log is a single circular buffer stored contiguously at a location that is specified in the VHDX header

Consists of variable-sized log entries to be written after unexpected system failure event

Blocks Payload blocks contain virtual disk payload data. Sector bitmap blocks contain parts of the sector bitmap

BAT BAT is a region consisting of a single array of 64-bit values, with an entry

for each block that determines the state and file offset of that block

Metadata Region MetaData table - Mapping to MetaData items MetaData items - User metadata and system metadata

Page 14: Everything you need to know about

API for vhdx C++ API is available to create update .vhdx file. Virtdisk.h, Virtdisk.dll, Virtdisk.lib

Supported from windows 7 onward

Available calls for .vhdx AddVirtualDiskParent AttachVirtualDisk BreakMirrorVirtualDisk CompactVirtualDisk CreateVirtualDisk DeleteVirtualDiskMetadata DetachVirtualDisk EnumerateVirtualDiskMetadata ExpandVirtualDisk GetStorageDependencyInformation GetVirtualDiskInformation GetVirtualDiskMetadata GetVirtualDiskOperationProgress GetVirtualDiskPhysicalPath MergeVirtualDisk MirrorVirtualDisk OpenVirtualDisk ResizeVirtualDisk SetVirtualDiskInformation SetVirtualDiskMetadata

Page 15: Everything you need to know about

VDS - Virtual Disk Service

Manages a wide range of storage configurations From single disk to external storage arrays Exposes an API (Windows Storage Management API)

Page 16: Everything you need to know about

Usability Create new disk Delete disk Expand disk Compact disk Mirror disk Attach disk

Page 17: Everything you need to know about

Comparison Comparison with other virtual disk format

VIRTUAL DISK TYPE VHD VHDX VMDK VDI

BUILT BY Microsoft Microsoft VMware Sun Microsystems

MAX SIZE 2TB 64TB 62TB(2TB before Sep-2013)

2TB

TYPE - FIXED Yes Yes Yes Yes

TYPE - DYNAMIC Yes Yes Yes Yes

TYPE - DIFFERENCING/DELTA Yes Yes Yes No

MULTIPART No No Yes No

Page 18: Everything you need to know about

Get vhdx file information (GetVirtualDiskInformation)

Expand size (ResizeVirtualDisk)

Example

Page 19: Everything you need to know about

Example

Page 20: Everything you need to know about

Thanks Have Questions ? Feel free to reach out to us

at [email protected] !