partition

package
v1.9.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package partition provides common utils for system partition format.

Package partition provides common utils for system partition format.

Index

Constants

View Source
const (
	MiB = 1024 * 1024
	GiB = 1024 * MiB

	EFISize      = 100 * MiB
	BIOSGrubSize = 1 * MiB
	BootSize     = 1000 * MiB
	// EFIUKISize is the size of the EFI partition when UKI is enabled.
	// With UKI all assets are stored in the EFI partition.
	// This is the size of the old EFISize + BIOSGrubSize + BootSize.
	EFIUKISize       = EFISize + BIOSGrubSize + BootSize
	MetaSize         = 1 * MiB
	StateSize        = 100 * MiB
	EphemeralMinSize = 2 * GiB
)

Partition default sizes.

Variables

This section is empty.

Functions

func Format

func Format(devname string, t *FormatOptions, printf func(string, ...any)) error

Format zeroes the device and formats it using filesystem type provided.

Types

type FileSystemType

type FileSystemType = string

FileSystemType is used to format partitions.

const (
	FilesystemTypeNone   FileSystemType = "none"
	FilesystemTypeZeroes FileSystemType = "zeroes"
	FilesystemTypeXFS    FileSystemType = "xfs"
	FilesystemTypeVFAT   FileSystemType = "vfat"
)

Filesystem types.

type FormatOptions

type FormatOptions struct {
	Label               string
	FileSystemType      FileSystemType
	Force               bool
	UnsupportedFSOption bool
}

FormatOptions contains format parameters.

func NewFormatOptions

func NewFormatOptions(label string) *FormatOptions

NewFormatOptions creates a new format options.

type Options added in v1.5.0

type Options struct {
	FormatOptions

	PartitionLabel string
	PartitionType  Type
	Size           uint64
	PartitionOpts  []gpt.PartitionOption
}

Options contains the options for creating a partition.

func NewPartitionOptions added in v1.5.0

func NewPartitionOptions(label string, uki bool) Options

NewPartitionOptions returns a new PartitionOptions.

type Type

type Type = string

Type in partition table.

const (
	EFISystemPartition  Type = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
	BIOSBootPartition   Type = "21686148-6449-6E6F-744E-656564454649"
	LinuxFilesystemData Type = "0FC63DAF-8483-4772-8E79-3D69D8477DE4"
)

GPT partition types.

TODO: should be moved into the blockdevice library.

type VolumeWipeTarget added in v1.8.0

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

VolumeWipeTarget is a target for wiping a volume.

func VolumeWipeTargetFromDiscoveredVolume added in v1.8.1

func VolumeWipeTargetFromDiscoveredVolume(dv *blockres.DiscoveredVolume) *VolumeWipeTarget

VolumeWipeTargetFromDiscoveredVolume creates a new VolumeWipeTarget from a DiscoveredVolume.

func VolumeWipeTargetFromVolumeStatus added in v1.8.1

func VolumeWipeTargetFromVolumeStatus(vs *blockres.VolumeStatus) *VolumeWipeTarget

VolumeWipeTargetFromVolumeStatus creates a new VolumeWipeTarget from a VolumeStatus.

func (*VolumeWipeTarget) GetLabel added in v1.8.0

func (v *VolumeWipeTarget) GetLabel() string

GetLabel implements runtime.PartitionTarget.

func (*VolumeWipeTarget) String added in v1.8.1

func (v *VolumeWipeTarget) String() string

String implements runtime.PartitionTarget.

func (*VolumeWipeTarget) Wipe added in v1.8.0

func (v *VolumeWipeTarget) Wipe(ctx context.Context, log func(string, ...any)) error

Wipe implements runtime.PartitionTarget.

Jump to

Keyboard shortcuts

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