Documentation ¶
Overview ¶
Package partition provides common utils for system partition format.
Package partition provides common utils for system partition format.
Index ¶
- Constants
- func Format(devname string, t *FormatOptions, printf func(string, ...any)) error
- func Locate(pt *gpt.GPT, label string) (*gpt.Partition, error)
- func Partition(pt *gpt.GPT, pos int, device string, partitionOpts Options, ...) (string, error)
- type FileSystemType
- type FormatOptions
- type Options
- type Type
Constants ¶
View Source
const ( MiB = 1024 * 1024 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 )
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" FilesystemTypeXFS FileSystemType = "xfs" FilesystemTypeVFAT FileSystemType = "vfat" )
Filesystem types.
type FormatOptions ¶
type FormatOptions struct { Label string FileSystemType FileSystemType Force 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 { PartitionLabel string PartitionType Type Size uint64 LegacyBIOSBootable bool }
Options contains the options for creating a partition.
func NewPartitionOptions ¶ added in v1.5.0
NewPartitionOptions returns a new PartitionOptions.
Click to show internal directories.
Click to hide internal directories.