The most important and dangerous component of any PC is the hard drive. Dangerous not because of physical risk, but because of the data it contains. Privacy information, important documents, confidential photos – potentially everything. This is why it is so important to securely erase any hard drives you no longer use.
However, don’t trust the basic formatting tools included with your operating system. In most cases, these tools do not erase data, leaving you the option to recover your files. You can solve this problem by “zero filling” the hard disk by sector. Here’s how to zero your hard drive using the Linux Live environment.
Why should you fill in the hard drive zero
Some technical terms are quite ambiguous, but “zero padding” means exactly that. From start to finish, your hard drive storage fills with zeros, erasing all traces of previous files at the bottom.
This method of formatting your hard drive is extremely effective, especially if you zero the drive multiple times to remove any possible traces of your files. Other methods are possible, including filling the disk with random characters rather than zeros, but the effect is the same.
A Zero Filled Hard Drive is an empty drive making it impossible (or nearly impossible) for anyone to get your data. If you’re wondering if this is necessary, here’s an example script.
You sell a used PC, format the drive in the process, but choose only “quick” format. The customer launches hard drive data recovery and in the process gets your family photos, plain text passwords, important identity documents, and more.
If you reset your hard drive, you completely eliminate this risk. While this may take several hours, it can save you serious future problems.
Create a live Linux environment
Cleaning up your hard drive, by its very nature, means you don’t have a working operating system. With this in mind, you will need to use a Linux Live DVD or USB so that you can zero out your hard drive.
These are portable Linux environments that allow you to test distributions before installing them, but we will use them for a slightly different purpose. Almost every Linux distribution (and the supplied Live CD / USB environments) includes the software needed to zero fill the hard drive.
Alternatively, you can connect your hard drive to another Linux PC, although using a live Linux environment prevents the wrong drive from accidentally erasing.
You can use the pre-built Linux live environments that common distributions offer, such as Ubuntu or Debian, or create your own using the Linux Live USB Creator. In this tutorial, we will be using the live Linux environment of one of the most popular Linux distributions, Ubuntu
- On a different PC, or before erasing disk, go to the Ubuntu website. and download the ISO file containing the latest PC version. This can be the latest version or the long term support version.
- After downloading, you will need to copy the contents of the ISO file to DVD or USB stick. If you’re using a USB stick, download and install balenaEtcher so you can do it on Linux, macOS, or Windows. The rest of this section assumes that you are using a USB stick for your Ubuntu live environment.
- Open balenaEtcher and click Select Image, choosing the Ubuntu ISO image in the process. Click Select Target and select your USB drive. With both options selected, click Flash to start copying the Ubuntu ISO files to your drive.
- When balenaEtcher has finished copying files to the USB stick, safely remove the disc and then restart your computer. On the Ubuntu boot screen, select Try Ubuntu Without Installing.
This will boot the Ubuntu live environment and you can start zeroing your hard drive.
Using shred to Zero Fill a Hard Drive in Linux
The shred command in Linux is a special command that will safely clean up your disk. Once your live Linux environment boots (or you go to a separate Linux installation), you can run this command from the terminal to get started.
First, you need to determine which hard drive to erase. Open a terminal window (press Ctrl + Alt + T on your keyboard) and type sudo fdisk -l tol list all attached storage devices. Find your hard drive, note the device label (e.g. / dev / sda).
Then you will need to run the kill command. You can set up shredding to do multiple passes, which means it won’t fill the disc multiple times.
Enter sudo shred -n 2 -z -v / dev / sda, where -n is the number of passes, -z will zero your disk, and -v will display the progress of the shredding while it is running.
Be sure to use the correct drive label, replacing / dev / sda with your own. There is no second chance!
SSD owners should use fewer passes, especially if you want to reuse the drive. In this case, set the -n flag to 1 using the sudo shred -n 1 -z -v / dev / sda command and replacing / dev / sda with the correct device label.
When you’re ready to start, press Enter to start the process.
The shred command will take some time to zero the hard drive, especially if you are doing multiple passes. The larger the disk, the longer it will take to complete the process. It will also depend on the system resources available on your PC as well as the speed of your hard drive.
When Shred has finished zero-fill formatting on your disk, it will go blank – period. Then you can use it again or dispose of it, depending on your needs.
Wipe or destroy redundant hard drives
If you don’t have a plan for using unused storage, you need one. Whether you’re doing zero fill or drilling, knowing how to safely destroy a hard drive can give you peace of mind, ensuring that your data is protected from theft by others.
Recovering files from a damaged or destroyed hard drive is quite difficult, but you can certainly give it a try. You can try to extract files from a dead hard drive if it crashes unexpectedly, although it’s always best to back up your most important files.