storage

package
v0.0.0-...-ffb386f Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlockDeviceTypeDisk identifies a BlockDevice as a disk
	BlockDeviceTypeDisk = iota

	// BlockDeviceTypePart identifies a BlockDevice as a partition
	BlockDeviceTypePart

	// BlockDeviceTypeRom identifies a BlockDevice as a rom
	BlockDeviceTypeRom

	// BlockDeviceTypeLVM2Group identifies a BlockDevice as a lvm2 group
	BlockDeviceTypeLVM2Group

	// BlockDeviceTypeLVM2Volume identifies a BlockDevice as a lvm2 volume
	BlockDeviceTypeLVM2Volume

	// BlockDeviceTypeRAID0 identifies a BlockDevice as a RAID0
	BlockDeviceTypeRAID0

	// BlockDeviceTypeRAID1 identifies a BlockDevice as a RAID1
	BlockDeviceTypeRAID1

	// BlockDeviceTypeRAID4 identifies a BlockDevice as a RAID4
	BlockDeviceTypeRAID4

	// BlockDeviceTypeRAID5 identifies a BlockDevice as a RAID5
	BlockDeviceTypeRAID5

	// BlockDeviceTypeRAID6 identifies a BlockDevice as a RAID6
	BlockDeviceTypeRAID6

	// BlockDeviceTypeRAID10 identifies a BlockDevice as a RAID10
	BlockDeviceTypeRAID10

	// BlockDeviceTypeCrypt identifies a BlockDevice as an encrypted partition (created with cryptsetup)
	BlockDeviceTypeCrypt

	// BlockDeviceTypeLoop identifies a BlockDevice as a loop device (created with losetup)
	BlockDeviceTypeLoop

	// BlockDeviceTypeUnknown identifies a BlockDevice as unknown
	BlockDeviceTypeUnknown

	// BlockDeviceStateUnknown identifies a BlockDevice in a unknown state
	BlockDeviceStateUnknown = iota

	// BlockDeviceStateRunning identifies a BlockDevice as running
	BlockDeviceStateRunning

	// BlockDeviceStateLive identifies a BlockDevice as live
	BlockDeviceStateLive

	// BlockDeviceStateConnected identifies a BlockDevice as Connected
	BlockDeviceStateConnected

	// BlockDeviceStateSuspended identifies a BlockDevice as Suspended
	BlockDeviceStateSuspended

	// MinimumPartitionSize is smallest size for any partition
	MinimumPartitionSize = 1048576

	// SafeWholeWarning specifies the warning message for whole disk partition
	SafeWholeWarning = "Selected media will be partitioned."

	// SafePartialWarning specifies the warning message for partial disk partition
	SafePartialWarning = "Selected media will have partitions added."

	// MediaToBeUsed identified a disk which will be used during the installation
	MediaToBeUsed = "Selected media will be used for installation."

	// LegacyModeWarning specifies the warning message we are using legacy bios mode
	LegacyModeWarning = "WARNING: Booting set for legacy BIOS mode."

	// LegacyNoBootWarning specifies the warning message we are using legacy bios mode
	// and there is not /boot partition; so will NOT be able to boot in EFI mode.
	LegacyNoBootWarning = "WARNING: system can not boot EFI mode due to no /boot partition."

	// PartitioningWarning specifies the warning message for writing partition table
	PartitioningWarning = "WARNING: New Partition table will be created."

	// LogicalVolumeWarning specifies the warning message when removing a logical volume
	LogicalVolumeWarning = "WARNING: Logical Volume will be removed."

	// DestructiveWarning specifies the warning message for destructive installation
	DestructiveWarning = "WARNING: Selected media will be erased."

	// DataLossWarning specifies the warning message for data loss installation
	DataLossWarning = "WARNING: Selected media will have data loss."

	// RemoveParitionWarning specifies the warning message for removing a media partition
	RemoveParitionWarning = "WARNING: partition will be removed."

	// AddPartitionInfo specifies the warning message for removing a media partition
	AddPartitionInfo = "Add new partition."

	// FailedPartitionWarning specifies the warning message when we can not find partitions
	FailedPartitionWarning = "WARNING: Failed to detected partition information."

	// FormatPartitionInfo specifies the warning message for formatting a media partition
	FormatPartitionInfo = "Format partition as %s."

	// UsePartitionInfo specifies the warning message for reusing a media partition
	UsePartitionInfo = "Use existing partition."

	// ConfirmInstallation specifies the installation warning title
	ConfirmInstallation = "Confirm Installation"

	// EncryptionPassphrase specifies the title for encryption passphrase dialog
	EncryptionPassphrase = "Encryption Passphrase"

	// PassphraseMessage specifies the text for encryption passphrase dialog
	PassphraseMessage = "Encryption requires a Passphrase"

	// RequiredBundleLVM the bundle needed if lvm partitions are used other than root
	RequiredBundleLVM = "storage-utils"
)
View Source
const (
	// MinimumServerInstallSize is the smallest installation size in bytes for a Server
	MinimumServerInstallSize = uint64(4) * (1000 * 1000 * 1000) // 4GB

	// MinimumDesktopInstallSize is the smallest installation size in bytes for a Desktop
	MinimumDesktopInstallSize = uint64(20) * (1000 * 1000 * 1000) // 20GB
)
View Source
const (
	// MinPassphraseLength is the shortest possible password
	MinPassphraseLength = 8
	// MaxPassphraseLength is the shortest possible password
	MaxPassphraseLength = 94

	// RequiredBundle the bundle needed if encrypted partitions are used
	RequiredBundle = "boot-encrypted"
	// KernelArgument is kernel argument needed if encrypted partitions are used
	KernelArgument = "rootflags=x-systemd.device-timeout=0"

	// EncryptHash use for LUKS encryption
	EncryptHash = "sha256"
	// EncryptCipher use for LUKS encryption
	EncryptCipher = "aes-xts-plain64"
	// EncryptKeySize use for LUKS encryption
	EncryptKeySize = 512
)
View Source
const (
	// SwapfileName is the default name of the swap file to create
	SwapfileName = "/var/swapfile"
)

Variables

View Source
var (
	SwapFileSizeDefault = uint64(64 * (1024 * 1024))

	// BlockDeviceTypeLVM2GroupString is a string version for LVM2 member type
	BlockDeviceTypeLVM2GroupString, _ = blockDeviceTypeMap[BlockDeviceTypeLVM2Group]
)

Functions

func AddBootStandardPartition

func AddBootStandardPartition(disk *BlockDevice) uint64

AddBootStandardPartition will add to disk a new standard Boot partition

func AddRootStandardPartition

func AddRootStandardPartition(disk *BlockDevice, rootSize uint64)

AddRootStandardPartition will add to disk a new standard Root partition

func AdvancedPartitionsRequireEncryption

func AdvancedPartitionsRequireEncryption(medias []*BlockDevice) bool

AdvancedPartitionsRequireEncryption returns an array of validation error strings for the advanced partitions

func CreateSwapFile

func CreateSwapFile(rootDir string, sizeString string) error

CreateSwapFile is responsible for generating a valid swapfile on the installation target

func DesktopValidateAdvancedPartitions

func DesktopValidateAdvancedPartitions(medias []*BlockDevice, mediaOpts MediaOpts) []string

DesktopValidateAdvancedPartitions returns an array of validation error strings for the advanced partitions based on a Desktop installation.

func DesktopValidatePartitions

func DesktopValidatePartitions(medias []*BlockDevice, mediaOpts MediaOpts) []string

DesktopValidatePartitions returns an array of validation error strings for the partitions based on a Desktop installation.

func DetachLoopDevice

func DetachLoopDevice(file string)

DetachLoopDevice detaches a loop device

func FormatInstallPortion

func FormatInstallPortion(target InstallTarget) string

FormatInstallPortion is the common code for describing the amount of disk used

func GenerateTabFiles

func GenerateTabFiles(rootDir string, medias []*BlockDevice) error

GenerateTabFiles creates the /etc mounting files if needed

func GetAdvancedPartitions

func GetAdvancedPartitions(medias []*BlockDevice) []string

GetAdvancedPartitions returns an array of strings for the assigned advanced partitions used

func GetImpactOnOtherDisks

func GetImpactOnOtherDisks() bool

GetImpactOnOtherDisks informs whether actual installation should proceed or fail Only used when Performing destructive Installation

func GetPassPhrase

func GetPassPhrase() string

GetPassPhrase prompts to the user interactively for the pass phrase via the command line. This is intended to be used to get a pass phrase for encrypting file systems on the installation target while using the command line (aka massinstall)

func HasAdvancedSwap

func HasAdvancedSwap(medias []*BlockDevice) bool

HasAdvancedSwap check if the advanced media contain a swap partition

func HumanReadableSizeXB

func HumanReadableSizeXB(size uint64) (string, error)

HumanReadableSizeXB converts the size representation in bytes to the closest human readable format i.e 10M, 1G, 2T etc

func HumanReadableSizeXBWithPrecision

func HumanReadableSizeXBWithPrecision(size uint64, precision int) (string, error)

HumanReadableSizeXBWithPrecision converts the size representation in bytes to the closest human readable format i.e 10MB, 1GB, 2TB etc with a forced precision

func HumanReadableSizeXBWithUnit

func HumanReadableSizeXBWithUnit(size uint64, unit string) (string, error)

HumanReadableSizeXBWithUnit converts the size representation in bytes to the closest human readable format i.e 10MB, 1GB, 2TB etc with a forced unit

func HumanReadableSizeXBWithUnitAndPrecision

func HumanReadableSizeXBWithUnitAndPrecision(size uint64, unit string, precision int) (string, error)

HumanReadableSizeXBWithUnitAndPrecision converts the size representation in bytes to the closest human readable format i.e 10MB, 1GB, 2TB etc with a forced unit and precision

func HumanReadableSizeXiB

func HumanReadableSizeXiB(size uint64) (string, error)

HumanReadableSizeXiB converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc

func HumanReadableSizeXiBWithPrecision

func HumanReadableSizeXiBWithPrecision(size uint64, precision int) (string, error)

HumanReadableSizeXiBWithPrecision converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc with a forced precision

func HumanReadableSizeXiBWithUnit

func HumanReadableSizeXiBWithUnit(size uint64, unit string) (string, error)

HumanReadableSizeXiBWithUnit converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc with a forced unit

func HumanReadableSizeXiBWithUnitAndPrecision

func HumanReadableSizeXiBWithUnitAndPrecision(size uint64, unit string, precision int) (string, error)

HumanReadableSizeXiBWithUnitAndPrecision converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc with a forced unit and precision

func IsBlockDevAvailable

func IsBlockDevAvailable(bd *BlockDevice) bool

IsBlockDevAvailable is a function to test availability of a block device

func IsValidPassphrase

func IsValidPassphrase(phrase string) (bool, string)

IsValidPassphrase checks the minimum passphrase requirements

func MakeImage

func MakeImage(bd *BlockDevice, file string) error

MakeImage create an image file considering the total block device size

func MaxLabelLength

func MaxLabelLength(fstype string) int

MaxLabelLength returns the maximum length of a label for the given file system type

func MountMetaFs

func MountMetaFs(rootDir string) error

MountMetaFs mounts proc, sysfs and devfs in the target installation directory

func NewStandardPartitions

func NewStandardPartitions(disk *BlockDevice)

NewStandardPartitions will add to disk a new set of partitions representing a default set of partitions required for an installation

func ParseVolumeSize

func ParseVolumeSize(str string) (uint64, error)

ParseVolumeSize will parse a string formatted (1M, 10GiB, 2TB) size and return its representation in bytes Units without suffix 'B' or 'iB' are assumed to be powers of 10 to ensure consistency with existing YAML files.

func PrepareInstallationMedia

func PrepareInstallationMedia(targets map[string]InstallTarget,
	medias []*BlockDevice, mediaOpts MediaOpts, dryRun *DryRunType) error

PrepareInstallationMedia updates all of the installation medias to ensure installation can proceed. Media is only updated if dryRun is passed 'nil, otherwise a high level description, in the locale, is set in the passed slice of string

func ServerValidateAdvancedPartitions

func ServerValidateAdvancedPartitions(medias []*BlockDevice, mediaOpts MediaOpts) []string

ServerValidateAdvancedPartitions returns an array of validation error strings for the advanced partitions based on a Server installation.

func ServerValidatePartitions

func ServerValidatePartitions(medias []*BlockDevice, mediaOpts MediaOpts) []string

ServerValidatePartitions returns an array of validation error strings for the partitions based on a Server installation.

func SetupLoopDevice

func SetupLoopDevice(file string) (string, error)

SetupLoopDevice sets up a loop device and return the loop device path

func UmountAll

func UmountAll() error

UmountAll unmounts all previously mounted devices

func UpdateBlockDevices

func UpdateBlockDevices(medias []*BlockDevice) error

UpdateBlockDevices updates the Label and UUID information only for existing available block devices

Types

type BlockDevFilterFunc

type BlockDevFilterFunc func(*BlockDevice) bool

BlockDevFilterFunc is a type for all filter functions

type BlockDevice

type BlockDevice struct {
	Name            string           // device name
	MappedName      string           // mapped device name
	Path            string           // device path
	Model           string           // device model
	MajorMinor      string           // major:minor device number
	PtType          string           // partition table type
	FsType          string           // filesystem type
	UUID            string           // filesystem uuid
	Serial          string           // device serial number
	MountPoint      string           // where the device is mounted
	Label           string           // label for the filesystem; set with mkfs
	PartitionLabel  string           // label for the partition; set with cgdisk/parted/gparted
	Size            uint64           // size of the device
	Type            BlockDeviceType  // device type
	State           BlockDeviceState // device state (running, live etc)
	ReadOnly        bool             // read-only device
	RemovableDevice bool             // removable device
	Children        []*BlockDevice   // children devices/partitions
	UserDefined     bool             // was this value set by user?
	MakePartition   bool             // Do we need to make a new partition?
	FormatPartition bool             // Do we need to format the partition?
	LabeledAdvanced bool             // Does this partition have a valid Advanced Label?
	Options         string           // arbitrary mkfs.* options

	PartTable []*PartedPartition // Existing Disk partition table from parted
	// contains filtered or unexported fields
}

A BlockDevice describes a block device and its partitions

func FilterBlockDevices

func FilterBlockDevices(bd []*BlockDevice, filterfunc ...BlockDevFilterFunc) []*BlockDevice

FilterBlockDevices is a filter function which runs zero or more filter_func on every BlockDevice in the slice and returns a filtered slice which satisfies them all

func FindAdvancedInstallTargets

func FindAdvancedInstallTargets(medias []*BlockDevice) []*BlockDevice

func FindAllBlockDevices

func FindAllBlockDevices(bd *BlockDevice, filterfunc BlockDevFilterFunc) []*BlockDevice

FindAllBlockDevices runs the filterfunc and returns a list of all blockdevices which satisfy the condition. This tree is flattened. So dont use children of each item in list

func FindBlockDeviceDepthFirst

func FindBlockDeviceDepthFirst(bd *BlockDevice, filterfunc BlockDevFilterFunc) (bool, *BlockDevice)

FindBlockDeviceDepthFirst runs the filterfunc in depth first manner and returns the first child which shows certain property

func ListAvailableBlockDevices

func ListAvailableBlockDevices(userDefined []*BlockDevice) ([]*BlockDevice, error)

ListAvailableBlockDevices Lists only available block devices where available means block devices not mounted or not in use by the host system userDefined will be inserted in the resulting list rather the loaded ones

func ListBlockDevices

func ListBlockDevices(userDefined []*BlockDevice) ([]*BlockDevice, error)

ListBlockDevices Lists all block devices userDefined will be inserted in the resulting list reather the loaded ones

func RescanBlockDevices

func RescanBlockDevices(userDefined []*BlockDevice) ([]*BlockDevice, error)

RescanBlockDevices clears current list available block devices and rescans

func (*BlockDevice) AddChild

func (bd *BlockDevice) AddChild(child *BlockDevice)

AddChild adds a partition to a disk block device

func (*BlockDevice) AddFromFreePartition

func (bd *BlockDevice) AddFromFreePartition(parted *PartedPartition, child *BlockDevice)

AddFromFreePartition reduces the free partition by the size given User when adding a new partition to a disk from free space

func (*BlockDevice) Clone

func (bd *BlockDevice) Clone() *BlockDevice

Clone creates a copies a BlockDevice and its children

func (*BlockDevice) DiskSize

func (bd *BlockDevice) DiskSize() (uint64, error)

DiskSize given a BlockDevice sum's up its size and children sizes

func (*BlockDevice) EncryptionRequiresPassphrase

func (bd *BlockDevice) EncryptionRequiresPassphrase(isAdvanced bool) bool

EncryptionRequiresPassphrase checks all partition to see if encryption was enabled

func (*BlockDevice) Equals

func (bd *BlockDevice) Equals(cmp *BlockDevice) bool

Equals compares two BlockDevice instances

func (*BlockDevice) ExpandName

func (bd *BlockDevice) ExpandName(alias map[string]string)

ExpandName expands variables in the Name attribute applying the values in the alias map

func (*BlockDevice) FindAllChildren

func (bd *BlockDevice) FindAllChildren() []*BlockDevice

func (*BlockDevice) FsTypeNotSwap

func (bd *BlockDevice) FsTypeNotSwap() bool

FsTypeNotSwap returns true if the file system type is not swap

func (BlockDevice) GetDeviceFile

func (bd BlockDevice) GetDeviceFile() string

GetDeviceFile formats the block device's file path

func (BlockDevice) GetDeviceID

func (bd BlockDevice) GetDeviceID() string

GetDeviceID returns an identifier for the block device First trying, label, then UUID, then finally the raw device String is suitable for the /etc/fstab

func (BlockDevice) GetMappedDeviceFile

func (bd BlockDevice) GetMappedDeviceFile() string

GetMappedDeviceFile formats the block device's file path using the mapped device name

func (*BlockDevice) GetNewPartitionName

func (bd *BlockDevice) GetNewPartitionName(partition uint64) string

GetNewPartitionName returns the name with the new partition number

func (*BlockDevice) GetPartitionNumber

func (bd *BlockDevice) GetPartitionNumber() uint64

GetPartitionNumber get the partition number from either the set partition number value, or based on the partition name if the number is 0

func (*BlockDevice) HumanReadableSizeXiB

func (bd *BlockDevice) HumanReadableSizeXiB() (string, error)

HumanReadableSizeXiB converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc

func (*BlockDevice) HumanReadableSizeXiBWithPrecision

func (bd *BlockDevice) HumanReadableSizeXiBWithPrecision(precision int) (string, error)

HumanReadableSizeXiBWithPrecision converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc with a forced precision

func (*BlockDevice) HumanReadableSizeXiBWithUnit

func (bd *BlockDevice) HumanReadableSizeXiBWithUnit(unit string) (string, error)

HumanReadableSizeXiBWithUnit converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc with a forced unit

func (*BlockDevice) HumanReadableSizeXiBWithUnitAndPrecision

func (bd *BlockDevice) HumanReadableSizeXiBWithUnitAndPrecision(unit string, precision int) (string, error)

HumanReadableSizeXiBWithUnitAndPrecision converts the size representation in bytes to the closest human readable format i.e 10MiB, 1GiB, 2TiB etc with a forced unit and precision

func (*BlockDevice) IsAdvancedConfiguration

func (bd *BlockDevice) IsAdvancedConfiguration() bool

IsAdvancedConfiguration checks all partition to see if advanced labeling was enabled

func (*BlockDevice) IsAvailable

func (bd *BlockDevice) IsAvailable() bool

IsAvailable returns true if the media is not a installer media, returns false otherwise

func (*BlockDevice) IsUserDefined

func (bd *BlockDevice) IsUserDefined() bool

IsUserDefined returns true if the configuration was interactively defined by the user

func (*BlockDevice) LargestContiguousFreeSpace

func (bd *BlockDevice) LargestContiguousFreeSpace(minSize uint64) (uint64, uint64)

LargestContiguousFreeSpace returns the largest, contiguous block of free space in the partition table for the block device. If none found, returns {0, 0}

func (*BlockDevice) MakeFs

func (bd *BlockDevice) MakeFs() error

MakeFs runs mkfs.* commands for a BlockDevice definition

func (*BlockDevice) MapEncrypted

func (bd *BlockDevice) MapEncrypted(passphrase string) error

MapEncrypted uses cryptsetup to format (initialize) and open (map) the physical partion to an encrypted partition

func (*BlockDevice) MarshalYAML

func (bd *BlockDevice) MarshalYAML() (interface{}, error)

MarshalYAML is the yaml Marshaller implementation

func (*BlockDevice) Mount

func (bd *BlockDevice) Mount(root string) error

Mount will mount a block devices bd considering its mount point and the root directory

func (*BlockDevice) PartProbe

func (bd *BlockDevice) PartProbe() error

PartProbe runs partprobe against the block device's file

func (*BlockDevice) RemoveChild

func (bd *BlockDevice) RemoveChild(child *BlockDevice)

RemoveChild removes a partition from disk block device

func (*BlockDevice) SetPartitionNumber

func (bd *BlockDevice) SetPartitionNumber(partition uint64)

SetPartitionNumber is set when we add a new partition to a disk which stores the newly allocated partition number, and then corrects the devices partition name

func (*BlockDevice) UnmarshalJSON

func (bd *BlockDevice) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a BlockDevice, targeted to integrate with json decoding framework nolint: gocyclo // TODO: Refactor this

func (*BlockDevice) UnmarshalYAML

func (bd *BlockDevice) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the yaml Unmarshaller implementation

func (*BlockDevice) UsesRaid

func (bd *BlockDevice) UsesRaid() bool

UsesRaid returns true if the file system type is any known RAID type

func (*BlockDevice) WritePartitionTable

func (bd *BlockDevice) WritePartitionTable(wholeDisk bool, forceDestructive bool, dryRun *DryRunType) error

WritePartitionTable writes the defined partitions to the actual block device

type BlockDeviceState

type BlockDeviceState int

BlockDeviceState is the representation of a block device state (live, running, etc)

func (BlockDeviceState) String

func (bs BlockDeviceState) String() string

type BlockDeviceType

type BlockDeviceType int

BlockDeviceType is the representation of a block device type (disk, part, rom, etc)

func (BlockDeviceType) String

func (bt BlockDeviceType) String() string

type ByBDName

type ByBDName []*BlockDevice

ByBDName implements sort.Interface for []*BlockDevice based on the Name field.

func (ByBDName) Len

func (a ByBDName) Len() int

func (ByBDName) Less

func (a ByBDName) Less(i, j int) bool

func (ByBDName) Swap

func (a ByBDName) Swap(i, j int)

type DryRunType

type DryRunType struct {
	TargetResults               *[]string // What will be changed during the installation.
	UnPlannedDestructiveResults *[]string // Changes which impact media other than the ones selected for the install.
}

DryRunType to hold results of dryrun from calling WritePartitionTable

func GetPlannedMediaChanges

func GetPlannedMediaChanges(targets map[string]InstallTarget, medias []*BlockDevice,
	mediaOpts MediaOpts) *DryRunType

GetPlannedMediaChanges returns an array of strings with all of disk and partition planned changes to advise the user before start

type InstallTarget

type InstallTarget struct {
	Name      string // block device name
	Friendly  string // user friendly device name
	WholeDisk bool   // Can we use the whole disk?
	Removable bool   // Is this removable/hotswap media?
	EraseDisk bool   // Are we wiping the disk? New partition table
	DataLoss  bool   // Are we making changes which will lose data
	Advanced  bool   // Was this disk configured via advanced mode?
	FreeStart uint64 // Starting position of free space
	FreeEnd   uint64 // Ending position of free space
}

InstallTarget describes a BlockDevice which is a valid installation target

func FindAllInstallTargets

func FindAllInstallTargets(rootSize uint64, medias []*BlockDevice) []InstallTarget

FindAllInstallTargets creates an order list of all possible installation targets There must be at least minSize free space on the disk

func FindSafeInstallTargets

func FindSafeInstallTargets(rootSize uint64, medias []*BlockDevice) []InstallTarget

FindSafeInstallTargets creates an order list of possible installation targets Only disk with gpt partition are safe to use There must be at least 3 free partition in the table (gpt can have 127) There must be at least minSize free space on the disk

type MediaOpts

type MediaOpts struct {
	LegacyBios         bool   `yaml:"legacyBios,omitempty,flow"`
	SkipValidationSize bool   `yaml:"skipValidationSize,omitempty,flow"`
	SkipValidationAll  bool   `yaml:"skipValidationAll,omitempty,flow"`
	SwapFileSize       string `yaml:"swapFileSize,omitempty,flow"`
	SwapFileSet        bool   `yaml:"-"`
	ForceDestructive   bool   `yaml:"-"`
}

MediaOpts group the set of media related options

type PartedPartition

type PartedPartition struct {
	Number     uint64 // partition number 0 indicates free space
	Start      uint64 // starting byte location
	End        uint64 // ending byte location
	Size       uint64 // size in bytes
	FileSystem string // file system Type
	Name       string // partition name
	Flags      string // flags for partition
}

PartedPartition hold partition information Number 0 and FileSystem "free" are free spaces

func (*PartedPartition) Clone

func (part *PartedPartition) Clone() *PartedPartition

Clone creates a copies a PartedPartition

Jump to

Keyboard shortcuts

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