Erasing a Disk Using Linux

Here is a really quick way to erase a disk in Linux. Maybe "erase" is the wrong word -- the command actually fills the entire disk with 0's thereby overwriting any existing data. Assuming the disk you want to erase is /dev/hda, here's what you would run:

dd if=/dev/zero of=/dev/hda bs=1M

Technically, this is a better option than simply "deleting" the data or removing the partitions, as those options make it easier to recover data. So, if the FBI is about to raid your little lab and you only have time to run one command, thats what it should be. 🙂

Write a Comment

Comment

  1. I’ve used this command dozens of times at work since I made this post, but today is the first time I’ve found a use for it outside work.

    My dad’s laptop had a virus and he wanted me to erase everything and reinstall Windows XP. I really didn’t want to simply “format” or overwrite the existing data, because the virus may find a way to live on. Using this command however, I feel a little safer since it fills each and every block with zeros.