relativize-sfdisk-dump-pmb

0.1.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i relativize-sfdisk-dump-pmb

Weekly Downloads

1

Version

0.1.2

License

ISC

Unpacked Size

16.5 kB

Total Files

18

Last publish

Collaborators

  • mk-pmb