Documentation ¶
Index ¶
- Constants
- func FormatDevice(runner v1.Runner, device string, fileSystem string, label string, ...) error
- func MiBToSectors(size uint, sectorSize uint) uint
- func WithFS(fs v1.FS) func(d *Disk) error
- func WithGdisk() func(d *Disk) error
- func WithLogger(logger v1.Logger) func(d *Disk) error
- func WithMounter(mounter v1.Mounter) func(d *Disk) error
- func WithRunner(runner v1.Runner) func(d *Disk) error
- type Disk
- func (dev *Disk) AddPartition(size uint, fileSystem string, pLabel string, flags ...string) (int, error)
- func (dev *Disk) CheckDiskFreeSpaceMiB(minSpace uint) bool
- func (dev *Disk) Exists() bool
- func (dev *Disk) ExpandLastPartition(size uint) (string, error)
- func (dev Disk) FindPartitionDevice(partNum int) (string, error)
- func (dev Disk) FormatPartition(partNum int, fileSystem string, label string) (string, error)
- func (dev *Disk) GetFreeSpace() (uint, error)
- func (dev Disk) GetLabel() string
- func (dev Disk) GetLastSector() uint
- func (dev Disk) GetSectorSize() uint
- func (dev *Disk) NewPartitionTable(label string) (string, error)
- func (dev *Disk) Reload() error
- func (dev Disk) String() string
- func (dev Disk) WipeFsOnPartition(device string) error
- type DiskOptions
- type MkfsCall
- type Partition
- type Partitioner
Constants ¶
View Source
const Gdisk = "gdisk"
View Source
const Parted = "parted"
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 ¶
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 ¶
Size is expressed in MiB here
func (*Disk) ExpandLastPartition ¶
ExpandLastPartition expands the latest partition in the disk. Size is expressed in MiB here Size is expressed in MiB here
func (Disk) FormatPartition ¶
func (*Disk) GetFreeSpace ¶
func (Disk) GetLastSector ¶
func (Disk) GetSectorSize ¶
func (Disk) WipeFsOnPartition ¶
type DiskOptions ¶
type MkfsCall ¶
type MkfsCall struct {
// contains filtered or unexported fields
}
func NewMkfsCall ¶
type Partition ¶
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
type Partitioner ¶ added in v1.1.0
type Partitioner interface { WriteChanges() (string, error) SetPartitionTableLabel(label string) error CreatePartition(p *Partition) DeletePartition(num int) SetPartitionFlag(num int, flag string, active bool) WipeTable(wipe bool) GetLastSector(printOut string) (uint, error) Print() (string, error) GetSectorSize(printOut string) (uint, error) GetPartitionTableLabel(printOut string) (string, error) GetPartitions(printOut string) []Partition }
func NewPartitioner ¶ added in v1.1.0
func NewPartitioner(dev string, runner v1.Runner, backend string) Partitioner
Click to show internal directories.
Click to hide internal directories.