wipefs
Erase filesystem, RAID, and partition table signatures
TLDR
Display signatures for specified device
Wipe all available signature types for a specific device with no recursion into partitions
Wipe all available signature types for the device and partitions using a glob pattern
Perform dry run
Force wipe, even if the filesystem is mounted
SYNOPSIS
wipefs [options] device
PARAMETERS
-a, --all
Wipe all known signatures from the device.
-b, --backup
Create a signature backup file (e.g., wipefs-
-f, --force
Force the wipe operation, even if the device is mounted or contains a partition table. Use with extreme caution as this can lead to data corruption.
-h, --help
Display a help message and exit.
-i, --no-empty
Don't exit with a non-zero status if no signatures are found for the specified offset or type.
-l, --list
List all detected signatures from the specified device. This is a non-destructive operation.
-n, --no-action
Perform a dry run. Show what would be done without actually writing any changes to the device. Highly recommended before destructive operations.
-O, --offset
Specify the byte offset where the signature is located. This allows wiping only a specific signature at a precise location.
-q, --quiet
Suppress output messages, only show errors.
-r, --raw
Use raw output format for the --list option, useful for scripting.
-t, --type
Limit the signature types to be scanned or wiped. Multiple types can be specified comma-separated (e.g., ext4,swap). Known types include filesystems (ext2, xfs, fat, ntfs), LVM, RAID, and partition tables (dos, gpt).
-V, --version
Display version information and exit.
device
The block device or partition (e.g., /dev/sda, /dev/sdb1) to operate on. This argument is required.
DESCRIPTION
wipefs is a utility for erasing filesystem, RAID, or partition table signatures (often called 'magic strings') from a specified block device or partition.
It is commonly used to prepare a disk or partition for a new filesystem or partition table, especially when a device has previously been used and retains old metadata that might confuse other utilities like mkfs or fdisk.
The command can identify a wide range of signatures, including those for various filesystems (e.g., ext, xfs, fat, ntfs), swap areas, LVM, and RAID. It offers options to list existing signatures (-l) or perform a dry run (-n) before committing to a destructive operation, which is highly recommended. As wipefs directly modifies disk metadata, it requires root privileges and should be used with extreme caution to avoid irreversible data loss.
CAVEATS
- Irreversible Data Loss: wipefs permanently removes data. Misuse or incorrect device specification can lead to irreparable data loss. Always double-check the target device.
- Root Privileges: This command requires superuser (root) privileges to operate on block devices.
- Mounted Devices: Wiping a device that is currently mounted, especially with the --force option, can severely corrupt the filesystem and lead to system instability. Always unmount filesystems before using wipefs on them.
- Partition Tables: Removing partition table signatures (e.g., dos for MBR, gpt) will make the entire disk unreadable until a new partition table is created, effectively erasing all partition information.
KNOWN SIGNATURES
wipefs maintains an internal database of known filesystem, RAID, LVM, and partition table signatures (magic bytes). This allows it to accurately identify and target specific metadata for removal. The types recognized by wipefs can be listed using the --help output under the --type option section, which typically includes a wide array of common formats.
SAFETY PRECAUTIONS
Before any destructive operation, it is highly recommended to use wipefs -l
HISTORY
wipefs is a component of the util-linux project, a venerable collection of essential system utilities for Linux. It emerged to provide a more specific, safer, and user-friendly alternative to generic tools like dd for removing filesystem or partition metadata. Its development has focused on accurate signature identification and offering protective features like dry-run and listing capabilities, making it a dedicated tool for disk metadata manipulation.