Wiping disks

I’m returning a server to a hoster. I generally trust them and have no reason to believe that they’d go snooping through my disk but it’s always nice to clean things up. There are a lot of tools for this: wipe, secure-delete and several others. But none really fit my use case.

I was trying to clean up free space as I backed up and deleted personal data on the server. During that time I was also migrating services off the server so I wanted to leave it running (performance wasn’t a huge issue here - if it was I might do things differently). And this was spinning magnetic storage.

Most of the free-space delete tools would use /dev/urandom as the source of data to fill up free space. That was incredibly slow. I was erasing a 500g disk; it was filling it up at a rate of 0.1g/minute. Using /dev/zero might be faster but seemed less random. So I went with this option. Likely not as secure as the urandom option but nearly as fast as the zero one. For me this did one pass every 2.5 hours.

for i in {1..25}; do
  for k in {1..8}; do
    for c in "ps auxww" "netstat -pant"; do
      text="$text$($c | md5sum | cut -f1 -d' ' | tr -d a)";
  echo "Pass $i starting $(date).";
  echo $text;
  yes "$text" 2> /dev/null > foo;
  rm -f foo;
  echo "Pass $i done $(date).";

It ran in a screen session for the past 3 days as I moved data and services in little bits of time. Obviously this won’t clear inodes and it’s recurring “randomness” but you’d want to be really determined to get data off of this server now.