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>
Some filesystems (e.g. FAT) is possible to detect in many ways -- for
example if a magic string is stored on more places on the device. The
current implementation always removes from the device only the firstly
detected possibility.
# wipefs /dev/sdb1
offset type
----------------------------------------------------------------
0x36 vfat [filesystem]
UUID: D203-A7F4
# wipefs -a /dev/sdb1
8 bytes [46 41 54 31 36 20 20 20] erased at offset 0x36 (vfat)
# wipefs /dev/sdb1
offset type
----------------------------------------------------------------
0x0 vfat [filesystem]
UUID: D203-A7F4
This patch fixes this issue:
# wipefs -a /dev/sdb1
8 bytes were erased at offset 0x00000036 (vfat): 46 41 54 31 36 20 20 20
1 bytes were erased at offset 0x00000000 (vfat): eb
2 bytes were erased at offset 0x000001fe (vfat): 55 aa
Signed-off-by: Karel Zak <kzak@redhat.com>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Currently wipefs process only first device argument and silently ignores
remaining. Print error instead because it can be quite confusing.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>