Here are some methods to erase a disk or other device.
Before starting, you need to identify the device. You can find the deviceID using the command
Sources:
lsblk
The following output shows a 1.9TB device at sdc
so its deviceID is c
# lsblk
sda 8:0 0 953.9G 0 disk
├─sda1 8:1 0 512M 0 part
└─sda2 8:2 0 953.4G 0 part
sdb 8:16 0 119.2G 0 disk
├─sdb1 8:17 0 260M 0 part
├─sdb2 8:18 0 16M 0 part
├─sdb3 8:19 0 117.9G 0 part
└─sdb4 8:20 0 1.1G 0 part
sdc 8:32 1 1.9T 0 disk
Rewrite the partition table:
The quickest (and reversible) way is to rewrite the partition table:#sudo fdisk /dev/sdc
Graphically, look for the Accessories | Disks
in Ubuntu and LinuxMint derivatives
Irreversible Wipe
Be very careful with these commands, if you get the wrong device you will wipe a device and never be able to recover it. There are no other warnings. The effect is immediate and irreversible!Write zeros to the device
sudo dd if=/dev/zero of=/dev/sdc1 bs=512 status=progress
Write pseudo-random data
dd if=/dev/urandom of=/dev/sdc bs=512 status=progress
Write very random data
openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero | pv -pterb -s $(sudo blockdev --getsize64 /dev/sdc) | sudo dd of=/dev/sdc bs=1M
Sources:
12 / 2021