]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wipefs: print all signature permutations
authorKarel Zak <kzak@redhat.com>
Fri, 26 May 2017 11:11:37 +0000 (13:11 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 28 Jun 2017 08:28:41 +0000 (10:28 +0200)
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>
misc-utils/wipefs.8
misc-utils/wipefs.c

index b7c7467feb585bf98b02011372fc0cd9658b949c..283c0b0e5ac4938517bb04307fc2f59ab66d01db 100644 (file)
@@ -16,9 +16,9 @@ can erase filesystem, raid or partition-table signatures (magic strings) from
 the specified
 .I device
 to make the signatures invisible for libblkid.
-
 .B wipefs
 does not erase the filesystem itself nor any other data from the device.
+
 When used without any options, \fBwipefs\fR lists all visible filesystems
 and the offsets of their basic signatures.
 
@@ -27,14 +27,10 @@ calls the BLKRRPART ioctl when it has erased a partition-table signature
 to inform the kernel about the change.
 
 Note that some filesystems and some partition tables store more magic strings on
-the device.  The
+the device (e.g. FAT, ZFS, GPT).  The
 .B wipefs
-command lists only the first offset where a magic string has been detected.  The device
-is not scanned for additional magic strings for the same filesystem.  It is possible
-that after a \fBwipefs -o \fIoffset\fR the same filesystem or partition
-table will still be visible because of another magic string on another offset. The
-option \fB\-\-no\-act\fR is also affected by this behavior and only the first
-magic string for the filesystem is reported.
+command (since v2.31) lists all the offset where a magic strings have been
+detected.
 
 When option \fB-a\fR is used, all magic strings that are visible for libblkid are
 erased. In this case the
index 87abba39be7bf977fc91ee4948fdec775c596ebb..e17d6b4a0d32f967df2120ba83c39fcf5ea97696 100644 (file)
@@ -281,6 +281,10 @@ read_offsets(struct wipe_desc *wp, const char *devname)
                wp = get_desc_for_probe(wp, pr);
                if (!wp)
                        break;
+
+               /* hide last detected signature and scan again */
+               blkid_probe_hide_range(pr, wp->offset, wp->len);
+               blkid_probe_step_back(pr);
        }
 
        blkid_free_probe(pr);