How to securely wipe a hard drive or USB drive in Linux using dd or scrub

Normally we’d use dd to clean wipe a hard drive as follows after opening a terminal window for a hard disk or USB drive accessible as /dev/sdb :
$ sudo dd if=/dev/urandom of=/dev/sdb status=progress <enter>

Another command to do a secure wipe of /dev/sdb is scrub that can be used as follows:
$ sudo scrub -p dod /dev/sdb <enter>

Note that the above commands completely wipe data and if run by accident will cause data loss. Exercise due caution when using them.

3 thoughts on “How to securely wipe a hard drive or USB drive in Linux using dd or scrub

  1. These should work on an SSD too, right ? If you fill an SSD to capacity with random data, you’ve overwritten all the blocks (except over-provisioning and bad-blocks) regardless of any remapping or wear-leveling done by the firmware.

    Like

Comments are closed.