virtdisk

package
v0.32.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for windows/amd64

Overview

Package virtdisk reads the size and type of virtual hard disks (VHD, VHDX, VHD Set) through virtdisk.dll, the API behind Get-VHD. https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/

Index

Constants

View Source
const (
	ProviderSubtypeFixed        uint32 = 2
	ProviderSubtypeDynamic      uint32 = 3
	ProviderSubtypeDifferencing uint32 = 4
)

Provider subtypes of GET_VIRTUAL_DISK_INFO_PROVIDER_SUBTYPE.

Variables

This section is empty.

Functions

func Available

func Available() error

Available reports whether virtdisk.dll and the functions used by GetInfo can be loaded. LazyProc.Call panics if they can't, so check this first.

func ParentLocations

func ParentLocations(path string) ([]string, error)

ParentLocations returns the paths at which the parent of the differencing disk at path is stored, as recorded in the disk. Disks without a parent return none.

Types

type Info

type Info struct {
	// VirtualSize is the maximum size the virtual machine sees, in bytes.
	VirtualSize uint64
	// PhysicalSize is the size of the file on storage, in bytes.
	PhysicalSize uint64
	// ProviderSubtype is ProviderSubtypeFixed, ProviderSubtypeDynamic or ProviderSubtypeDifferencing.
	ProviderSubtype uint32
}

Info is the size and type of a virtual hard disk.

func GetInfo

func GetInfo(path string) (Info, error)

GetInfo opens the virtual hard disk at path read-only, without its parents, and returns its size and provider subtype. It works on disks attached to running virtual machines.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL