Menu

#41 MBRBACKUP2 broken in 0.53

v1.0_(example)
open
nobody
None
1
2017-09-27
2017-05-29
Andrei B.
No

MBRBACKUP2 (mbr + ebr backups) is broken in version 0.53 (at least).

When calling up this function, sfdisk fails with unknown option "-x".
Some of the following steps also give out errors, probably because of missing or incomplete output from sfdisk.

sfdisk.sav file in the resulting archive is empty.

Tested on 2 separate physical systems with more then one HDD.
Problem exists for both IDE and SATA disk interfaces.

Discussion

  • Michael Setzer II

    At some point sfdisk came out with a newer version, but the new one doesn't list the -x option at all?? So, looks like I missed that the update had caused the problem.

    The help on the old version was:
    sfdisk (util-linux-ng 2.18)
    Usage: sfdisk [options] device ...
    device: something like /dev/hda or /dev/sda
    useful options:
    -s [or --show-size]: list size of a partition
    -c [or --id]: print or change partition Id
    -l [or --list]: list partitions of each device
    -d [or --dump]: idem, but in a format suitable for later input
    -i [or --increment]: number cylinders etc. from 1 instead of from 0
    -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/MB
    -T [or --list-types]:list the known partition types
    -D [or --DOS]: for DOS-compatibility: waste a little space
    -R [or --re-read]: make kernel reread partition table
    -N# : change only the partition with number #
    -n : do not actually write to disk
    -O file : save the sectors that will be overwritten to file
    -I file : restore these sectors again
    -v [or --version]: print version
    -? [or --help]: print this message
    dangerous options:
    -g [or --show-geometry]: print the kernel's idea of the geometry
    -G [or --show-pt-geometry]: print geometry guessed from the partition table
    -x [or --show-extended]: also list extended partitions on output
    or expect descriptors for them on input
    -L [or --Linux]: do not complain about things irrelevant for Linux
    -q [or --quiet]: suppress warning messages
    You can override the detected geometry using:
    -C# [or --cylinders #]:set the number of cylinders to use
    -H# [or --heads #]: set the number of heads to use
    -S# [or --sectors #]: set the number of sectors to use
    You can disable all consistency checking with:
    -f [or --force]: do what I say, even if it is stupid

    The new one has these options???

    Usage:
    sfdisk [options] <dev> [[-N] <part>]</part>
    sfdisk [options] </dev>

    Display or manipulate a disk partition table.

    Commands:
    -A, --activate <dev> [<part> ...]</part> list or set bootable MBR partitions
    -d, --dump <dev> dump partition table (usable for later input)
    -J, --json <dev> dump partition table in JSON format
    -g, --show-geometry [<dev> ...]</dev> list geometry of all or specified devices
    -l, --list [<dev> ...]</dev> list partitions of each device
    -F, --list-free [<dev> ...]</dev> list unpartitions free areas of each device
    -r, --reorder <dev> fix partitions order (by start offset)
    -s, --show-size [<dev> ...]</dev> list sizes of all or specified devices
    -T, --list-types print the recognized types (see -X)
    -V, --verify [<dev> ...]</dev> test whether partitions seem correct
    --delete <dev> [<part> ...]</part> delete all or specified partitions</dev></dev></dev></dev></dev>

    --part-label <dev> <part> [<str>]</str> print or change partition label
    --part-type <dev> <part> [<type>]</type> print or change partition type
    --part-uuid <dev> <part> [<uuid>]</uuid> print or change partition uuid
    --part-attrs <dev> <part> [<str>]</str> print or change partition attributes</part></dev></part></dev></part></dev></part></dev>

    <dev> device (usually disk) path
    <part> partition number
    <type> partition type, GUID for GPT, hex for MBR</type></part></dev>

    Options:
    -a, --append append partitions to existing partition table
    -b, --backup backup partition table sectors (see -O)
    --bytes print SIZE in bytes rather than in human readable format
    --move-data[=<typescript>]</typescript> move partition data after relocation (requires -N)
    -f, --force disable all consistency checking
    --color[=<when>]</when> colorize output (auto, always or never)
    colors are enabled by default
    -N, --partno <num> specify partition number
    -n, --no-act do everything except write to device
    --no-reread do not check whether the device is in use
    -O, --backup-file <path> override default backup file name
    -o, --output <list> output columns
    -q, --quiet suppress extra info messages
    -w, --wipe <mode> wipe signatures (auto, always or never)
    -X, --label <name> specify label type (dos, gpt, ...)
    -Y, --label-nested <name> specify nested label type (dos, bsd)</name></name></mode></list></path></num>

    -G, --show-pt-geometry deprecated, alias to --show-geometry
    -L, --Linux deprecated, only for backward compatibility
    -u, --unit S deprecated, only sector unit is supported

    -h, --help display this help and exit
    -v, --version output version information and exit

    Available columns (for -o):
    gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID
    dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S Start-C/H/S
    bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize
    sgi: Device Start End Sectors Cylinders Size Type Id Attrs
    sun: Device Start End Sectors Cylinders Size Type Id Flags

    For more details see sfdisk(8).

    So, will have to figure out what the options with the newer version are to result in the same kind of opteration??

     
  • Andrei B.

    Andrei B. - 2017-09-27

    I've seen it fail again with 2 kinds of errors:
    G4L-0.53

    • both included the sfdisk failure
    • one of the situations yielded more errors (probably due to sfdisk, but also actual disk layout, because it happened only for certain disks) with "error in expression" (probably bash) and another one with invalid argument to dd. It is likely they are related.
     
  • Andrei B.

    Andrei B. - 2017-09-27

    Apparently the option was removed starting with sfdisk-2.26 (2.25 still has it).
    A quick here: https://www.kernel.org/pub/linux/utils/util-linux/v2.26/ shows in the ReleaseNotes that the sfdisk command has been rewritten.

     

Log in to post a comment.

Auth0 Logo