0.1.2 • Published 5 years ago

relativize-sfdisk-dump-pmb v0.1.2

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

relativize-sfdisk-dump-pmb

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.

API

This module exports one function:

relativize(input)

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.

Usage

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

Known issues

  • Needs more/better tests and docs.

 

License

ISC