Use it when buying or selling a computer
The most important and dangerous component in any PC is the hard drive. Dangerous, not because of any physical risk, but because of the data it holds. Privacy information, important documents, sensitive pictures—it potentially has it all. That’s why it’s important to safely erase any hard drives you’re no longer using.
Don’t trust the basic formatting tools included with your operating system, however. In most cases, these tools won’t actually erase the data, leaving it possible for your files to be recovered. You can deal with this problem by ‘zero filling’ a hard drive, sector by sector. Here’s how to zero fill a hard drive using a Linux live environment.
Why You Should Zero Fill a Hard Drive
Some technical terms are pretty ambiguous, but “zero fill” means exactly that. From start to finish, your hard drive storage is filled with zeroes, erasing any trace of previous files underneath.
This method of formatting a hard drive is extremely effective, especially if you “zero” a drive multiple times to remove any possible trace of your files. Other methods are possible, including filling the drive with random characters, as opposed to zeroes, but the effect is the same.
A zero filled hard drive is an empty drive, making it impossible (or as close to impossible as it can be) for anybody to retrieve your data. If you’re wondering whether this is necessary, here’s an example scenario.
You sell a second-hand PC, formatting the drive in the process, but only choosing to perform a “quick” format. The purchaser runs data recovery on the hard drive, and in the process, acquires your family photos, plain-text passwords, important identity documents, and more.
If you zero fill a hard drive, you eliminate this risk entirely. While it may take a few hours to complete, it can save you significant problems in the future.
Creating a Linux Live Environment
Wiping a hard drive, by design, means that you won’t have an operating system left to run. With that in mind, you’ll need to use a Linux live DVD or USB to allow you to zero fill a hard drive.
These are portable Linux environments that allow you to test distributions out before installing them, but we’ll be using them for a slightly different purpose. Almost every Linux distribution (and supplied Live CD/USB environments) includes the software you need to zero fill a hard drive.
Alternatively, you could connect your hard drive to another PC running Linux, although using a Linux live environment prevents you from accidentally wiping the wrong drive.
You can use the pre-built Linux live environments that common distros like Ubuntu or Debian offer, or create your own using the Linux Live USB creator. For this guide, we’ll be using the Linux live environment of one of the most popular Linux distributions – Ubuntu.
- On another PC, or before you wipe your drive, head to the Ubuntu website and download the ISO file containing the latest desktop version. This can be either the latest release or the Long Term Support release.
- Once downloaded, you’ll need to copy the contents of your ISO file to a DVD or USB drive. If you’re using a USB drive, download and install balenaEtcher to allow you to do this on Linux, macOS, or Windows. The rest of this section will assume you’re using a USB drive for your Ubuntu live environment.
- Open balenaEtcher and click Select Image, selecting the Ubuntu ISO in the process. Click Select Target and select your USB drive. Once both are selected, click Flash to begin copying the Ubuntu ISO files to your drive.
- Once balenaEtcher has finished copying the files to your USB drive, safely remove the drive, then restart your PC. At the loading screen for Ubuntu, select Try Ubuntu Without Installing.
This will boot the Ubuntu live environment, ready for you to begin zeroing your hard drive.
Using shred to Zero Fill a Hard Drive in Linux
The shred command on Linux is a specialist command that will securely erase your drive. Once your Linux live environment has booted up (or once you’ve switched to a separate Linux installation), you can run this command from the terminal to begin.
First, you’ll need to identify the correct hard drive to wipe. Open a terminal window (press Ctrl+Alt+T on your keyboard) and type sudo fdisk -l tol list all of the attached storage devices. Locate your hard drive, taking note of the device label (for example, /dev/sda).
Next, you’ll need to run the shred command. You can customize shred to perform multiple passes, meaning it will zero fill your drive multiple times.
Type sudo shred -n 2 -z -v /dev/sda, where -n is the number of passes, -z will zero your drive, and -v will display the progress of shred as it works.
Be sure to use the correct drive label, replacing /dev/sda with your own. There are no second chances!
SSD owners should use fewer passes, especially if you want to reuse the drive. If that’s the case, set the -n flag to 1, using the command sudo shred -n 1 -z -v /dev/sda and replacing /dev/sda with the correct device label.
Once you’re ready to begin, hit enter to start the process.
It will take some time for the shred command to zero your hard drive, especially if you’re running multiple passes. The larger the drive, the longer the length of time it will take for the process to complete. It will also depend on the system resources available on your PC, as well as your hard drive speed.
Once shred finishes performing a zero fill format on your drive, it will be empty—period. You can then use it again or dispose of it, depending on your own needs.
Erase or Destroy Surplus Hard Drives
If you haven’t got a plan in mind for your unused storage, you need one. Whether you zero fill or drill, knowing how to safely destroy a hard drive can give you peace of mind, ensuring your data is safe from being stolen by others.
It’s pretty difficult to retrieve files from a damaged or destroyed hard drive, but you can certainly try. You can attempt to extract files from a dead hard drive if it fails unexpectedly, although it’s always better to backup your most important files instead.