Interactive drive partitioner
- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Bryan's pending change to the build script, committed as it stood. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> |
||
| scripts | ||
| .gitignore | ||
| commands.talc | ||
| device.talc | ||
| gpt.talc | ||
| partitioner.talc | ||
| README | ||
| VERSION | ||
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.