Disposing of a PC, selling it on or giving it away leaves a security risk if the drive isn’t wiped of old data.
Often this can be done easily with an application like MiniTool Partition Wizard for Windows, easicially if you are able to plug the drive into another PC, or are just dealing with an external drive.
There are times, though, when a drive needs to be wiped and there is no OS on the PC, or you need to deal with a RAID controller or SAS drive or other hardware that can’t easily be swapped into a working PC.
In these instances our old friend Linux can assist, with a few relatively easy commands.
Step 1 – Create a Linux boot drive
One of our favourite Linux distributions is elementary OS. Download the ISO file and then grab Rufus to create a USB boot drive from the ISO. If you need further instructions on this part of the process, the elementary OS website has a how to guide.
Once you have a USB configured, boot from the drive in the PC you want to wipe.
Step 2 – Check the drive paths
The next step is to check the file path, which will often be something like
Click on Applications at the top right, then open Gparted. Once open, it will show the drive paths at the top right. Make sure you have the correct path for the drive you want to wipe.
Step 3 – Destroy the data
Now that we have the drive path, we can run the command to wipe the data. This will take a long time to run, so patience is needed.
Click on Applications at the top right and click the Terminal app. Type in
sudo dd if=/dev/urandom bs=1M of=/dev/sdX
making sure that /dev/sdX matches the path that the Gparted app showed for the drive. Run the command and wait for a few hours, once complete it will show a summary of the wipe process.
If a full DoD (Department of Defense) style wipe is required the command can be rerun as many times as required to rewrite the drive data multiple times.
Quick tip: update the power settings so that the computer doesn’t go to sleep part way through this lengthy process. Click on Applications > System Settings > Power and change the Suspend when inactive for setting to Never.
Step 4 – Optionally monitor the process
If it would be helpful to see the progress, a quick command will show that data fill progress, which will count up to the full capacity of the drive.
The only catch at this point is that we need an Internet connection to install the required libraries. Once connected to a LAN or to WiFi, click the + icon in the Terminal app to open a new tab, then run
sudo apt install sysstat
to install the required tools. Then run the command
watch -n10 sudo iostat -h -p /dev/sdX
and watch the numbers update every ten seconds until the wipe process has completed.