I need to wipe all data of a number of hard drives, from Ubuntu Linux. I have found three command line tools: shred, wipe and dd. It seems kind of random what people recommend. Sometimes someone recommends one over the other, but they don't really specify why.

What are the advantages / disadvantages when comparing these tools?

  • 3
    Could someone with enough points consider adding a new tag "data-erasure" or similar. en.wikipedia.org/wiki/Data_erasure – Mads Skjern Oct 25 '14 at 9:45
  • 3
    Drive over them with your car. Drill holes and pour in acid. Put them on a charcoal fire for about an hour. – Daniel R Hicks Oct 25 '14 at 12:07

What are the advantages / disadvantages when comparing these tools?

It depends on your goals:

  1. Are you wiping really sensitive data none should ever see (e.g. medical information)?
  2. Are you just following a 'I should do this because it is right'?
  3. Or the even weaker 'I have to wipe to be rules compliant'.

In the last case (3: rules) add the requirements to your post so we can factor those in.

In case 2: For rotating HDDs I just tend to wipe the disks once and then whack them with a hammer. The last is mostly just so people do not grab them from the waste bins and then come back for support.

In case 1: (a secure wipe) I will try two things:

  • If it is a SSD then I will tell the drive to secure erase itself. This is quick and safe. (Data on SSD's tend to be encrypted. Throwing away the key to that encryption makes the data worthless).
  • If it is a rotating harddisk I will try the same (some model support the command, some do not). If it is not supported I'll use whatever tool I have at hand. Until now that mostly was dd because I am more familiar with it and it always was preinstalled,

Shred seems to be for wiping files. Which means it might well wipe the file but not previously deleted information on the disk. In which case I would not use it to wipe whole disks.

Disclaimer: I have not tried it It can shred /dev/sdb or other block devices. In which case it might well work.

The same is true for wipe.

That leaves 'dd', (or the not mentioned badblock) and secure erase by the drive itself.

The last can be done with a single command issued to the drive via hdparm or by booting from this liveCD. In the last case make sure that you wipe the right disk (e.g. only put the disk to wipe in the computer, then boot from the CD).

  • 4
    Shred can wipe block devices perfectly fine. – Journeyman Geek Oct 25 '14 at 10:09
  • I could have been much more specific in my goals/requirements, but I deliberately chose not to, since my goal today may not be the same as the goal next time I need to wipe one. Furthermore I would risk one of those "dd is the best choice in your case", without the reasoning behind it. Also, other SuperUser users may not have the same requirements as me, and I thought it was in the spirit of StackExchange to make general questions / answer, useful to many more then the OP. – Mads Skjern Oct 25 '14 at 10:11
  • But since you ask: I don't have any very sensitive data. And I would like a tool that is relatively easy to use, ie does not require hours of reading/studying to use correctly. – Mads Skjern Oct 25 '14 at 10:13
  • It is a rotating disk – Mads Skjern Oct 25 '14 at 10:15
  • In that case and if your bandwidth is not capped, try the DBAN disk. Trivial to use (no study required) and it does a good job. If it is capped or if you are not trying to wipe the disk which is booted: use shred. (Wiping the disk you are booted from is interesting and might not complete. If that is the case boot from another medium. E.g. the CD you used to install the OS with). – Hennes Oct 25 '14 at 10:21

shred can random wipe full drives or partitions and much, much, much more quickly than with dd.

shred -vn 1 /dev/sdxx
  • 7
    Why more quickly than dd? Shouldn't it be bound by disk I/O, just as dd? – dirkt Sep 12 '16 at 19:08
  • 1
    Also, do you have a source for that claim? Seems pretty impressive, if true. – Hashim Aziz Oct 18 '17 at 23:01
  • 1
    gnu.org/software/coreutils/manual/html_node/… - "less effective on modern filesystems" from how I read it. Partition or disk shredding recommended. Also "default three-pass approach" - hardly makes it faster than dd. – Hannu Oct 19 '17 at 16:37

I've found that scrub will also do the job, in both cases of files and physical disks/partitions.
You can use:

scrub /path/to/my/file 
scrub /dev/sda1 
scrub /dev/sda

Respectively scrubbing a file, a partition and a whole physical disk. Hope this helps!

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.