Secure disk wipe


Secure disk wipe

I recently got a new work laptop. Obviously I needed to transfer all my files from the old laptop to the new one. This is a pretty painless process. Normally I just format the disk on the old laptop when I’m done with it and hand it in.

However there are a lot of confidential files and data on my work laptop, and a simple format is not enough to get rid of them. It’s quite easy to recover files from a laptop that have not been deleted securely, and I didn’t want to be held liable if someone were to get hold of the files from my old laptop. I have no guarantees of what the person I hand my laptop to might do with it. It could get stolen, they might be bribed to hand over the hard drive to criminals etc.

So what should I do? Luckily Linux has a useful program called shred which will overwrite a file with garbage multiple times before it deletes it. This is a great solution, but it’s rather tedious to run shred manually on multiple files on my hardrive.

My final solution was to use a combination of find and shred to recursively delete all the files and directories from a given directory. In this case, my /home/ directory.

Here is the command:

find /home/rooiratel/ -type f -exec shred -u -v {} \;

Where /home/rooiratel/ is the root directory of where you want to start deleting from.

Another useful task this does is to rename each file to a series of 0’s before deleting it. I still need to figure out how to do this for directories.

Here is a screenshot of this command in action:

screenshot

You can set the number of times you want shred to overwrite your files with the -n flag. The default is 3, but depending on how paranoid you are or how much time you have, you can set it as high as you like.

Once all of this is done you can format your hard drive as usual and hand in the device. Even if it gets stolen, or handed to a compromised employee, you won’t have to worry that you have inadvertently leaked confidential company files/data.