Help us shape the future of Go! Take the 2026 Go Developer Survey

sgdisk

package
v2.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	// contains filtered or unexported fields
}

func Begin

func Begin(logger *log.Logger, dev string) *Operation

Begin begins an sgdisk operation

func (*Operation) Commit

func (op *Operation) Commit() error

Commit commits an partitioning operation.

func (*Operation) CreatePartition

func (op *Operation) CreatePartition(p Partition)

CreatePartition adds the supplied partition to the list of partitions to be created as part of an operation.

func (*Operation) DeletePartition

func (op *Operation) DeletePartition(num int)

func (*Operation) Info

func (op *Operation) Info(num int)

func (*Operation) Pretend

func (op *Operation) Pretend() (string, error)

Pretend is like Commit() but uses the --pretend flag and returns the output on stdout for parsing.

Note: because sgdisk does not do any escaping on its output, callers should ensure the partitions' labels do not have any nasty characters that will interfere with parsing (e.g. \n)

func (*Operation) WipeTable

func (op *Operation) WipeTable(wipe bool)

WipeTable toggles if the table is to be wiped first when commiting this operation.

type Partition added in v2.7.0

type Partition struct {
	types.Partition
	StartSector   *int64
	SizeInSectors *int64

	// shadow StartMiB/SizeMiB so they're not accidentally used
	StartMiB string
	SizeMiB  string
}

We ignore types.Partition.StartMiB/SizeMiB in favor of StartSector/SizeInSectors. The caller is expected to do the conversion.

Jump to

Keyboard shortcuts

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