Skip to content

io.systemd.Repart

API for declaratively re-partitioning disks using systemd-repart.

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/repart
Socket /run/systemd/io.systemd.Repart
Available since systemd v260
Methods · types · errors 2 · 2 · 4

Methods

Run

streaming optional

Invoke the actual repartitioning operation, either in dry-run mode or for real. If invoked with 'more' enabled will report progress, otherwise will just report completion.

func (c *Client) Run(ctx context.Context, in RunIn) (*RunOut, error)
func (c *Client) RunMore(ctx context.Context, in RunIn) iter.Seq2[*RunOut, error]

Parameters

Field Type Description
node ?string Full path to the block device node to operate on. If omitted, dryRun must be true, in which case the minimal disk size is determined.
empty EmptyMode Decides whether to install the OS in addition to what is already on it, or if it shall be erased.
dryRun bool If true this will ponder if the installation would fit, but does not actually write anything to disk. Must be set to false to actually make changes.
seed ?string The seed value to derive partition and file system UUIDs from
definitions []string Path to directory containing definition files.
deferPartitionsEmpty ?bool If true, automatically defer creation of all partitions whose label is "empty".
deferPartitionsFactoryReset ?bool If true, automatically defer creation of all partitions which are marked for factory reset.

Reply

Field Type Description
minimalSizeBytes ?int In dry-run mode returns the minimal disk size required.
currentSizeBytes ?int In dry-run mode returns the size of the selected block device.
phase ?ProgressPhase If used with the 'more' flag, a phase identifier is sent in progress updates.
object ?string If used with the 'more' flag, an object identifier string is sent in progress updates.
progress ?int If used with the 'more' flag, a progress percentrage (specific to the work done for the specified phase+object is sent in progress updates.

ListCandidateDevices

streaming (requires more)

Return a list of candidate block devices, i.e. that support partition scanning and other requirements for successful operation.

func (c *Client) ListCandidateDevices(ctx context.Context, in ListCandidateDevicesIn) iter.Seq2[*ListCandidateDevicesOut, error]

Parameters

Field Type Description
ignoreRoot ?bool Control whether to include the root disk of the currently booted OS in the list. Defaults to false, i.e. the root disk is included.
ignoreEmpty ?bool Control whether to include block devices with zero size in the list, i.e. typically block devices without any inserted medium. Defaults to false, i.e. empty block devices are included.

Reply

Field Type Description
node string The device node path of the block device.
symlinks ?[]string List of symlinks pointing to the device node, if any.
diskseq ?int The Linux kernel disk sequence number identifying the medium.
sizeBytes ?int The size of the block device in bytes.
vendor ?string The device vendor string if known
model ?string The device model string if known
subsystem ?string The subsystem the block device belongs to if known

Types

EmptyMode

Behaviors for disks that are completely empty (i.e. don't have a partition table yet)

Value Description
refuse Refuse to operate on disks without an existing partition table
allow Create a new partition table if one doesn't already exist on disk
require Refuse to operate on disks with an existing partition table, and create a new table if none exists
force Always create a new partition table, potentially overwriting an existing table

ProgressPhase

Progress phase identifiers. Note that we might add more phases here, and thus identifiers. Frontends can choose to display the phase to the user in some human readable form, or not do that, but if they do it and they receive a notification for a so far unknown phase, they should just ignore it.

Value Description
loading_definitions
loading_table
opening_copy_block_sources
acquiring_partition_labels
minimizing
placing
wiping_disk
wiping_partition
copying_partition
formatting_partition
adjusting_partition
writing_table
rereading_table

Errors

Error Go type Description
ConflictingDiskLabelPresent ConflictingDiskLabelPresentError An incompatible disk label present, and not told to erase it.
InsufficientFreeSpace InsufficientFreeSpaceError The target disk has insufficient free space to fit all requested partitions. (But the disk would fit, if emptied.)
DiskTooSmall DiskTooSmallError The target disk is too small to fit the installation. (Regardless if emptied or not.)
NoCandidateDevices NoCandidateDevicesError Not a single candidate block device could be found.