I'm planning to sell off my old computer, and I wanted to find a way to make sure the hard drive is completely wiped clean.
Here in this short post is the quick way to accomplish this.
Warning to any reader. The following commands will completely wipe a drive clean. Use with extreme caution. Boot up the system with the Ubuntu live DVD.
Find the name of the drive using fdisk by typing in
fdisk -l (that's the letter L not the number 1)
My drive is called sda. If you have more than one drive connected, it may be a good idea to turn the pc off and unplug the other drives. Double and triple check that you have chosen the correct drive to format.
Enter the following to format the drive.
dd if=/dev/zero of=/dev/sdaTo make completely sure that the drive is erased run the shred command next.
sudo shred /dev/sdaThe drive will be wiped clean and ready to be partitioned. Simple and quick.
POST EDIT:Thanks to the comments of an anonymous reader, I have been further educated on the use of the shred command. I did a bit more research and found that although shred is effective under normal conditions to clean a hard drive, I did not take into consideration the fact that this would not include the empty areas of the hard drive that may have had information previously stored there. There could also still be copies of data in RAM and the swap area as well to would not get erased.
Secure-delete, which can be found in the Ubuntu repository, will truly guarantee that your data will be wiped totally clean.
There are four commands that can be used with this tool.
srm -secure remove Removes files and directories from the hard drive
smem -secure memory wiper Goes after the data in the memory/RAM
sfill -secure free space wiper All data from free areas on drive will be erased
sswap -secure swap wiper The SWAP partition will be purged of all data with this command
Thank you to one of my readers who helped to educate me a bit more on this topic. Feel free to add a comment if you have anything else that you can add to help out.