In a partition list from sfdisk --dump
, translate between absolute and
relative partition numbers and offsets. Also translate sizes between sectors
and human-friendly magnitude-suffixed bytes.
This module exports one function:
input
can be an array that contains the dump's lines,
or just a string, in which case it will be split into lines.
Returns an array of translated dump lines.
Translation works both ways, selected based on the unit:
header line.
See the tests for examples.
In JavaScript: see bin/cli.mjs
In your shell:
LANG=C sfdisk --dump /dev/sda | relativize-sfdisk-dump-pmb >ptable.txt
"$EDITOR" ptable.txt
relativize-sfdisk-dump-pmb ptable.txt >sfdisk-script.txt
sfdisk -O /remote/backup/sda.bak /dev/sda <sfdisk-script.txt
- Needs more/better tests and docs.
ISC