Documentation ¶
Index ¶
- Constants
- func GenFstab(targetRoot string, entries [][]string) error
- func GetFilesystemByPath(path string) (string, error)
- func GetUUIDByPath(path string) (string, error)
- func LUKSMakeFs(part Partition) error
- func LUKSSetLabel(part *Partition, name string) error
- func MakeFs(part *Partition) error
- func OCISetup(imageSource, storagePath, destination string, verbose bool) error
- func UnmountDirectory(dir string) error
- func Unsquashfs(filesystem, destination string, force bool) error
- func UpdateInitramfs(root string) error
- type Disk
- type DiskLabel
- type Partition
- func (target *Partition) FillPath(basePath string)
- func (part *Partition) GetLUKSMapperPath() (string, error)
- func (part *Partition) GetPath() string
- func (target *Partition) GetUUID() (string, error)
- func (part *Partition) IsMounted() (bool, error)
- func (part *Partition) Mount(location string) error
- func (part *Partition) Mountpoints() ([]string, error)
- func (target *Partition) NamePartition(name string) error
- func (target *Partition) RemovePartition() error
- func (target *Partition) ResizePartition(newEnd int) error
- func (part *Partition) SetLabel(label string) error
- func (target *Partition) SetPartitionFlag(flag string, state bool) error
- func (part *Partition) UnmountPartition() error
- func (part *Partition) WaitUntilAvailable()
- type PartitionFs
- type Sector
Constants ¶
const ( MSDOS = "msdos" GPT = "gpt" )
const ( BTRFS = "btrfs" EXT2 = "ext2" EXT3 = "ext3" EXT4 = "ext4" FAT16 = "fat16" FAT32 = "fat32" HFS = "hfs" HFS_PLUS = "hfs+" LINUX_SWAP = "linux-swap" NTFS = "ntfs" REISERFS = "reiserfs" UDF = "udf" XFS = "xfs" )
Variables ¶
This section is empty.
Functions ¶
func GetFilesystemByPath ¶
func GetUUIDByPath ¶
func LUKSMakeFs ¶
LUKSMakeFs creates a filesystem inside of a LUKS-formatted partition. Use this instead of MakeFs when setting up encrypted filesystems.
func LUKSSetLabel ¶
LUKSSetLabel labels a LUKS-formatted partition. Use this instead of SetLabel when setting up encrypted filesystems.
func UnmountDirectory ¶
func Unsquashfs ¶
func UpdateInitramfs ¶
Types ¶
type Disk ¶
type Disk struct {
Path, Size, Model, Transport string
Label DiskLabel
LogicalSectorSize int `json:"logical-sector-size"`
PhysicalSectorSize int `json:"physical-sector-size"`
MaxPartitions int `json:"max-partitions"`
Partitions []Partition
}
func LocateDisk ¶
func (*Disk) AvailableSectors ¶
func (*Disk) GetPartition ¶
GetPartition attempts to locate a partition by its number. For instance, partition 3 will normally point to `/dev/sda3`, but this might not be the case if partitions have been deleted (see Issue #44). This function searches all partitions in target for the correct one.
func (*Disk) NewPartition ¶
func (target *Disk) NewPartition(name string, fsType PartitionFs, start, end int) (*Partition, error)
NewPartition creates a new partition on Disk with the provided name, filesystem type, and start and end locations.
If fsType is an empty string, the function will skip creating the filesystem. This can be useful when creating LUKS-encrypted partitions, where the format operation needs to be executed first.
type Partition ¶
type Partition struct { Number int Start, End, Size, Type, Path string Filesystem PartitionFs }
func (*Partition) GetLUKSMapperPath ¶
func (*Partition) Mountpoints ¶
func (*Partition) NamePartition ¶
func (*Partition) RemovePartition ¶
func (*Partition) ResizePartition ¶
func (*Partition) SetPartitionFlag ¶
func (*Partition) UnmountPartition ¶
func (*Partition) WaitUntilAvailable ¶
func (part *Partition) WaitUntilAvailable()
WaitUntilAvailable polls the specified partition until it is available. This is particularly useful to make sure a recently created or modified partition is recognized by the system.
type PartitionFs ¶
type PartitionFs string