Secure data removal on linux

less than 1 minute read

If you need to remove files in a secure fashion you can choose secure-delete toolkit:

sudo apt-get install secure-delete

The package contains a few useful programs:


Wipes out the free space and free inodes on the partition containing given directory

sfill /home/folder

Additional options:

 -f - fast mode (less secure)


Wipes out existing files or folders. Before the removal file is overwritten with a few different byte secquences.

srm very_important_file.pdf

Additional options:

       -r  - recursive mode, deletes all subdirectories.

       -f - fast mode (less secure)


Wipes out RAM memory from leftovers of used data:

 sudo sdmem

Additional options:

       -f - fast mode (less secure)


Wipes out data from swap memory. BEWARE! You need to unmount the swap file or partition before using this tool, otherwsie you will probably crash your system.

Umounting swap:

sudo swapoff /dev/sda3

Next we can proceed with wiping:

sudo sswap /dev/hda3

Additional options:

 -f - fast mode (less secure)

Afterwards you can use the swap again:

sudo swapon /dev/hda3