Presentation is loading. Please wait.

Presentation is loading. Please wait.

Vytautas Traškevičius Software Engineering

Similar presentations


Presentation on theme: "Vytautas Traškevičius Software Engineering"— Presentation transcript:

1 Vytautas Traškevičius Software Engineering
Virtual Hard Disk Vytautas Traškevičius Software Engineering

2 About VHD Virtual Hard Disk (VHD) format is an image format specification Developed by Microsoft but publically available Allows the OS to use individual files in the same way as physical hard disks VHD’s can host native file systems such as NTFS Support standard disk operations Standard file operations

3 About VHD (2) VHD’s can be managed through VHD API as well as through management tools VHD’s can function as boot disks Common in VM use Hypervisors (VM creating and managing software) use VHD API to contain Windows OS image Windows SDK integrates Native VHD support

4

5 Backing store The term backing store is used to refer to the physical file that exists on the actual hard disk. The backing store is represented by a VHD image file.

6 Virtual disk types Fixed
The VHD image file is pre-allocated on the backing store for the maximum size requested Expandable (also known as "dynamic", "dynamically expandable", and "sparse“) The VHD image file uses only as much space on the backing store as needed to store the actual data the virtual disk currently contains.

7 Virtual disk types (2) When creating Expandable virtual disk, the VHD API does not test for free space on the physical disk based on the maximum size requested, therefore it is possible to successfully create a dynamic virtual disk with a maximum size larger than the available physical disk free space. From API function ExpandVirtualDisk documentation: “If the virtual disk is expandable and the host volume does not have enough space for the new size, the ExpandVirtualDisk function can succeed anyway. Future writes to the virtual disk may fail if the host volume runs out of space as the virtual disk expands.”

8 Virtual disk types (3) Differencing
A parent virtual disk is used as the basis of this type, with any subsequent writes written to the virtual disk as differences to the new differencing VHD image file, and the parent VHD image file is not modified. Maximum size of expandable and differencing virtual disks is 2040 GB. VHD’s of any type have a minimum size of 3 MB.

9 VHD API VirtDisk library has a number of functions for creating and managing VHD’s It’s necessary to include header “virtdisk.h” VHD Reference defines VirtDisk functions as well as the Enumerations and Structures provided in those functions’ interfaces

10 Enumerations Structures

11 VHD API Functions There is a number of useful functions in the VirtDisk library All functions take Virtual Disk file handle as a parameter Function CreateVirtualDisk creates a VHD image file, either using default parameters or using custom parameters and an existing virtual disk or physical disk Also sets a pointer to the handle object that represents the newly created virtual disk

12 Other common VHD functions
OpenVirtualDisk Opens a VHD image file for use AttachVirtualDisk Attaches a virtual hard disk (VHD) or CD or DVD image file (ISO) by locating an appropriate VHD provider to accomplish the attachment. ExpandVirtualDisk Increases the size of a fixed or dynamically expandable virtual hard disk (VHD).

13 Further reading samples/tree/master/Samples/Hyper-V/Storage/cpp Some usage samples in Microsoft’s open source repository.


Download ppt "Vytautas Traškevičius Software Engineering"

Similar presentations


Ads by Google