Using dd to blank a drive

A lot of well-meaning people dumped their leftovers on me when I mentioned I was using a machine with a floppy drive, and had use for some spares. The things are like coat hangers now though — I have about twice as many as I wanted, and 10 times more than I need.

I also don’t really want to know what was on the floppy before it became mine, so I scrounged around a bit and found this as a command to overwrite the disk, until I find time to actually use it. As an alternative to the shred command. …

dd if=/dev/urandom of=/dev/fd0

The drive assignment is for Debian there, so it might be different for your distro. And changing the destination assignment will work for a USB drive or something else too. My primary school maths teacher taught us that we should always check our work, so …

dd if=/dev/fd0 count=1 | hexdump -C

That gives you a quick look at the earliest part of the floppy, so you can check and make sure what’s there is more or less unreadable. I don’t know if it’s a terrifically secure method or proof against forensics efforts, but neither of those is really a concern for me. 🙂

10 thoughts on “Using dd to blank a drive

  1. Mehall

    I hate to say wrong to you, but dd is actually by far one of the best ways to blank a drive. However much faith you put into DBaN, dd does the job so well, that if it completes a run (even if using /dev/null instead of /dev/urandom like you suggested) that many professional forensics recovery companies will refuse to try, as it is a waste of their time and your money.

    dd is a fantastic tool. Whenever I get a machine that I may have to return to the original owner, or to someone else significantly clueless about computers, I make a disk image to my external HDD, then wipe the disk (all using a live CD) using dd for both operations. a quick run of gParted later, and the disk is ready to have a new OS installed, but if I need to return it to the condition I got it in, dd will do exactly that given the disk image instead of /dev/null

    Reply
  2. anonymous coward

    and then there’s always the ‘badblocks’ command which comes with the ‘e2fsprogs’ package which allows you to check for … well, bad blocks on a device. I used to use the -w option almost all the time…

    Reply
    1. anonymous coward

      d’oh! 😉 here’s what the man page says about the ‘-w’ option:

      With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing the contents.

      Reply
      1. Luca

        That sounds like a better way, as it’ll also check the integrity of the device. Depending on how un-random it is, it should also not take much longer.

        Reply
  3. Pingback: Links 6/2/2010: GNOME Journal Released, ARM CEO Sees Bright Future | Boycott Novell

  4. anonymous coward

    Several passes with /dev/urandom (while syncing in between passes) is by far one of the best methods you can use to destroy data. Even if you’re worried about forensic recovery.

    Whenever I need to destroy a partition, I use:

    for i in {1..5}; do dd if=/dev/urandom of=/dev/sdXX bs=1M && sync; done

    Reply
  5. Pingback: Thinking things through: dd over USB1.1 « Motho ke motho ka botho

  6. Pingback: Bonus: A massive missive of omission | Inconsolation

  7. Pingback: Bonus: A massive missive of omission | Linux Admins

Leave a reply to Mehall Cancel reply