In this tutorial 5 tools to carry out a full removal of data, wipe, srm, dd, shred and scrub are shown. The programs can be executed from live cd distributions to wipe the hard drive completely.
The wipe command allows us to fully erase data from our disk, it rewrites the sector and flushes the cache making it impossible or very difficult to retrieve the data.
To install wipe on Debian/Ubuntu type:
The wipe command is useful to remove files, directories partitions or disk.
To remove a single file using wipe type:
To report on progress type:
To wipe a directory type:
To wipe a partition or disk speeding up the process add the parameter -q, type:
Note: replace sdx for the proper device.
The last example will wipe everything from the disk or partition without possibility to restore it, type man wipe in the terminal to see all options available.
srm overwrites the data before deleting it, it is a similar option to wipe. To install srm on Debian or Ubuntu type:
Type man srm to see the available options
As you can see similarly to rm you can use
To remove a file:
To remove a directory:
For additional information on srm type:
DD can be used to overwrite a disk. If you formatted a disk you can run the following command to fill the disk with random data, making it impossible to restore. Replace the X for the proper disk. Dd overwrites the disk with zero and allows us to format the device in different formats. It comes by default on Debian and Ubuntu based distributions.
To fill a disk with random data using dd run:
For additional information on shred on the terminal type:
Shred is another alternative to safely remove data, it comes by default on Debian/Ubuntu if it doesn’t type:
Shred is simple to use too, to overwrite a file just type:
After an ls we see the directory is still there,it was overwritten, to remove it after writing add the -u parameter:
As you can see after the -u there is not linuxhintshred directory.
For additional information on shred type:
Scrub is another tool to overwrite data in hard disks, Scrub writes patterns on files or devices making the data retrieval more difficult. Scrub works in 3 modes detailed in the main page, the default mode is the most effective one.
to install Scrub run:
As the man says we can wipe a disk by running:
To create a directory and fill it with files until the system is full run:
For additional information on Scrub option and parameters, in the console type:
I hope you found this tutorial useful to get your data fully removed, should you have any inquiry contact us opening a ticket support at LinuxHint Support. Keep following LinuxHint for more tips and updates on Linux.