storage

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FAT32 is used for the UEFI boot partition
	FAT32 = FSType("fat32")
	// VFAT is used for the UEFI boot partition
	VFAT = FSType("vfat")
	// EXT3 is usually only used for /boot
	EXT3 = FSType("ext3")
	// EXT4 is the default fs
	EXT4 = FSType("ext4")
	// SWAP is for the swap partition
	SWAP = FSType("swap")

	// GPTBoot EFI Boot Partition
	GPTBoot = GPTType("ef00")
	// GPTLinux Linux Partition
	GPTLinux = GPTType("8300")
	// EFISystemPartition see https://en.wikipedia.org/wiki/EFI_system_partition
	EFISystemPartition = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
	// GIB bytes of a Gigabyte
	GIB = int64(1024 * 1024 * 1024)
	// TIB bytes of a Terabyte
	TIB = int64(1024 * GIB)
	// DiskPrefixToIgnore disks with this prefix will not be reported and wiped.
	DiskPrefixToIgnore = "ram"
)

Variables

This section is empty.

Functions

func FetchBlockIDProperties added in v0.5.0

func FetchBlockIDProperties(partitionDevice string) (map[string]string, error)

FetchBlockIDProperties use blkid to return more properties of the given partition device

func MountSpecialFilesystems

func MountSpecialFilesystems(prefix string) error

MountSpecialFilesystems mounts all special filesystems needed by a chroot

func UnMountAll

func UnMountAll(prefix string)

UnMountAll will unmount all filesystems

func WipeDisk added in v0.5.0

func WipeDisk(disk *ghw.Disk) error

WipeDisk will erase all content and partitions of given existing disk.

func WipeDisks

func WipeDisks() error

WipeDisks will erase all content and partitions of all existing Disks

Types

type Disk

type Disk struct {
	// Device the name of the disk device visible from kernel side, e.g. sda
	Device string
	// Partitions to create on this disk, order is preserved
	Partitions []*Partition
}

Disk is a physical Disk

func GetDisk

func GetDisk(imageID string, size *models.ModelsV1SizeResponse, disks []*models.ModelsV1MachineBlockDevice) Disk

GetDisk returns a partitioning scheme for the given image, if image.ID is unknown default is used.

func (Disk) MountPartitions

func (disk Disk) MountPartitions(prefix string) error

MountPartitions mounts all partitions under prefix

func (Disk) Partition

func (disk Disk) Partition() error

Partition a Disk

func (*Disk) SortByMountPoint

func (disk *Disk) SortByMountPoint() []*Partition

SortByMountPoint ensures that "/" is the first, which is required for mounting

type FSType

type FSType string

FSType defines the Filesystem of a Partition

type GPTGuid

type GPTGuid string

GPTGuid is the UID of the GPT partition to create

type GPTType

type GPTType string

GPTType is the GUID Partition table type

type MountOption

type MountOption string

MountOption a option given to a mountpoint

type Partition

type Partition struct {
	Label        string
	Device       string
	Number       uint
	MountPoint   string
	MountOptions []*MountOption

	// Size in mebiBytes. If negative all available space is used.
	Size       int64
	Filesystem FSType
	GPTType    GPTType
	GPTGuid    GPTGuid

	// Properties from blkid
	Properties map[string]string
}

Partition defines a disk partition

func (*Partition) MkFS

func (p *Partition) MkFS() error

MkFS create a filesystem on the Partition

func (*Partition) Mount added in v0.5.0

func (p *Partition) Mount(prefix string, reinstall bool) error

Mount mounts the partition under prefix

func (*Partition) String

func (p *Partition) String() string

String for a Partition

type PrimaryDevice

type PrimaryDevice struct {
	DeviceName      string
	PartitionPrefix string
}

PrimaryDevice is the device where the installation happens.

Jump to

Keyboard shortcuts

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