HOWTO: Quickly Erase/Format/Wipe Your Disks with dd

| No TrackBacks
Quick tip: If you're ever in a situation that requires a simple and dirty wipe/format/erase of a device (USB key, hard disk, whatever), you might find the following HOWTO somewhat useful.  This post assumes you are familiar with Linux.

Note that these instructions tell you how to erase a disk for simple "keep prying eyes away from your data" purposes.  If the device you're erasing contains sensitive data of any kind, and you care about data security, then you should consider "shredding" your device using a tool like DBan (Darik's Boot And Nuke).


#1 - Attach and Locate the Device You want to "Erase"

For a hard disk, you'll probably use /dev/hda.  For a USB key, something like /dev/sdd is most common.  You'll need to locate the correct device special file for your device; these vary from system to system.


#2 - Erase with All Zeros, or a Random Bit Pattern

Once you've located the DSF for your device, you can use dd to erase it by writing out a series of continuous zeros, or a random bit pattern.  For the sake of this example, I'll assume the device you want to erase is /dev/hda.  Erase the device with all zeros:

#/> dd if=/dev/zero of=/dev/hda bs=1024k

Or, erase the device with a random bit pattern using /dev/urandom:

#/> dd if=/dev/urandom of=/dev/hda bs=1024k

BTW, for the curious, you can also generate decent passwords using /dev/random.

Did You Find this Helpful?

Did you find this post helpful, or at least, interesting?

  

About Mark

A Silicon Valley native, Mark Kolich is a full-time Software Engineer and a consultant for hire. A web technologies expert, his current focus is on building powerful and robust cloud-driven web-applications using Java, PHP, Perl, AJAX, DHTML, CSS, and JavaScript. His favorite programming languages are PHP, Java and JavaScript. He uses Linux, enjoys biking to work, loves building great software, and always writes elegant, readable, and maintainable code.

No TrackBacks

No trackbacks attached to this entry.

Twitter (@markkolich)

Translate

About this Entry

This page contains a single entry by Mark Kolich published on September 10, 2009 2:55 PM.

Use JavaScript and jQuery to Get User Selected Text, and then Do Something (Useful?) With It was the previous entry in this blog.

REVIEW: Porter-Cable C2002-WK Oil-Free UMC Pancake Compressor with 13-Piece Accessory Kit is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.