progfiguration.localhost.disks

Working with disks, filesystems, etc

Exceptions

NoDeviceFoundWithPartitionLabelError

Common base class for all non-exit exceptions.

InvalidBlockDeviceSpecError

Common base class for all non-exit exceptions.

MissingVolumeGroupError

Common base class for all non-exit exceptions.

DuplicatePartitionLabelError

Common base class for all non-exit exceptions.

EncryptionKeyfileNotFoundError

Common base class for all non-exit exceptions.

EncryptionKeyfileNotSetError

Common base class for all non-exit exceptions.

Classes

FilesystemSpec

WholeDiskSpec

A specification for a whole disk, to give an unpartitioned disk either a filesystem or a volume group

PartitionSpec

A specification for a single partition

LvmLvSpec

A specification for an LVM logical volume

Functions

cryptsetup_open_idempotently(device, keyfile, lukslabel)

Use cryptsetup to open a device idempotently

gptlabel2device(→ str)

Given a GPT partition label, return a path representing the partition device.

is_mountpoint(→ bool)

Return true if a path is a mountpoint for a currently mounted filesystem

Module Contents

class progfiguration.localhost.disks.FilesystemSpec
fstype: str
label: str
label_flag: str = '-L'
options: List[str]
class progfiguration.localhost.disks.WholeDiskSpec

A specification for a whole disk, to give an unpartitioned disk either a filesystem or a volume group

device: str
filesystem: FilesystemSpec | None = None
volgroup: str | None = None
encrypt: bool = False
encrypt_label: str | None = None
__post_init__()
class progfiguration.localhost.disks.PartitionSpec

A specification for a single partition

device: str
label: str
start: str
end: str
filesystem: FilesystemSpec | None = None
volgroup: str | None = None
encrypt: bool = False
__post_init__()
class progfiguration.localhost.disks.LvmLvSpec

A specification for an LVM logical volume

name: str
volgroup: str
size: str
filesystem: FilesystemSpec | None
property device: str
exception progfiguration.localhost.disks.NoDeviceFoundWithPartitionLabelError

Bases: Exception

Common base class for all non-exit exceptions.

exception progfiguration.localhost.disks.InvalidBlockDeviceSpecError

Bases: Exception

Common base class for all non-exit exceptions.

exception progfiguration.localhost.disks.MissingVolumeGroupError

Bases: Exception

Common base class for all non-exit exceptions.

exception progfiguration.localhost.disks.DuplicatePartitionLabelError

Bases: Exception

Common base class for all non-exit exceptions.

exception progfiguration.localhost.disks.EncryptionKeyfileNotFoundError

Bases: Exception

Common base class for all non-exit exceptions.

exception progfiguration.localhost.disks.EncryptionKeyfileNotSetError

Bases: Exception

Common base class for all non-exit exceptions.

progfiguration.localhost.disks.cryptsetup_open_idempotently(device: str, keyfile: str, lukslabel: str)

Use cryptsetup to open a device idempotently

progfiguration.localhost.disks.gptlabel2device(label: str) str

Given a GPT partition label, return a path representing the partition device.

Note that GPT partition labels are NOT filesystem labels made with e2label.

Under udev, we can find this easily via /dev/disk/by-label/$LABELNAME, but using the mdev with Alpine’s default rules, that will not exist, so we have to do it this way.

progfiguration.localhost.disks.is_mountpoint(path: str) bool

Return true if a path is a mountpoint for a currently mounted filesystem