/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:
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
🐧 3 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi,
Sorry to make the comment, but the last two commands have typo errors perhaps when you wrote:
“$ sudo if=/dev/zero of=/dev/vdb1 bs=1M”
It should have been:
“$ sudo dd if=/dev/zero of=/dev/vdb1 bs=1M”
When you wrote:
“$ sudo d if=/dev/zero of=/dev/vdb bs=446 count=1”
It should have been:
“$ sudo dd if=/dev/zero of=/dev/vdb bs=446 count=1”
Best regards.
Hi, I think last two commands can be written better, because:
when wrote: “$ sudo if=/dev/zero of=/dev/vdb1 bs=1M”
Should have been: “$ sudo dd if=/dev/zero of=/dev/vdb1 bs=1M”
And when wrote: “$ sudo d if=/dev/zero of=/dev/vdb bs=446 count=1”
Should have been: “$ sudo dd if=/dev/zero of=/dev/vdb bs=446 count=1”
Kind regards.
Okay so I tried and it wiped out my disk. I had no idea about this command though :)