vhd

package
v0.0.0-...-ccecf6c Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 11 Imported by: 49

Documentation

Overview

Package to work with VHD images See https://technet.microsoft.com/en-us/virtualization/bb676673.aspx

Index

Constants

View Source
const FOURK_SECTOR_SIZE = 4096
View Source
const SECTOR_SIZE = 512
View Source
const VHD_BLOCK_SIZE = 2 * 1024 * 1024 // 2MB
View Source
const VHD_COOKIE = "636f6e6563746978" // conectix
View Source
const VHD_CREATOR_APP = "676f2d766864" // go-vhd
View Source
const VHD_CREATOR_HOST_OS = "5769326B" // Win2k
View Source
const VHD_DYN_COOKIE = "6378737061727365" // cxsparse
View Source
const VHD_EXTRA_HEADER_SIZE = 1024
View Source
const VHD_HEADER_SIZE = 512

Variables

This section is empty.

Functions

func RawToFixed

func RawToFixed(f *os.File, options *VHDOptions)

Types

type VHD

type VHD struct {
	Footer      VHDHeader
	ExtraHeader VHDExtraHeader
}

A VDH file

func FromFile

func FromFile(f *os.File) (vhd VHD)

func VHDCreateSparse

func VHDCreateSparse(size uint64, name string, options VHDOptions) VHD

func (*VHD) PrintExtraHeader

func (vhd *VHD) PrintExtraHeader()

func (*VHD) PrintFooter

func (vhd *VHD) PrintFooter()

func (*VHD) PrintInfo

func (vhd *VHD) PrintInfo()

type VHDExtraHeader

type VHDExtraHeader struct {
	Cookie              [8]byte
	DataOffset          [8]byte
	TableOffset         [8]byte
	HeaderVersion       [4]byte
	MaxTableEntries     [4]byte
	BlockSize           [4]byte
	Checksum            [4]byte
	ParentUUID          [16]byte
	ParentTimestamp     [4]byte
	Reserved            [4]byte
	ParentUnicodeName   [512]byte
	ParentLocatorEntry1 [24]byte
	ParentLocatorEntry2 [24]byte
	ParentLocatorEntry3 [24]byte
	ParentLocatorEntry4 [24]byte
	ParentLocatorEntry5 [24]byte
	ParentLocatorEntry6 [24]byte
	ParentLocatorEntry7 [24]byte
	ParentLocatorEntry8 [24]byte
	Reserved2           [256]byte
}

VHD extra header, for dynamic and differential disks

func (*VHDExtraHeader) CookieString

func (header *VHDExtraHeader) CookieString() string

type VHDHeader

type VHDHeader struct {
	Cookie             [8]byte
	Features           [4]byte
	FileFormatVersion  [4]byte
	DataOffset         [8]byte
	Timestamp          [4]byte
	CreatorApplication [4]byte
	CreatorVersion     [4]byte
	CreatorHostOS      [4]byte
	OriginalSize       [8]byte
	CurrentSize        [8]byte
	DiskGeometry       [4]byte
	DiskType           [4]byte
	Checksum           [4]byte
	UniqueId           [16]byte
	SavedState         [1]byte
	Reserved           [427]byte
}

VHD Header

func CreateFixedHeader

func CreateFixedHeader(size uint64, options *VHDOptions) VHDHeader

func (*VHDHeader) DiskTypeStr

func (h *VHDHeader) DiskTypeStr() (dt string)

func (*VHDHeader) TimestampTime

func (h *VHDHeader) TimestampTime() time.Time

Return the timestamp of the header

type VHDOptions

type VHDOptions struct {
	UUID      string
	Timestamp int64
}

Options for the CreateSparseVHD function

Jump to

Keyboard shortcuts

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