Docs: recpart

Documentation

recpart

Mode-aware partition planning and apply backend for installation flows.

Overview

recpart handles disk inventory, deterministic partition planning, and plan application. It is the backend of disk-plan on the live ISO. It reads what is on a disk (inspect), plans either a template layout (ab or mutable) or an explicit one (keep, delete, create, resize and format partitions, each with a role), prints the exact sfdisk script and every command, and applies the plan: it partitions, resizes, formats, mounts the new system under --mount-root (default /mnt) and activates swap. It does not install payloads.

Warning
Destructive tool: real apply requires explicit confirmation (--confirm DESTROY). Use --dry-run first: it prints every step and anything apply would refuse.

Usage

Options as printed by recpart --help:

Text
Inspect disks, preview partition changes, and prepare an installation target

Usage: recpart [OPTIONS] <COMMAND>

Commands:
  list-disks  Enumerate candidate target disks
  inspect     Show a disk's partition table, partitions (filesystem, used space, mounts) and free gaps
  plan        Preview partition changes without changing the disk
  apply       Partition, format and mount the target (requires --confirm DESTROY)
  help        Print this message or the help of the given subcommand(s)

Options:
      --json     Emit machine-readable JSON (errors too, on stderr)
  -h, --help     Print help
  -V, --version  Print version

Start here:
  recpart list-disks
  recpart inspect --disk /dev/sda
  recpart plan --disk /dev/sda --mode ab
  recpart apply --disk /dev/sda --mode ab --dry-run

plan and --dry-run leave the disk unchanged. The default layout replaces all
partitions; --layout supplies a custom layout. Read the plan before applying.
Run 'recpart <command> --help' for options; add --json for scripts.

Install Modes

ModeTemplate layout
ab (default)EFI (1 GiB, /boot), ROOT_A (20 GiB, /), ROOT_B (20 GiB, unmounted) and STATE (the rest, at least 4 GiB, /var)
mutableEFI (1 GiB, /boot) and ROOT (the rest, at least 8 GiB, /)

Examples

Discover candidate disks (JSON)
recpart list-disks --json
Show a disk's partitions, filesystems, used space, mounts and free gaps
recpart inspect --disk /dev/nvme0n1
Generate an A/B plan without applying
recpart plan --disk /dev/nvme0n1 --mode ab --json
Dry-run apply for review
recpart apply --disk /dev/nvme0n1 --mode ab --dry-run --json
Real apply (destructive)
recpart apply --disk /dev/nvme0n1 --mode ab --confirm DESTROY
Plan an explicit layout, for example keeping an existing EFI partition for dual boot
recpart plan --disk /dev/nvme0n1 --layout layout.json

Error Codes

Every failure prints a code such as E004; the number is also the exit status. The codes and their meaning are the ErrorCode enum in tools/recpart/src/error.rs.

Boundaries

  • Does: disk inspection, planning, layout checks against the install mode, apply, and install handoff metadata (install target, mounts, root A and B devices)
  • Does not: rootfs extraction (recstrap), fstab generation (recfstab), or system configuration (recsetup)
  • Does not: the A/B roots after installation (recab)

See Also