I have a laptop that is barely alive. The screen is busted. The power cord is frayed. The power indicator flashes red sometimes. Etc. So I want to wipe the hard drive as effectively as I can before I take it into recycling today. The usual way to do this is to boot DBAN from a flash drive, but, oh no! I don't have a spare flash drive or any CDs!

What is the most effective way to wipe data from a hard drive if one is restricted to trying to do so from the Linux OS currently installed on the drive? Or from the BIOS I suppose. I ask because I assume there is something better than

  1. Classic rm -rf --no-preserve-root /.

  2. dd if=/dev/zero of=/dev/sda or something related.

  3. Remove and disassemble the drive with a hammer. But does that make it harder to recycle? I'm not actually sure how hard drives are recycled. :) But I'd rather not do this.

  • 6
    Take out the hard drive, smash it with a hammer and then bring it all to recycling. – JakeGould Mar 19 at 23:37
  • @JakeGould But that is so laborious! I was hoping for some cheeky answers to this question ;) I might end up smashing it honestly though. Or I'll remove and keep the platters since they make such nice mirrors. – Mike Pierce Mar 19 at 23:41
  • @Moab But, correct me if I'm wrong, you can't unmount the drive/partition from which the OS is currently running. So then you can't use dd or shred on that partition? – Mike Pierce Mar 19 at 23:47
  • @MikePirrce you can run dd on the currently mounted partition. It will work but will crash at the end. – davidgo Mar 20 at 10:01

Use dd (aka: option 2): Simple and effective.

dd doesn't care about mounted filesystems.

It has earned its nickname "Data Destroyer" for a reason

Testing it on a virtual machine yields the results expected. Just add && poweroff to put it out of its I/O error misery.

FWIW, testing indicates poweroff is available even after dd has completely overwritten the drive; I presume Bash loads it into RAM on start.

As per @Andy's comment (while sticking with dd), overwrite the drive multiple times. Chain multiple dd commands together or use a for loop to automate it:

for ((I=0;I<=7;I++)) {
  dd if=/dev/zero of=/dev/sda status=progress;
  echo "Drive has been overwritten $I time(s)";
  • 2
    I agee with a goid dd - but how will it find poweroff when its wiped the drive? Aso, you might want to add the dd comnand to your answer. – davidgo Mar 20 at 9:59
  • I would add that dd is not a secure wipe per the NSA standards as these specify a number of overwrites with random data to ensure the data is unrecoverable. I usually take the hard drives out of laptops before sending the laptop to ewaste and keep the drive around for a while. If I really want to destroy the disks, I will use DBAN from another computer at a later time. nsa.gov/resources/everyone/media-destruction – Andy Mar 20 at 17:58
  • Good point. I've edited my answer. – Shadowcoder Mar 21 at 0:32
  • 1
    @Andy “NSA standards” you are quoting don’t factor in the NSA Advisory LAA-006-2004 which states “…that a single overwrite using the above process is sufficient to render electronic files unrecoverable.” Read more details here. Modern disk drives have denser tracks at the OCD desire to do multiple wipes is based on drives from nearly 20 years ago that had tracks that were not as dense and—as a result—could result in data recovery by specialized software that can glean data from between those gaps. – JakeGould Mar 21 at 0:57
  • 1
    @JakeGould Thank you; I learned something today. – Andy Mar 21 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.