How Do I Erase A Partition or Entire Disk?

Maybe this topic shouldn't be under the area of recovery as its more of a anti-recovery issue. However, if you are getting ready to discard, or give away an old hard disk, its a good idea to clear the contents. There are several ways in which you can do this:

The following examples demonstrate how one might erase the entire contents of the hard disk mapped to /dev/hda.

Warning

DO NOT run any of the commands shown below if you have any important data left on your hard drive. These commands clear everything (including your partition tables).

Example 12.1. Using wipe To Erase IDE Drive


[root@probe ~]# wipe /dev/hda
[root@probe ~]# 

Example 12.2. Using /dev/zero To Erase 40GB IDE Drive


[root@probe ~]# time cat < /dev/zero > /dev/hda
cat: write error: No space left on device

real    532m0.313s
user    0m10.373s
sys     530m9.836s
[root@probe ~]# 

Example 12.3. Using /dev/urandom To Erase 40GB IDE Drive


[root@probe ~]# time cat < /dev/urandom > /dev/hda
cat: write error: No space left on device

real    33m33.869s
user    0m9.741s
sys     5m40.749s
[root@probe ~]#