Have you ever given or sold a PC to somebody else, but really wanted to completely wipe the hard drive first? Today we’ll show you how to use an Ubuntu Live CD to get your personal information off your PC.
When you delete a file in Windows, Ubuntu, or any other operating system, it doesn’t actually destroy the data stored on your hard drive, it just marks that data as “deleted.” If you overwrite it later, then that data is generally unrecoverable, but if the operating system don’t happen to overwrite it, then your data is still stored on your hard drive, recoverable by anyone who has the right software.
By securely deleting files or entire hard drives, your data will be gone for good.
Note: Modern hard drives are extremely sophisticated, as are the experts who recover data for a living. There is no guarantee that the methods covered in this article will make your data completely unrecoverable; however, they will make your data unrecoverable to the majority of recovery methods, and all methods that are readily available to the general public.
Shred individual files
Most of the data stored on your hard drive is harmless, and doesn’t reveal anything about you. If there are just a few files that you know you don’t want someone else to see, then the easiest way to get rid of them is a built-in Linux utility called shred.
Open a terminal window by clicking on Applications at the top-left of the screen, then expanding the Accessories menu and clicking on Terminal.
Navigate to the file that you want to delete using cd to change directories and ls to list the files and folders in the current directory.
As an example, we’ve got a file called BankInfo.txt on a Windows NTFS-formatted hard drive.
We want to delete it securely, so we’ll call shred by entering the following in the terminal window:
which is, in our example:
Notice that our BankInfo.txt file still exists, even though we’ve shredded it. A quick look at the contents of BankInfo.txt make it obvious that the file has indeed been securely overwritten.
We can use some command-line arguments to make shred delete the file from the hard drive as well. We can also be extra-careful about the shredding process by upping the number of times shred overwrites the original file.
To do this, in the terminal, type in:
shred –remove –iterations=<num> <file>
By default, shred overwrites the file 25 times. We’ll double this, giving us the following command:
shred –remove –iterations=50 BankInfo.txt
BankInfo.txt has now been securely wiped on the physical disk, and also no longer shows up in the directory listing.
Repeat this process for any sensitive files on your hard drive!
Wipe entire hard drives
If you’re disposing of an old hard drive, or giving it to someone else, then you might instead want to wipe your entire hard drive. shred can be invoked on hard drives, but on modern file systems, the shred process may be reversible. We’ll use the program wipe to securely delete all of the data on a hard drive.
Unlike shred, wipe is not included in Ubuntu by default, so we have to install it. Open up the Synaptic Package Manager by clicking on System in the top-left corner of the screen, then expanding the Administration folder and clicking on Synaptic Package Manager.
wipe is part of the Universe repository, which is not enabled by default. We’ll enable it by clicking on Settings > Repositories in the Synaptic Package Manager window.
Check the checkbox next to “Community-maintained Open Source software (universe)”. Click Close.
You’ll need to reload Synaptic’s package list. Click on the Reload button in the main Synaptic Package Manager window.
Once the package list has been reloaded, the text over the search field will change to “Rebuilding search index”.
Wait until it reads “Quick search,” and then type “wipe” into the search field. The wipe package should come up, along with some other packages that perform similar functions.
Click on the checkbox to the left of the label “wipe” and select “Mark for Installation”.
Click on the Apply button to start the installation process. Click the Apply button on the Summary window that pops up.
Once the installation is done, click the Close button and close the Synaptic Package Manager window.
Open a terminal window by clicking on Applications in the top-left of the screen, then Accessories > Terminal.
You need to figure our the correct hard drive to wipe. If you wipe the wrong hard drive, that data will not be recoverable, so exercise caution!
In the terminal window, type in:
sudo fdisk -l
A list of your hard drives will show up. A few factors will help you identify the right hard drive. One is the file system, found in the System column of the list – Windows hard drives are usually formatted as NTFS (which shows up as HPFS/NTFS). Another good identifier is the size of the hard drive, which appears after its identifier (highlighted in the following screenshot).
In our case, the hard drive we want to wipe is only around 1 GB large, and is formatted as NTFS. We make a note of the label found under the the Device column heading. If you have multiple partitions on this hard drive, then there will be more than one device in this list.
The wipe developers recommend wiping each partition separately.
To start the wiping process, type the following into the terminal:
sudo wipe <device label>
In our case, this is:
sudo wipe /dev/sda1
Again, exercise caution – this is the point of no return!
Your hard drive will be completely wiped. It may take some time to complete, depending on the size of the drive you’re wiping.
If you have sensitive information on your hard drive – and chances are you probably do – then it’s a good idea to securely delete sensitive files before you give away or dispose of your hard drive. The most secure way to delete your data is with a few swings of a hammer, but shred and wipe from a Ubuntu Live CD is a good alternative!
This technique isn’t the only way to dispose of data from an old PC, but it just goes to show how truly versatile a Linux Live CD can be when repairing a Windows PC—you can reset your password, clean off a virus infection, recover deleted files, or even recover files from your dead Windows computer. If you don’t want to carry optical media around with you, you can always create a bootable Ubuntu flash drive instead.