wipefs - wipe a signature from a device
wipefs [options] device...
wipefs [--backup] -o offset device...
wipefs [--backup] -a device...
wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid. wipefs does not erase the filesystem itself nor any other data from the device.
When used without any options, wipefs lists all visible filesystems and the offsets of their basic signatures. The default output is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list in environments where a stable output is required.
wipefs calls the BLKRRPART ioctl when it has erased a partition-table signature to inform the kernel about the change. The ioctl is called as the last step and when all specified signatures from all specified devices are already erased. This feature can be used to wipe content on partitions devices as well as partition table on a disk device, for example by wipefs -a /dev/sdc1 /dev/sdc2 /dev/sdc.
Note that some filesystems and some partition tables store more magic strings on the device (e.g., FAT, ZFS, GPT). The wipefs command (since v2.31) lists all the offset where a magic strings have been detected.
When option -a is used, all magic strings that are visible for libblkid(3) are erased. In this case the wipefs scans the device again after each modification (erase) until no magic string is found.
Note that by default wipefs does not erase nested partition tables on non-whole disk devices. For this the option --force is required.
-O, --output list
-o, --offset offset
The offset argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
-t, --types list
wipefs --all --backup /dev/sdb
dd if=~/wipefs-sdb-0x00000438.bak of=/dev/sdb seek=$((0x00000438)) bs=1 conv=notrunc
Karel Zak <firstname.lastname@example.org>
For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues.
The wipefs command is part of the util-linux package which can be downloaded from Linux Kernel Archive https://www.kernel.org/pub/linux/utils/util-linux/.