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.

2 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s