1. Home
  2. Linux
  3. How to completely wipe erase hard disk drive step by step guide

How To Completely Wipe/Erase A Hard Disk Drive [Step-by-Step Guide]

You may know that when you delete a file, it doesn’t actually get removed from the hard disk. This is because, when an OS, including Windows, attempts to delete a file, it removes the pointer or reference to the file, making it inaccessible to user. However, the low-level data recovery applications can still be used to view and restore deleted data from storage mediums. When file is deleted from the system, OS makes the space, which was previously used by that deleted file, available for new data write operations, and if OS doesn’t fill that deleted space, data recovery application doesn’t take long to fully restore the data from unfilled tracks. Therefore, it’s always advisable to perform a multi-cycle shred operation over entire hard drive to prevent data theft. You could use CCleaner and other data shred/disk wipe applications (Secure Wipe, Hardwipe, HDShredder etc, for instance), to permanently delete the data, but file shredding can’t be performed over the partition where Windows is installed. In this post, we will discuss how to fully wipe out entire hard disk, and make the deleted data unrecoverable.

Using Ubuntu Live Disk To Permanently Delete Hard Disk

Earlier, we showed you how to create a persistent Ubuntu Live media disk, and use it to reset Windows 7 admin and standard user account password and clone hard disk partitions disk via dd tool. Ubuntu provides a multitde of options to securely wipe the data without leaving any chances of recovering it back. Before you start, make sure that you’ve backed up all your important data to external hard disk. First, create an Ubuntu Live CD by following steps mentioned here. Once done, reboot your system, and set Removable USB hard disk as first boot option from BIOS menu, which can be accessed by pressing Del, F2, F10, F9 or other system-defined key. Once boot priority is changed, plug-in Ubuntu Live media disk, save changes made to BIOS, and then reboot the system. It will take you to Ubuntu boot menu, select Run Ubuntu from this USB option to load Ubuntu OS.

Ubuntu has a built-in CLI-based shred tool that requires just the path of file that you want to securely delete from the system. The shred command comes useful in instances where you want to selectively perform permanent file deletion operations. To find out more about shred command, check out our guide here.

In order to perform secure wipe operation over an entire disk or hard disk partitions, we recommend using wipe tool. Ubuntu doesn’t come with this tool installed, but you can download it by enabling community-maintained open source repository option in Synaptic Package Manager. To do so, click System on panel, and select Synaptic Package Manager from Administration menu.

Screenshot

It will open Ubuntu default package manager. Now, click Settings menu to select Repositories.

Screenshot-1

In this step, select Community-maintained Open Source software (universe) option, and the click close.

Screenshot-2

Now click Reload on toolbar to start downloading open source repository list.

Screenshot-4

Once the repository list is updated, use search bar present in top-right corner to find wipe tool.

Screenshot wipe

Now, right-click wipe tool in main window, select Mark for Installation, and then hit Apply on toolbar.

Screenshot-Synaptic Package Manager

This will open Summary dialog box, which helps you verify the changes you’re making to repository; expand To be installed list to view the tools lined up for installation. Clicking Apply will start the installation process.

Screenshot check wipe install

Once the wipe tool is installed, close Synaptic Package Manager. Now, you need to mount the disk that you want to securely wipe. Open Places menu from panel, and select primary hard disk from the list to mount it. Once mounted, open Terminal from Applications –> Accessories menu.

terminal

In Terminal window, navigate to media, and then list down mounted drives using cd /media and ls commands. Now navigate to mounted hard drive using following command.

cd <hard disk identifier>

navigate to hard disk

You can use sudo fdisk –l command or Disk Utility (accessible from Administration menu) to list down and identify the hard disk partitions that you want to wipe.

partitions.jpg

In Disk Utility (which is accessible from System –> Administration menu), select your primary hard disk from left sidebar, and then select the partition from main window to view the disk identifier and other attributes such as total disk capacity, partition identifier, partition type etc. Note down the device identifier and move to Terminal window.

disk utility.jpg

The wipe tool requires disk identifier to perform the wipe operation. The syntax to securely wipe the data via wipe tool is as follows:

sudo wipe <disk identidfer>

If you for instance want to wipe /dev/sda5, enter sudo wipe /dev/sda5 command. It will ask you to confirm the wipe operation. Type ‘Yes’  and then hit enter to begin the disk wiping operation.

wiping.jpg

The time it takes to completely wipe the disk depends upon the size of disk. Once finished, mount the disk again to verify the disk wipe operation. Apart from permanently deleting the data, wipe command fills the disk with random data. To quickly wipe the disk, you could use –q switch to instantly perform the operation. The –q switch makes 4 passes on each file residing in specified location. However, if you want to specify the number of passes, use the –Q switch. Furthermore, if you’re a wiping data from a specific location, you can use –r switch to include sub-directories present within the root folder. The –f switch forcibly performs the disk wipe operation. It must be noted that –f doesn’t prompt you to confirm the action, so you need to make sure that you’ve specified the correct device identifier to prevent loss of important data.

In our guide to clone hard disk, we used dd command to perform low-level copy operations. The dd command can also be used to write random data and zeros to the specified disk. This ensures that data recovery application will not be able to recover deleted data from the disk. To begin, open Terminal and navigate to media, and enter the following command to fill disk with zeroes.

sudo dd if=/dev/zero of=/dev/<disk identifier> bs=8M

write zero

Using DBAN To Wipe Out The Hard Drive & Removable Media

DBAN (Darik’s Boot And Nuke) is an open source disk wiping application that ensures secure and permanent data deletion. The application comes in ISO format, which has to be burnt to CD/DVD for performing the disk wipe operations. Supporting 6 staunch disk wipe algorithms, the application lets you specify the deletion rounds to ensure permanent removal. Usage is simple, download DBAN (link given at the bottom of the post). Once downloaded, insert a writeable CD/DVD into CD/DVD drive. Now, right-click the downloaded ISO file and select Burn disc Image.

burn

This will open Windows native Disc Image Burner. Now all you need to burn ISO to disc to specify the CD Drive letter and then click Burn.

windows disc burn

Once done, reboot your system into BIOS menu by pressing system-defined key at system startup. Now you need to change the boot priority. Navigate to boot menu and set CD/DVD ROM as first boot option. Once done, save the changes made to BIOS and restart you PC. It will take you to Darik’s Boot and Nuke menu. The DBAN allows you to wipe the disk via 3 modes, including manual, automatic and interactive modes. Since Interactive mode lets you easily specify the disk wiping attributes, press Enter on boot prompt to launch interactive mode.

1-1

Upon pressing enter, it will start finding all the installed and external storage mediums. Once all disks are identified, it will list them down on main screen, letting you specify disk wipe method & number of rounds.

interactive menu

You can select the disk wipe method by pressing ‘M’ on keyboard. It supports a total of 6 methods including Quick Erase, RCMP TSSIT, DoD Short Gutmann Wipe and PRNG Stream. Use J and K keys to navigate between the available methods. Pressing Enter selects the method and takes you back to main window.

method (2)

To specify disk wipe rounds, press R on main window (interactive mode) and specify the number of rounds you want to pass for destroying data on disk, and then press Enter to get to main screen.

rounds 1f

Once you’ve specified disk wiping attributes, press space to select the disk followed by F10 to begin the permanent disk erasing operation.

Download DBAN

12 Comments

  1. Recommend using WBD(Wipe Bad Disk) to erase data if your disk has bad sectors on it.

  2. How the hell do you think that it is appropriate to file this under windows tips?

    • Because windows users often have the need to wipe the windows partition securely. Right now I’m trying to wipe the windows partition of my old computer so that I can re-install windows again and then give the computer away without giving away any of my data.

  3. Awesome work explaining steps with images. Quite possibly the most comprehensive article on erasing hard disk data.