Thursday, January 15, 2009

Delete, erase, shred, goodbye

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/sda
To make completely sure that the drive is erased run the shred command next.
sudo shred /dev/sda
The 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.

6 comments:

Anonymous said...

CAUTION: Note that shred relies on a very important assumption: that the filesystem overwrites data in place. This is the traditional way to do things, but many modern filesystem designs do not satisfy this assumption. The following are examples of filesystems on which shred is not effective:

* log-structured or journaled filesystems, such as those supplied with

AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)

etc, etc,.


" http://linux.about.com/library/cmd/blcmdl1_shred.htm "

Anonymous said...

"The solution as far as ext3 is concerned is to convert it to a non-journaled system like ext2, run shred and then convert back to ext3. This can be done on the fly."

- http://www.freesoftwaremagazine.com/columns/shred_and_secure_delete_tools_wiping_files_partitions_and_disks_gnu_linux


"Ubuntu users are in luck"
"The solution as far as ext3 is concerned is to convert it to a non-journaled system like ext2, run shred and then convert back to ext3. This can be done on the fly."

- http://www.freesoftwaremagazine.com/columns/shred_and_secure_delete_tools_wiping_files_partitions_and_disks_gnu_linux


"Ubuntu users are in luck"



"
Put shred on steroids

Shred is a powerful command for sure but it doesn’t cover all the angles. For that you need something even more powerful; here Ubuntu users are in luck because they have at their disposal a tool that can deal with data in RAM, free space and in swap.
"

Anonymous said...

"Just apt-get install secure-delete in a console (as root—su) and issue any of the following commands:"



Read that url. Also touches the minimum for DOD standard in Zeroing a drive.

http://www.freesoftwaremagazine.com/columns/shred_and_secure_delete_tools_wiping_files_partitions_and_disks_gnu_linux

Anonymous said...

http://www.freesoftwaremagazine.com/columns/shred_and_secure_delete_tools_wiping_files_partitions_and_disks_gnu_linux

Anonymous said...

Sorry but for some reason I am not able to post the full url to where i copied that information from. And I was not able to edit the original posts.

Ubucrates said...

Thanks for your comments. I've updated my post to include reference to secure-delete.