Skip to main content
RunBook Academy

LinuxXIII · Disks and Block DevicesFilesystem signatures

Filesystem signatures and wipefs

Foundation⏱ ~8 minbashblkidwipefslsblk

What you'll learn

  • Explain what a filesystem signature is and why the kernel auto-detects filesystems
  • Use blkid to read signatures
  • Distinguish wipefs list mode from wipefs -a erase mode
  • Use wipefs -a -b to remove a signature before reusing a disk, with a restorable backup
  • Recognize the dangers of accidental wipefs and restore a signature from a -b backup

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

When the kernel sees a block device, it does not run a full filesystem check just to know what is on it. Instead, it reads a tiny marker called a filesystem signature at a known offset. The signature says “this is an ext4 filesystem” or “this is a swap partition” or “this is nothing”.

How signatures work

Read-only / Safeblkid output
$ blkid /dev/sda1 /dev/sda2 /dev/sdb
/dev/sda1: UUID="1a2b-3c4d" TYPE="ext4" PARTUUID="abcd-ef12-3456-7890"
/dev/sda2: UUID="5e6f-7a8b" TYPE="LVM2_member" PARTUUID="fedc-ba09-8765-4321"
/dev/sdb: PTUUID="aaaabbbb" PTTYPE="gpt"

Wiping a signature before reuse

When repurposing a disk, the old filesystem signature can confuse the kernel. The new filesystem’s signature overwrites the old, but ghost signatures in the partition table can linger. wipefs removes the detected signature - but only when you ask it to.

Read-only / Safewipefs list mode
$ wipefs /dev/sda1
DEVICE OFFSET TYPE UUID                                 LABEL
sda1   0x438  ext4 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d data

Illustrative output

To actually erase, use -a (all signatures) and -b (write a restorable backup of each one first):

Data-loss riskwipefs erase mode, device in use
# wipefs -a -b /dev/sda1
wipefs: error: /dev/sda1: probing initialization failed: Device or resource busy

On an unmounted device the same command erases every magic string libblkid can see, rescanning after each erase until none remain, and drops one backup file per signature into $HOME:

Data-loss riskwipefs erase mode
# wipefs -a -b /dev/sdb1
/dev/sdb1: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef
/dev/sdb1: calling ioctl to re-read partition table: Success

Illustrative output

The dangers of wipefs

The same power that makes wipefs useful for repurposing a disk makes it dangerous on a disk you actually wanted:

  • wipefs on the wrong disk removes the only thing that tells the kernel what filesystem is there. The data is intact, but mount cannot find the filesystem.
  • wipefs on a partition that contains a database wipes the filesystem signature. The data is recoverable with time and forensic tools, but the service is down.
  • wipefs is not the same as dd if=/dev/zero. The latter erases data; wipefs only removes the signature.

Knowledge check

Knowledge check · 5 questions

  1. Q1. What does wipefs do to a block device?

  2. Q2. Identifying the filesystem on a block device costs the kernel only a few bytes read at fixed offsets.

  3. Q3. Which of the following are correct for safe wipefs usage? Select all that apply.

  4. Q4. A colleague repurposing a disk runs `wipefs /dev/sdb1`, sees a table of signatures printed, and reports the device is clean. You then run `blkid /dev/sdb1` and it still reports TYPE="ext4". What happened?

  5. Q5. You wiped the wrong partition ten seconds ago. The service is down and mount cannot find a filesystem. Which fact decides whether you are looking at a 30-second fix or a restore-from-backup outage?

Passing score: 75%. Answers are checked in this browser.