partitioner

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDevice

func FormatDevice(runner v1.Runner, device string, fileSystem string, label string, opts ...string) error

FormatDevice formats a block device with the given parameters

func MiBToSectors

func MiBToSectors(size uint, sectorSize uint) uint

func WithFS

func WithFS(fs v1.FS) func(d *Disk) error

func WithLogger

func WithLogger(logger v1.Logger) func(d *Disk) error

func WithRunner

func WithRunner(runner v1.Runner) func(d *Disk) error

Types

type Disk

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

func NewDisk

func NewDisk(device string, opts ...DiskOptions) *Disk

func (*Disk) AddPartition

func (dev *Disk) AddPartition(size uint, fileSystem string, pLabel string, flags ...string) (int, error)

AddPartition adds a partition. Size is expressed in MiB here Size is expressed in MiB here

func (*Disk) CheckDiskFreeSpaceMiB

func (dev *Disk) CheckDiskFreeSpaceMiB(minSpace uint) bool

Size is expressed in MiB here

func (*Disk) Exists

func (dev *Disk) Exists() bool

func (*Disk) ExpandLastPartition

func (dev *Disk) ExpandLastPartition(size uint) (string, error)

ExpandLastPartition expands the latest partition in the disk. Size is expressed in MiB here Size is expressed in MiB here

func (Disk) FindPartitionDevice

func (dev Disk) FindPartitionDevice(partNum int) (string, error)

func (Disk) FormatPartition

func (dev Disk) FormatPartition(partNum int, fileSystem string, label string) (string, error)

func (*Disk) GetFreeSpace

func (dev *Disk) GetFreeSpace() (uint, error)

func (Disk) GetLabel

func (dev Disk) GetLabel() string

func (Disk) GetLastSector

func (dev Disk) GetLastSector() uint

func (Disk) GetSectorSize

func (dev Disk) GetSectorSize() uint

func (*Disk) NewPartitionTable

func (dev *Disk) NewPartitionTable(label string) (string, error)

func (*Disk) Reload

func (dev *Disk) Reload() error

func (Disk) String

func (dev Disk) String() string

func (Disk) WipeFsOnPartition

func (dev Disk) WipeFsOnPartition(device string) error

type DiskOptions

type DiskOptions func(d *Disk) error

type MkfsCall

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

func NewMkfsCall

func NewMkfsCall(dev string, fileSystem string, label string, runner v1.Runner, customOpts ...string) *MkfsCall

func (MkfsCall) Apply

func (mkfs MkfsCall) Apply() (string, error)

type PartedCall

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

func NewPartedCall

func NewPartedCall(dev string, runner v1.Runner) *PartedCall

func (*PartedCall) CreatePartition

func (pc *PartedCall) CreatePartition(p *Partition)

func (*PartedCall) DeletePartition

func (pc *PartedCall) DeletePartition(num int)

func (PartedCall) GetLastSector

func (pc PartedCall) GetLastSector(printOut string) (uint, error)

Parses the output of a PartedCall.Print call

func (PartedCall) GetPartitionTableLabel

func (pc PartedCall) GetPartitionTableLabel(printOut string) (string, error)

Parses the output of a PartedCall.Print call

func (PartedCall) GetPartitions

func (pc PartedCall) GetPartitions(printOut string) []Partition

Parses the output of a GdiskCall.Print call

func (PartedCall) GetSectorSize

func (pc PartedCall) GetSectorSize(printOut string) (uint, error)

Parses the output of a PartedCall.Print call

func (PartedCall) Print

func (pc PartedCall) Print() (string, error)

func (*PartedCall) SetPartitionFlag

func (pc *PartedCall) SetPartitionFlag(num int, flag string, active bool)

func (*PartedCall) SetPartitionTableLabel

func (pc *PartedCall) SetPartitionTableLabel(label string)

func (*PartedCall) WipeTable

func (pc *PartedCall) WipeTable(wipe bool)

func (*PartedCall) WriteChanges

func (pc *PartedCall) WriteChanges() (string, error)

type Partition

type Partition struct {
	Number     int
	StartS     uint
	SizeS      uint
	PLabel     string
	FileSystem string
}

We only manage sizes in sectors unit for the Partition structre in parted wrapper FileSystem here is only used by parted to determine the partition ID or type

Jump to

Keyboard shortcuts

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