From 03fdf11833a7dc9ae9128be12e6fffc013a3855b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 9 Dec 2021 10:56:07 +0100 Subject: [PATCH] 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 --- Documentation/TODO | 6 ------ disk-utils/sfdisk.8.adoc | 10 ++++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Documentation/TODO b/Documentation/TODO index 855e032424..eae71648b8 100644 --- a/Documentation/TODO +++ b/Documentation/TODO @@ -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 ---- diff --git a/disk-utils/sfdisk.8.adoc b/disk-utils/sfdisk.8.adoc index 726f44bbc9..f45db414aa 100644 --- a/disk-utils/sfdisk.8.adoc +++ b/disk-utils/sfdisk.8.adoc @@ -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--.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--.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--.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--.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 -- 2.39.2