220.127.116.11.3. Erase the Contents of the Disk Drive
Erasing the contents of a disk drive under Red Hat Enterprise Linux is a straightforward procedure.
After unmounting all of the disk drive's partitions, issue the following command (while logged in as root):
badblocks -ws <device-name>
<device-name>represents the file name of the disk drive you wish to erase, excluding the partition number. For example,
/dev/hdbfor the second ATA hard drive.
The following output is displayed while
Writing pattern 0xaaaaaaaa: done Reading and comparing: done Writing pattern 0x55555555: done Reading and comparing: done Writing pattern 0xffffffff: done Reading and comparing: done Writing pattern 0x00000000: done Reading and comparing: done
Keep in mind that
badblocksis actually writing four different data patterns to every block on the disk drive. For large disk drives, this process can take a long time -- quite often several hours.
Many companies (and government agencies) have specific methods of erasing data from disk drives and other data storage media. You should always be sure you understand and abide by these requirements; in many cases there are legal ramifications if you fail to do so. The example above should in no way be considered the ultimate method of wiping a disk drive.
However, it is much more effective than using the
rmcommand. That is because when you delete a file using
rmit only marks the file as deleted -- it does not erase the contents of the file.