The old output is horrible and useless when more devices specified.
The old format is also too tricky if more signatures detected. The new
output uses one line for each signature, prefixed by device name.
For example my workstation:
# wipefs /dev/sda* /dev/sdb*
DEVICE OFFSET TYPE UUID LABEL
sda 0x1fe PMBR
sda 0x37e4895e00 gpt
sda 0x200 gpt
sda1 0x1fe vfat F2BC-BFEC EFI
sda1 0x0 vfat F2BC-BFEC EFI
sda1 0x36 vfat F2BC-BFEC EFI
sda2 0x438 ext4 c5490147-2a6c-4c8a-aa1b-33492034f927 BOOT
sda3 0x438 ext4 196972ad-3b13-4bba-ac54-4cb3f7b409a4 HOME
sda4 0x438 ext4 d834bc84-0089-4be1-9013-cd8bf35d5ffa ROOT
sda5 0x438 ext4 e8ce5375-29d4-4e2f-a688-d3bae4b8d162 WINE
sda6 0xff6 swap 210337c6-f8b5-4d65-aab5-a0f343fa9ad4 SWAP
sdb 0x200 gpt
sdb 0x1fe dos
sdb1 0x438 ext4 6467a684-0d10-4f61-a301-67bb26934d90
This patch add --noheadings, --json and --output.
Signed-off-by: Karel Zak <kzak@redhat.com>
The commit 92296e9ba2 introduces "try
all permutations for the same superblock". This feature has to be also
available if -o and -t is specified.
Signed-off-by: Karel Zak <kzak@redhat.com>
The same FS/RAID/PT signature may be detected by more ways and on more
places on the device. The libblkid returns only the first detected
signature by default. This patch use blkid_probe_hide_range() to
re-scan device for all possible permutations of the same signature.
For example the default wipefs(8) output as well as --no-act output will
contains primary as well as backup GPT signature now.
Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
The current behavior is to report error and continue, it seems strange:
# blockdev --setro /dev/sdc
# wipefs -a /dev/sdc
wipefs: /dev/sdc: failed to erase xfs magic string at offset 0x00000000: Operation not permitted
/dev/sdc: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
^^^^^^^^^^^
not true
The patch calls err() to exit.
Reported-by: Vratislav Podzimek <vpodzime@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The library libblkid (as well as fdisks) requires protective MBR when
probe for GPT by default. This is unnecessary for wipefs where we're
more promiscuous and we want to delete as much as possible. This patch
enables BLKID_PARTS_FORCE_GPT for wipefs.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1326474
Signed-off-by: Karel Zak <kzak@redhat.com>
'b' is documented as the short option for backup but b was not added
to the optstring on the getopt_long call. Add it.
Signed-off-by: Bill Pemberton <wfp5p@worldbroken.com>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
It's possible the partition contains a partition table (BSD, or hybrid
boot images). It could be unexpected for users that the lost all (or
another) partitions when work with non-whole disk device. Let's
require --force.
For example:
# wipefs --all /dev/sdb
erases all including partition table, but on hybrid disk where the
first partition starts at first sector (so partition table is within
the first partition):
# wipefs --all /dev/sdb1
/dev/sdb1: ignore nested "dos" partition table on non-whole disk device
wipefs: Use the --force option to force erase.
asks for --force.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1077310
Signed-off-by: Karel Zak <kzak@redhat.com>
It's better to be smart than make things inconsistent (without
BLKRRPART kernel still uses the erased PT and udev-db still contains
obsolete information).
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - move BLKID_SUBLKS_BADCSUM login to
blkid_probe_verify_csum()]
Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - don't wipe if failed to create a backup file
- use ts_scsi_debug_init in the regression tests]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Commit c550f728f7 added O_EXCL when
opening the thing to erase. This broke the wipefs utility when used
on anything which isn't an unmounted filesystem. eg. If you use it on
a block device containing partitions, then it won't work because the
kernel recognizes the partitions and so thinks the device is in use.
This change adds the --force option which, when used, undoes the above
flag change. However you still have to use --force most of the time
when erasing something that isn't a plain unmounted filesystem.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
If there are more offset options specified, some could be lost.
Try
pvcreate /dev/sd[bcde]
mdadm -C -l 5 -n4 /dev/md0 /dev/sd[bcde]
mdadm --stop /dev/md0
wipefs -n -o 0x1000 -o 0x218 /dev/sdb
- LVM2 signature remains there
wipefs -n -o 0x218 -o 0x1010 /dev/sdb
- no report about ignored signature
Signed-off-by: Milan Broz <mbroz@redhat.com>
[kzak@redhat.com: - print devname only if more devices specified]
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>