util-linux/disk-utils
Karel Zak ab02d87e4f sfdisk: add --backup and --backup-file
The option --backup force sfdisk to store *all* fragments of the
partition table (including MBR partition tables store in the
extended partitions) to

	$HOME/sfdisk-<devname>-<offset>.bak

The options -O, -backup-file <path> allows to override the default
path, but sfdisk still appends <devname>-<offset>.bak to the <path>.
The backup files always contain only raw data from the device, so it's
possible to use dd(1) to restore original data on the device.

The original sfdisk also supported -O <file>, but semantic was little
bit different:

   - all was based on 512-byte sectors
   - all sectors was stored to the one file in format
	  <offset>|<sector>|<offset>|...

this original concept makes the backup files specific to sfdisk and with
dependence on sector size.

The new concept is the same we already use for wipefs(8) backup files.

Example (disk with GPT):

   # sfdisk /dev/sda --backup

   Welcome to sfdisk (util-linux 2.25.202-f4deb-dirty).
   Changes will remain in memory only, until you decide to write them.
   Be careful before using the write command.

   Backup files:
          PMBR (offset     0, size   512): /root/sfdisk-sda-0x00000000.bak
    GPT Header (offset   512, size   512): /root/sfdisk-sda-0x00000200.bak
   GPT Entries (offset  1024, size 16384): /root/sfdisk-sda-0x00000400.bak

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
..
Makemodule.am sfdisk: implement --list 2014-10-07 14:55:30 +02:00
addpart.8 docs: fix inconsistencies in man pages 2014-08-06 14:50:20 +02:00
addpart.c translation: unify file open error messages 2012-07-16 18:18:22 +02:00
blockdev.8 blockdev: Some minor corrections to the manual 2014-04-07 12:18:04 +02:00
blockdev.c blockdev: don't use HDIO_GETGEO 2013-11-04 15:09:18 +01:00
cfdisk.8 docs: improve wording and formatting of the man page of cfdisk 2014-07-15 13:22:26 +02:00
cfdisk.c libfdisk: return partno when add new partition 2014-10-07 14:55:31 +02:00
cramfs.h cramfs.h: coding style 2011-07-21 23:50:04 +02:00
cramfs_common.c mkfs.cramfs: fix compiler warning [-Wmissing-prototypes] 2012-07-16 18:57:30 +02:00
delpart.8 docs: fix inconsistencies in man pages 2014-08-06 14:50:20 +02:00
delpart.c translation: unify file open error messages 2012-07-16 18:18:22 +02:00
fdformat.8 fdformat: fixing copy'n'paste issue in the manual 2014-09-16 11:14:25 +02:00
fdformat.c fdformat: clean up usage() 2014-07-29 13:53:26 +02:00
fdisk-list.c sfdisk: add --verify 2014-10-07 14:55:31 +02:00
fdisk-list.h sfdisk: add --verify 2014-10-07 14:55:31 +02:00
fdisk-menu.c libfdisk: (gpt) use generic API to change UUID and name 2014-10-07 14:55:31 +02:00
fdisk.8 fdisk: don't use --geom-* prefix for CHS options 2014-06-30 15:10:29 +02:00
fdisk.c sfdisk: add --verify 2014-10-07 14:55:31 +02:00
fdisk.h fdisk: move --list functionality to separated file 2014-10-07 14:55:30 +02:00
fsck.8 various: erase all traces of the long-obsolete xiafs 2014-07-28 11:16:57 +02:00
fsck.c various: erase all traces of the long-obsolete xiafs 2014-07-28 11:16:57 +02:00
fsck.cramfs.8 fsck.cramfs: update man page (--extract and --blocksize) 2014-05-19 23:49:26 +02:00
fsck.cramfs.c textual: fix some typos and inconsistencies in various messages 2014-07-23 08:56:00 +02:00
fsck.minix.8 fsck.minix: A few typographical corrections to the manual 2014-04-07 12:30:17 +02:00
fsck.minix.c fsck.minix: check writing to a file descriptor was successful 2013-04-26 13:26:07 +02:00
isosize.8 isosize: A few typographical changes to the manual 2014-04-07 12:30:17 +02:00
isosize.c isosize: make --divisor to require argument 2014-02-17 14:16:21 +01:00
minix_programs.h minix: change types in header file 2012-12-19 11:38:51 +01:00
mkfs.8 various: erase all traces of the long-obsolete xiafs 2014-07-28 11:16:57 +02:00
mkfs.bfs.8 mkfs.bfs: One typographical correction to the manual 2014-04-07 12:31:42 +02:00
mkfs.bfs.c textual: use manual tail usage() macro 2014-10-01 12:33:24 +02:00
mkfs.c textual: use usage() text element macros 2014-10-01 12:33:26 +02:00
mkfs.cramfs.8 mkfs.cramfs: Some typographical corrections to the manual 2014-04-07 12:31:48 +02:00
mkfs.cramfs.c mkfs.cramfs: use defined failure name rather than magic value 2014-07-13 18:35:32 +01:00
mkfs.minix.8 mkfs.minix: Some typographical changes in the manual 2014-04-07 12:31:48 +02:00
mkfs.minix.c textual: use version printing macro everywhere 2014-10-01 12:33:23 +02:00
mkswap.8 mkswap: Some minor typographical corrections to the manual 2014-04-07 12:31:48 +02:00
mkswap.c build-sys: remove obsolete wholedisk.c 2014-06-17 12:16:29 +02:00
partx.8 docs: fix inconsistencies in man pages 2014-08-06 14:50:20 +02:00
partx.c libsmartcols: add debug messages 2014-06-06 13:47:06 +02:00
partx.h resizepart: add new command 2012-08-13 22:10:14 +02:00
raw.8 raw: Improve the typesetting of the manual 2014-04-22 12:14:17 +02:00
raw.c raw: use LC_ALL 2013-10-18 11:38:02 +02:00
resizepart.8 docs: fix inconsistencies in man pages 2014-08-06 14:50:20 +02:00
resizepart.c resizepart: check writing to a file descriptor was successful 2013-04-26 13:26:06 +02:00
sfdisk.8 sfdisk: Improve the typesetting of the manual 2014-04-22 12:14:28 +02:00
sfdisk.c sfdisk: add --backup and --backup-file 2014-10-07 14:55:32 +02:00
swaplabel.8 swaplabel: Improve the typesetting of the manual 2014-04-22 12:14:38 +02:00
swaplabel.c swapon: split swapon-common.c 2014-09-22 13:16:25 +02:00