Zero (One) writing a disk in Ubuntu

Or in any other Linux, from what I know.

Do a search and most of what you’ll find is this:

dd if=/dev/random of=/dev/sdX bs=1M

The intent is for that to fill a drive with random garbage.  You are also supposed to be able to use /dev/null or /dev/zero as the input to zero-write the drive.

Quite simply, that did not work for me.  I’ve had this problem before and again I spent too long getting around to the approach that actually worked.  As for the part that didn’t work, for all I can tell this command wasn’t actually doing anything even if I let it run for hours or pointed it to a specific partition (e.g., sdh1).

The command that worked!

tr ’00’ ‘\377’ < /dev/urandom | pipebench | sudo dd of=/dev/sdX

This required installing “pipebench” (sudo apt-get pipebench …).

Essentially, this fills a drive with ones instead of zeroes.  I think the idea of that — mostly “just because”.  Piping the translation of the zeroes to ones through “pipebench” gives a benchmark of the data rate.  That allows you to estimate how long until you are done.  Finally, the output is sent to the outfile (of) which is the mount for the drive (sdX).  In about 2.5 hours that wrote a 60GB drive with all 1’s.

This command ends with a “device out of space” error, which is fine.

So, my steps were:

  1. delete all partitions
  2. create one partition for the whole drive (to change the file table)
  3. write 1’s to the entire drive

In theory, said drive is now not possible to recover short of using a professional data forensics lab.  But who’s really that interested in me anyway?

Advertisements

About John

I write about technology interests, cooking, and my own writing (sci-fi and fantasy... sometimes both). I try to keep things light, but sometimes I get side-tracked on an issue that I feel strongly about. No offense is meant, I'm just like any other person who feels strongly about something when I write. View all posts by John

Comments are disabled.

%d bloggers like this: