isfdisk: improve --backup documentation

* add reference to backup section
* add note that backup is done always after startup
* remove TODO item about --backup, it seems that back after open is
  only way how we can make it with current libfdisk, because
  fdisk_locate_disklabel() returns current in-memory rather than on-disk
  situation.

Addresses: https://github.com/util-linux/util-linux/issues/850
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-12-09 10:56:07 +01:00
parent c340ff0508
commit 03fdf11833
2 changed files with 6 additions and 10 deletions

View file

@ -168,12 +168,6 @@ libfdisk
* support nested labels parsing from dump
see https://github.com/util-linux/util-linux/issues/850
sfdisk
------
- don't backup PT in interactive mode before write to the devices is requested,
see https://github.com/util-linux/util-linux/issues/852
misc
----

View file

@ -141,7 +141,7 @@ Don't create a new partition table, but only append the specified partitions.
Note that unused partition maybe be re-used in this case although it is not the last partition in the partition table. See also *-N* to specify entry in the partition table.
*-b*, *--backup*::
Back up the current partition table sectors before starting the partitioning. The default backup file name is _~/sfdisk-<device>-<offset>.bak_; to use another name see option *-O*, *--backup-file*.
Back up the current partition table sectors before starting the partitioning. The default backup file name is _~/sfdisk-<device>-<offset>.bak_; to use another name see option *-O*, *--backup-file*. See section *BACKING UP THE PARTITION TABLE* for more details.
*--color*[**=**__when__]::
Colorize the output. The optional argument _when_ can be *auto*, *never* or *always*. If the _when_ argument is omitted, it defaults to *auto*. The colors can be disabled; for the current built-in default see the *--help* output. See also the *COLORS* section.
@ -356,7 +356,8 @@ ____
*sfdisk /dev/sda < sda.dump*
____
If you want to do a full (binary) backup of all sectors where the partition table is stored, then use the *--backup* option. It writes the sectors to _~/sfdisk-<device>-<offset>.bak_ files. The default name of the backup file can be changed with the *--backup-file* option. The backup files contain only raw data from the _device_. Note that the same concept of backup files is used by *wipefs*(8). For example:
If you want to do a full (binary) backup of all sectors where the partition table is stored, then use the *--backup* option. It writes the sectors to _~/sfdisk-<device>-<offset>.bak_ files. The default name of the backup file can be changed with the *--backup-file* option. The backup files contain only raw data from the _device_. *sfdisk* writes backup files immediately after startup, this operation is independent, and the backup is done although the device is not modified later.
For example:
____
*sfdisk --backup /dev/sda*
@ -365,10 +366,11 @@ ____
The GPT header can later be restored by:
____
dd if=~/sfdisk-sda-0x00000200.bak of=/dev/sda \
seek=$\((0x00000200)) bs=1 conv=notrunc
dd if=~/sfdisk-sda-0x00000200.bak of=/dev/sda seek=$\((0x00000200)) bs=1 conv=notrunc
____
The same concept of backup files is used by *wipefs*(8).
Note that *sfdisk* since version 2.26 no longer provides the *-I* option to restore sectors. *dd*(1) provides all necessary functionality.
== COLORS