@bobnoordam

Using dd to secure wipe an entire disk

Linux has many small but extremely powerfull tools, and the disk duplicator dd is one of them. By copying from the system’s random data stream onmto a target disk, we can overwrite a disk front to end, partition data and all.

Make very sure abot the target disk. If you don’t get that part right, you WILL destroy something else.

Assuming the disk to wipe is the SECOND disk in your system (attached wiht usb or whatever)

dd if=/dev/urandom of=/dev/sdb bs=1M
  • if being the input device, in this case the random number source
  • of being the target device, in this case the second harddrive
  • bs being the blocksize, playing with this can give small performance gains or losses, 4M is a good rule of thumb. If you want to know the physical block size of the disk you can run the command below. Note: This is vey likely not the optimal value because writing blocks one by one is not a very fast method.
# tune2fs -l /dev/sda1 | grep "Block size"

Finaly, if you want to see progress while you go, you may want to disable console blanking and show a progress report on the dd command:

# setterm -blank 0
# dd if=/dev/urandom of=/dev/sdb bs=4M status=progress