How to Use the wipefs Command in Linux to Erase Filesystem and Partition Signatures

When repartitioning storage drives, repurposing old hard disks, or provisioning software RAID arrays and LVM volume groups in Linux, disk utilities often fail or issue confusing warnings about existing file systems. Even after deleting a partition table using fdisk or parted, the underlying filesystem magic strings, superblock signatures, and metadata remain intact across the disk sectors. Tools like blkid, kernel udev rules, and installer scripts can continue detecting these ghost signatures, preventing clean volume formatting. The wipefs utility provides a safe, surgical method to inspect, back up, and erase these signatures without needing to zero-fill the entire physical drive.

Understanding How wipefs Interacts with Storage Signatures

Unlike raw destructive utilities such as dd that overwrite millions of sectors with zeros or random bytes, wipefs operates with surgical precision:

  • Magic String Erasure: File systems (such as ext4, XFS, Btrfs, and NTFS), partition tables (GPT and MBR), and RAID arrays write identifiable hexadecimal byte sequences (known as “magic numbers”) at specific sector offsets to identify themselves.
  • Surgical Removal: wipefs scans block devices for these specific signatures and zeroes out only the identifying bytes. This instantly renders the signature invisible to the Linux kernel and userspace tools while leaving surrounding disk blocks untouched.
  • Non-Destructive Backups: Before erasing a signature, wipefs allows administrators to dump the exact byte sequences and sector offsets to a binary file, enabling instant signature restoration if a mistake occurs.

Inspecting Active Signatures on a Device

Before modifying or wiping any disk, run wipefs in read-only inspection mode to view all signatures present on the target block device:

  1. Identify the target drive or partition using lsblk to verify its device path (for example, /dev/sdb or /dev/nvme1n1p1).
  2. Run wipefs without modifying flags to probe the device:
    sudo wipefs /dev/sdb
  3. The command will output a structured table containing four essential columns:
    • OFFSET: The precise byte position where the signature resides.
    • DEVICE: The block device node.
    • TYPE: The detected format (e.g. ext4, gpt, dos, or linux_raid_member).
    • MAGIC: The actual hexadecimal byte string stored on disk.

Creating a Backup Before Erasing Signatures

Because erasing a filesystem superblock or partition table signature cannot be undone once overwritten by a new filesystem, creating a local backup is strongly recommended:

  1. Use the -O (or --backup) option to save signature data prior to removal:
    sudo wipefs --all --backup /dev/sdb
  2. wipefs will write binary backup files to the current user’s home directory under the format:
    ~/wipefs-<devicename>-<offset>.bak
  3. To restore a signature from this backup file at any later stage, use the dd command to write the bytes back to the recorded byte offset:
    sudo dd if=~/wipefs-sdb-0x00000438.bak of=/dev/sdb seek=1080 bs=1 count=2 conv=notrunc

Erasing Signatures Surgically or Globally

Depending on whether you wish to remove a single conflicting filesystem signature or strip the drive completely bare for reprovisioning:

  1. Erasing a Specific Signature by Offset:

    If a drive contains multiple signatures and you only wish to purge a specific stale filesystem while preserving the partition table, specify its byte offset with the -o flag:

    sudo wipefs -o 0x438 /dev/sdb1
  2. Erasing All Signatures Across the Device:

    To completely clear all filesystem, RAID, and partition table signatures so the disk appears completely uninitialised and raw to Linux:

    sudo wipefs --all --force /dev/sdb

    The --force flag ensures that signatures located on active or nested metadata boundaries (such as GPT secondary backup headers located at the final sectors of the drive) are purged.

  3. Triggering Kernel Re-Read:

    After wiping signatures, inform the Linux kernel to re-read the partition table without requiring a reboot:

    sudo partprobe /dev/sdb
  4. Verify that the drive is clean by executing blkid /dev/sdb. If successful, the command will return no output, confirming that all stale storage identifiers have been eradicated.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.