If you have some old hard disks lying around and are considering selling them, it is important that you wipe them before passing them along - otherwise your data can very easily fall in to the wrong hands. There are a billion ways to wipe a disk - this article is not a tutorial. It is a reminder of something you might not be aware of. It definitely applies to using the unix command "dd" to perform a disk wipe, possibly to other tools as well.

A naive approach might be to issue this command:

dd if=/dev/zero of=/dev/diskX bs=4m

with /dev/diskX the target disk you are wiping, and bs=4m is to speed up the wiping by writing larger blocks. Checking the disk after this finished:

and whoopsies... The reason why the last part of the disk was not wiped, is because the block size - especially when using larger values such as 4m - does not always perfectly divide the disk's size, thereby causing a short write at the end. A strange thing is that on two identical disks, it wrote to the last 512 byte block on one disk but on the other it stopped 555MB before the end of the disk - way larger than the 4m block size I used. I therefore recommend you slow wipe the last 2*block size of the disk just in case (seek uses blocks of size bs, so I adjust bytes to blocks by dividing by 1024 - and this assumes I originally wiped it with bs=4m):

take note, the last command is not the most efficient way to do this and will take a LONG time. I like it though because of its elegant output in non verbose mode - it will show the first (empty) line, then an asterisk to indicate a repetition of the previous line as long as the disk is zeroed.