gpt: Index | Files

package gpt

import ""


Package Files



var (
    GUID_LVM = PartType([16]byte{0x79, 0xd3, 0xd6, 0xe6, 0x7, 0xf5, 0xc2, 0x44, 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28}) // E6D6D379-F507-44C2-A23C-238F2A3DF928

func StringToGuid Uses

func StringToGuid(guid string) (res [16]byte, err error)

Use for create guid predefined values in snippet

type Flags Uses

type Flags [8]byte

type Guid Uses

type Guid [16]byte

func (Guid) String Uses

func (this Guid) String() string
type Header struct {
    Signature               [8]byte // Offset  0. "EFI PART", 45h 46h 49h 20h 50h 41h 52h 54h
    Revision                uint32  // Offset  8
    Size                    uint32  // Offset 12
    CRC                     uint32  // Offset 16. Autocalc when save Header.
    Reserved                uint32  // Offset 20
    HeaderStartLBA          uint64  // Offset 24
    HeaderCopyStartLBA      uint64  // Offset 32
    FirstUsableLBA          uint64  // Offset 40
    LastUsableLBA           uint64  // Offset 48
    DiskGUID                Guid    // Offset 56
    PartitionsTableStartLBA uint64  // Offset 72
    PartitionsArrLen        uint32  // Offset 80
    PartitionEntrySize      uint32  // Offset 84
    PartitionsCRC           uint32  // Offset 88. Autocalc when save Table.
    TrailingBytes           []byte  // Offset 92

type PartType Uses

type PartType Guid

func (PartType) String Uses

func (this PartType) String() string

type Partition Uses

type Partition struct {
    Type          PartType // Offset 0
    Id            Guid     // Offset 16
    FirstLBA      uint64   // Offset 32
    LastLBA       uint64   // Offset 40
    Flags         Flags    // Offset 68
    PartNameUTF16 [72]byte // Offset 56
    TrailingBytes []byte   // Offset 128. Usually it is empty

func (Partition) IsEmpty Uses

func (this Partition) IsEmpty() bool

func (Partition) Name Uses

func (this Partition) Name() string

type Table Uses

type Table struct {
    SectorSize uint64 // in bytes
    Header     Header
    Partitions []Partition

func ReadTable Uses

func ReadTable(reader io.ReadSeeker, SectorSize uint64) (table Table, err error)

Read GPT partition Have to set to first byte of GPT Header (usually start of second sector on disk)

func (Table) CreateOtherSideTable Uses

func (this Table) CreateOtherSideTable() (res Table)

func (Table) CreateTableForNewDiskSize Uses

func (this Table) CreateTableForNewDiskSize(size uint64) (res Table)

Create primary table for resized disk size - in sectors

func (Table) Write Uses

func (this Table) Write(writer io.WriteSeeker) (err error)

Calc header and partitions CRC. Save Header and partition entries to the disk. It independent of start position: writer will be seek to position from Table.Header.

Package gpt imports 6 packages (graph) and is imported by 2 packages. Updated 2019-02-11. Refresh now. Tools for package owners.