Question: I want to wipe an SSD clean of all its partitions and data, so I can repartition it (this is not for security purposes).

I’ve looked at sudo dd if=/dev/zero of=/dev/sdb bs=1M but if this just fills each partition with zeros, I’m not sure this what I want to do.

I plan to run this command quite often, and I don’t want to exhaust my SSD’s writes. Could anyone give me advice on tackling this problem?

Answer: On an SSD: You can TRIM whole disks or partitions using blkdiscard. It’s not very secure, but practically instant (the disk merely marks all cells as unused).

For security: Use full-disk encryption. Don’t bother wiping the entire disk if it’s encrypted �C you only need to wipe the area containing your keys (e.g. the first 1�C2 MiB of every encrypted partition).

For repartitioning: Again, don’t bother erasing all data. You only need to destroy the filesystems using wipefs, then scrub the first 1 MiB of your disk to purge leftover bootloaders. After you format a partition using mkfs, the OS will simply assume it is completely empty.

(In fact, on Linux, mkfs.ext4 will automatically TRIM the entire partition before formatting it.)