Here’s how to securely wipe the Empty Space on a drive, leaving the used space alone.

Open a Linux Terminal window from a folder on the disk where you want to secure erase the unused space.

In Terminal:

dd if=/dev/urandom of=zero.small.file bs=1024 count=102400 
cat /dev/urandom > zero.file 
rm zero.small.file 
rm zero.file

That makes a small file (100 MB = 1024x1024x100 bytes) filled with a random character,

then fills the disk with a random character (which takes a very long time),

then sync (prevents a smart disk cache from blocking writing to disk),

then deletes the small file so the time you have with “disk full” is short,

then deletes the big ‘zero.file’.

Run this several times for even more security, if you really need to.

Instead of /dev/urandom you can use /dev/zero to fill the disk with zeros.

All the sectors that are filled, will be tested by the drive’s SMART test, and any bad blocks will be marked so they aren’t used any more.

You should then check the SMART disk tool, to make sure there are few bad blocks; if there are many, or the number increases over time, immediately move data to a new drive and discard this one.

Pin It on Pinterest

Share This