When we buy a new computer or give away a hard drive to others or just trash our old computer, it is always a good idea to delete all the information stored on the hard disks. This is particularly important if the computer has been used for business purpose or storing critical personal data such as financial transactions or health records. Just formatting the disk does not help either. Data can still be recovered from a formatted disk. So we shred the data, just like we do with paper documents and files.
Shredding or wiping the disk basically means writing random data to the disk a few times so that the data previously held could not be recovered. The more times random data is written the more difficult it becomes to recover files. Each time random data is written is called a ‘pass’. The time taken to shred the disk depends on the size of the disk and the number of passes. Large disks with higher number of passes could take hours to complete.
There are several tools available to achieve this goal. Some paid, some free. One such free tool that is widely available is the ‘shred’ command in Linux. It is available in almost every distribution. I recently discovered this and put it to great use. I used GParted Live CD for this purpose. On booting up the Live CD on the target system, issue the command
shred -vfzn 5 /dev/sda1
Replace /dev/sda1 with the appropriate drive.
This is the simplest form of this command. Let use see what it does
shred - the command to shred
v – provides verbose output
f – force permission changes to allow overwriting
z – write zeros after final pass to mask shredding
n – number of passes to be made. If this option is not specified, three passes are made by default.
This is the result of the shred command on a test disk under virtual box.
The ‘shred’ command can also be used to securely delete individual files. For example
shred -vfz test.txt
There are few more options available for the ‘shred’ command which can be used to further tune how ‘shred’ works.