2

I have a large drive (4TB) that I've only written a few gigabytes to. I'm giving it to a friend, so I'd like to zero it out. I know I can zero out the whole drive with dd, but I'd like to know if:

  1. zeroing only the non-zero bits will be faster, and
  2. if so, how to go about doing that.

EDIT: I trust my friend and there's nothing sensitive on the drive anyway, so no worries if zeroing isn't a bullet-proof method of erasing.

1 Answers1

2

Zeroing out non-zero bytes is likely to be error prone and not significantly faster - indeed it's likely to be slower and you will need to read the whole disk to determine what needs to be read.

If you are not overly concerned, and the disk is fairly new (i.e. does not have a lot of fragmentation), you may want to try only overwriting the first X gigabytes of the drive. You can do this with dd and limiting the number of blocks written - but I might be inclined to use pv and just write until I am tired of it (pv shows how much has been piped through it - so is a reasonable proxy of how much has been cleared). I might use a command like:

pv < /dev/zero > /dev/sdX

You can use crtl + c to stop.

davidgo
  • 73,366