How To Securely Erase Disk Partitions In Ubuntu /Linux Mint

There are various disk erasing utilities for Linux Mint / Ubuntu but one easy and very effective way to do that is by using the built-in Terminal commands. (For erasing individual files, this is a useful tool.)

Suppose, specific partitions from a disk in Linux Mint/ Ubuntu need to be erased clean. This is simple to do without using any other tool then the “dd” command. (There are other uses of this command as well).

First, to be clear on which partitions are available and get their detailed information, install “gparted” from the Terminal :

sudo apt-get install gparted

Once installed, run it to display the list of partitions available :

gparted info

Now, suppose the partitions sda2 and sda4 (both NTFS in this example) need to wiped clean. To do this, run the following commands :

sudo dd if=/dev/zero of=/dev/sda2 bs=1M

sudo dd if=/dev/zero of=/dev/sda4 bs=1M

What this will do is fill the entire partition with 0’s and wipe out all possible data. The “bs=1M” parameter is to indicate the byte size to be read one at a time. Specifying a higher value will speed up the erasing process.

(This can be used when one wants to securely erase data from hard drives or to start over clean.)

Once finished, the output will be something like below :

 

using the dd command to erase disk partitions

None of these partitions will now be mountable and will have no data at all.

Be very careful with this versatile and powerful “dd” command because it can be used to erase / zero out the entire hard disk as well (specify /dev/sda or /dev/sdb rather then individual partitions to do that).

( To know other such powerful commands, do check out the Linux command line basics tutorial series).

Happy erasing.

 

Comments are closed.