Interactive drive partitioner
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Bryan c0c19bca92 build: the shell's cd is go
Bryan's pending change to the build script, committed as it stood.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 18:32:03 +02:00
scripts build: the shell's cd is go 2026-10-22 18:32:03 +02:00
.gitignore Initial commit 2026-09-26 11:30:28 +02:00
commands.talc Initial commit 2026-09-26 11:30:28 +02:00
device.talc (unchecked): device.talc uses raw primitives and says so 2026-10-22 18:29:26 +02:00
gpt.talc Initial commit 2026-09-26 11:30:28 +02:00
partitioner.talc Initial commit 2026-09-26 11:30:28 +02:00
README Initial commit 2026-09-26 11:30:28 +02:00
VERSION Initial commit 2026-09-26 11:30:28 +02:00

partitioner: an interactive GPT partition editor for talc systems.

  gpt.talc          the GPT and protective-MBR on-disk formats: bytes in,
                    bytes out, nothing touches a device. Its header
                    comment is the reference for the format itself.
  device.talc       opening a device, asking the kernel its size and
                    sector size, reading and writing at an absolute byte
                    offset, and BLKRRPART -- what (system files) does not
                    expose, since it only ever reads and writes a file
                    sequentially.
  commands.talc     the in-memory plan (plan-state) and the command
                    language that changes it; its header comment lists
                    every command. Nothing here touches a device except
                    (write).
  partitioner.talc  the program: opens the device, reads whatever table
                    is already there, and runs the read-eval-print loop.
  scripts/build.sh  builds it
  scripts/build.talc  the same build, as a talc-shell script

Build:

  scripts/build.sh

or, from an already-built shell, the same build as a talc-shell script:

  shell scripts/build.talc

Either way it needs the installed toolchain (compiler on PATH).

USING IT. Give it a device or, to try it out without one, a plain file
the size you want the disk to be (truncate -s 1GiB disk.img):

  partitioner /dev/sdb
  partitioner disk.img

It prints what it found -- the sector size, the sector count, an
existing table if there is one -- and then reads commands, one
s-expression a line, printing each straight back, the way fdisk reads
one letter a line:

  /dev/sdb:  sector size 512, 2097152 sectors
  no partition table here yet -- (create-table) to start one
  type (help) for the commands; (quit) or end-of-input to stop
  > (create-table)
  new empty GPT table
  > (add-partition (type esp) (size 512 MiB) (name "ESP"))
    1: esp  2048..1050623  (512.0 MiB)  "ESP"  guid=...
  > (add-partition (type linux) (size remaining) (name "root"))
    2: linux  1050624..2097118  (511.5 MiB)  "root"  guid=...
  > (write)
  written to /dev/sdb
  the kernel re-read the partition table
  > (quit)

Nothing touches the device until (write): every other command only
changes the plan in memory, so a run with no (write) is a dry run. (help)
at the prompt lists every command, the type names (esp, linux,
linux-swap, linux-lvm, bios-boot, or (type "GUID") for anything else),
the size units, and the flag names.

Checked against util-linux's sfdisk and fdisk on a plain-file disk image
(cross-reading label-id, partition GUIDs, types, sizes, attrs, and both
the primary and backup headers) while this was built; worth the same
check again after any change to gpt.talc.