Securely Delete Hard Drive Data with ‘Secure-Delete’ Tools

As we all know, deleting files/folders by pressing SHIFT+DELETE or emptying Trash doesn’t mean that we permanently deleted them. The files/folders will reside somewhere in our computer. Data thieves or low enforcement may use data recovery programs to retrieve all our personal and sensitive data’s if they want them.

There are so many methods and tools available to delete and wipe your hdd data’s permanently. In this handy tutorial let us discuss about secure-delete tools and how to use them to delete our data’s effectively.

The secure-delete tools are set of programs that can be used to delete the data’s stored in your hard drive, SWAP, RAM and free disk space.

Install ‘Secure-Delete’ Tools On Ubuntu/Debian/Linux Mint

$ sudo apt-get install secure-delete

The secure-delete package comes with following tools.

1. srm – Secure remove

srm is designed to delete data on mediums in a secure manner which can not be recovered by thieves, law enforcement or other threats.

Syntax:

srm [-d] [-f] [-l] [-l] [-r] [-v] [-z] files

Where:

-d     ignore the two special dot files . and .. on the commandline.

-f     fast (and insecure mode): no /dev/urandom, no synchronize mode.

-l     lessens the security. Only two passes are written: one mode with 0xff and a final mode random values.

-l     -l for a second time lessons the security even more: only one random pass is written.

-r     recursive mode, deletes all subdirectories.

-v     verbose mode

-z     wipes the last write with zeros instead of random data

Example

To securely delete a folder:

$ srm -r test/

To securely delete a file:

$ srm sk.txt

2. sfill – Secure free disk and inode space wiper

sfill is designed to delete data which lies on available diskspace on mediums in a secure manner which can not be recovered by thieves, law enforcement or other threats.

Syntax:

sfill [-f] [-i] [-I] [-l] [-l] [-v] [-z] directory/mountpoint

Where:

-f     fast (and insecure mode): no /dev/urandom, no synchronize mode.

-i     wipe only free inode space, not free disk space

-I     wipe only free disk space, not free inode space

-l     lessens the security. Only two passes are written: one mode with 0xff and a final mode with random values.

-l     -l for a second time lessons the security even more: only one random pass is written.

-v     verbose mode

-z     wipes the last write with zeros instead of random data

directory/mountpoint this is the location of the file created in your filesystem. It should lie on the partition you want to write.

Example

$ sfill -f <mountpoint> or <directory>

3. sswap – Secure swap wiper

sswap is designed to delete data which may lie still on your swap-space in a secure manner which can not be recovered by thieves, law enforcement or other threats.

Syntax:

sswap [-f] [-l] [-l] [-v] [-z] swapdevice

Where:

-f     fast (and insecure mode): no /dev/urandom, no synchronize mode.

-l     lessens the security. Only two passes are written: one mode with 0xff and a final mode with random values.

-l     -l for a second time lessons the security even more: only one pass with random values is written.

-v     verbose mode

-z     wipes the last write with zeros instead of random data

Example

To find the swap partition, run the command:

$ cat /proc/swaps

Sample output:

Filename                              Type            Size          Used    Priority
/dev/sda5                               partition    2086908    0          -1

In my case my swap partition is /dev/sda5. First you should disable swap with following command:

$ sudo swapoff /dev/sda5

After disabling the swap-space, run the following command to wipe swap-space:

$ sudo sswap /dev/sda5

After wiping the swap-space, re-enable your swap-space:

$ sudo swapon /dev/sda5

That’s it. Deleting files with secure-delete tools will take some time to complete. So be patient if you are deleting large files or large hard drives.

Be careful with the above commands, once you deleted that files/folders using above commands, they can not be revived. Good Luck!