Securely Wipe Hard Drive

Wipe a hard drive securely with a util called shred.

See all your hard drives

Get those out in the open. Let's see what's available by running:

fdisk -l

This will return a lot of stuff: devices, virtual devices, partitions. You're looking for some lines that start with "Disk", and you'll see some "Disk model" information that should sounds like a hard drive, like this Western Digital beauty here:

...
Disk /dev/nvme0n1: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: WD Blue SN570 250GB
...

This disk is identified with /dev/nvme0n1.

You'll see some other stuff like /dev/nvme0n1p1, etc. These are the partitions on the disk. Those are not what you want to target if you're trying to wipe the "whole" disk. Instead, target the disk/device.

Install the tool

We're going to use the shred tool. On Ubuntu derivatives, get it here:

sudo apt install secure-delete

Shred is great

It's great because it takes a while and does a better job. It takes 3 passes over the disk and writes pseudo random data over the whole thing.

Now for the command. Make sure you're sure when you run it:

shred -v /dev/nvme0n1

-v is for "verbose". Hasta data.

Make it Faster

By default, shred will right over each sector 3 times. But, you can write fewer times with -n:

shred -n 1 /dev/nvme0n1