I have an older tiny HDD of 80GB and I am planning to give it to a friend or donate it to the local hacklab, but before it goes out of the house I want to make sure that nobody (at least with the technology available to most individuals) can restore what was on the disk. There was nothing very important or secretive on it, but people snooping around my files creeps me out a bit.
There are many ways to completely erase a hard disk drive, a partition or individual files with the GNU/Linux utility called shred.
The command to use is very simple:
sudo shred -n <NUMBER OF ITERATIONS> -vz /dev/to/hddOrPartition
And to shred a file:
shred -n <NUMBER OF ITERATIONS> -v file1 file2 file3 etc
It should be executed as super user/root so that there will be full access to erase/write everything. I use about 20 iterations (default is 25), because that seems like enough to me. The -z option means to run an extra run at the end which will zero the drive which will hide the shredding (in -n is 20, there will be total of 21 passes). -v is verbose, to show progress of the task.
WARNING: please be VERY careful about the disk/partition that you select because EVERYTHING on it will be deleted. Create backup before the command is executed!