Gangmax Blog

Wipe Hard Drive with dd

This post describes how to wipe hard drive data with the “dd” command. From here and here.

1
2
3
4
5
6
7
8
9
# Write zero to "/dev/sdb" device.
dd if=/dev/zero of=/dev/sdb bs=1M
# Write random numbers to "/dev/sdb" device.
dd if=/dev/urandom of=/dev/sdb bs=1M
# Wiping the Master boot record (MBR).
dd if=/dev/zero of=/dev/hdb bs=446 count=1
# Wiping partition.
dd if=/dev/zero of=/dev/sdb2 bs=1M
dd if=/dev/urandom of=/dev/sdb3 bs=1M

An insteresting point is why writing random nubmer is better than zero.

Writing more than once is even more securer.

wipeIt.sh
1
2
3
4
#!/bin/bash 
# Save the script as a file "wipeIt.sh" and add execution permission to it:
# chmod a+x wipeIt.sh
for n in `seq 7`; do dd if=/dev/urandom of=/dev/sdb bs=8b conv=notrunc; done

Done.

Comments