≡ Menu

How to wipe a signature from a disk device on Linux with wipefs command

I recently decommissioned Debian Linux based nas server and moved disk from my nas server to Linux-powered desktop. However, when I run fdisk command, I am getting the following error:
    /dev/sdb: device contains a valid ‘LVM2_member’ signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions
What is a wipefs and how do I use it on Linux?

Each disk and partition has some sort of signature and metadata/magic strings on it. The metadata used by operating system to configure disks or attach drivers and mount disks on your system. You can view such partition-table signatures/metadata/magic strings using the wipefs command. The same command can erase filesystem, raid or partition-table signatures/metadata.

Display or show current signatures

Type the following command:
$ sudo wipefs /dev/sda
OR
$ sudo wipefs /dev/sda1
Sample outputs:

Fig.01: Display current disk or partition signatures or magic strings

Fig.01: Display current disk or partition signatures or magic strings

Be Careful: With just a few keystrokes, wipefs can wipe out part or all of your hard disk signature or working partition. Make sure you use correct device names with the wipefs command.

How do I erase current signatures from /dev/vdb?

The syntax is
$ sudo wipefs --all --force /dev/vdb
You can create a signature backup to the file $HOME/wipefs-{devname}-{offset}.bak:
$ sudo wipefs --all --force --backup /dev/vdb
Sample outputs:

/dev/vdb: 8 bytes were erased at offset 0x00000218 (LVM2_member): 4c 56 4d 32 20 30 30 31

Restores an ext2 signature from the backup file ~/wipefs-sdb-0x00000438.bak

You will also find a signature backup file with the following ls command:
$ sudo ls -l ~/wipefs-*.bak
Sample outputs:

-rw------- 1 root root 8 Feb 27 18:54 /root/wipefs-vdb-0x00000218.bak

To restore, run:
$ sudo dd if=~/wipefs-vdb-0x00000218.bak of=/dev/vdb seek=$((0x00000218)) bs=1 conv=notrunc
Sample outputs:

8+0 records in
8+0 records out
8 bytes copied, 0.00404186 s, 2.0 kB/s

Wiping the entire disk using dd command

You can also use the dd commandt o wipe out a signature from a disk device using the following syntax. The dd command works on Linux, FreeBSD, MacOS and Unix-like operating system. The syntax is:
$ sudo dd if=/dev/zero of=/dev/vdb bs=1M
Sample outputs:

4806672384 bytes (4.8 GB, 4.5 GiB) copied, 18.0002 s, 267 MB/s
dd: error writing '/dev/vdb': No space left on device
5121+0 records in
5120+0 records out
5368709120 bytes (5.4 GB, 5.0 GiB) copied, 18.5783 s, 289 MB/s

OR do secure erase with dd command showing progress bar:
$ sudo dd if=/dev/urandom of=/dev/vdb bs=1M status=progress
Sample outputs:

5348786176 bytes (5.3 GB, 5.0 GiB) copied, 249.005 s, 21.5 MB/s 
dd: error writing '/dev/vdb': No space left on device
5121+0 records in
5120+0 records out
5368709120 bytes (5.4 GB, 5.0 GiB) copied, 250.069 s, 21.5 MB/s

To wipe out just partitions:
$ sudo if=/dev/zero of=/dev/vdb1 bs=1M
To wipe out just the Master boot record (MBR), run:
$ sudo d if=/dev/zero of=/dev/vdb bs=446 count=1

See also
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 0 comments… add one }

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , ,