Securely Deleting Data

by Scott, Revised on September 10, 2015 (Linux)

Using Shred

File

shred -uvz -n 3 ./filename

Partition

shred -vz -n 3 /dev/hda[1,2,3,...]

Flag Descriptions

-u --remove - Truncate and remove file after overwriting
-v, --verbose - Show progress
-z, --zero - Add a final overwrite with zeros to hide shredding
-n N, --iterations=N - Overwrite N times

Using Secure-Delete

On Debian or derivative:

apt-get install secure-delete

Securely delete a file:

srm filename

Securely delete a directory:

srm -r dirname/

Secure memory wipe:

smem

Secure free space wipe:

sfill mountpoint

Secure swap wipe:

swapoff /dev/sdaN
sswap /dev/sdaN
swapon /dev/sdaN

Tags: Linux