If you want to give away a computer and you want to really delete the data on the hard drive, you can use dd
under Linux. Start a live linux from a USB drive (for example Ubuntu) on the computer where you want to erase the disk.
First, find out which partitions you have. A basic way of doing this is by using fdsik
:
sudo fdisk -l
Most distributions will have a graphical editor which makes it easier to see what is going on. In gnome this will be gparted
, in KDE KDE partition manager
. There are surely other tools around. But it does not really matter, all you need is to know the name of the partition which you want to erase. In my case it is /dev/sda4
.
Now we will use dd
(“disk dump”) to write random information to this partition on top of the existing information. This is the command:
sudo dd if=/dev/urandom of=/dev/sda4 bs=65536 status=progress
The parameter of
(“output file”) is the hard disk partition we want to write to. You do not want to mess up and take the wrong partition. The is no “undo”. Check this parameter twenty times. The parameter if
(“input file”) is used to set the data which should be written. In our case, we use /dev/urandom
which is a generator for random numbers. status=progress
will enable some output on the command line which tells us what is happening. If you forget this parameter, there will be no output and you will have no idea if 1 byte has been written in the last hour or 200 GB. Setting the block size (bs
) to something larger than the default 512 bytes is also very highly recommended. The difference in the time the command needs to run may be huge. I use 64k in the example which worked fine for me. If you want to determine the optimal block size for your system, I suggest this article: Tuning dd block size by Danny Guinther.