Wipe last 1MB of a Hard drive

The simplest way on Linux to get the size of the disk is with blockdev --getsz:

sudo -s
dd bs=512 if=/dev/zero of=/dev/sdx count=2048 seek=$((`blockdev --getsz /dev/sdx` - 2048))

The size of every partition is available in /proc/partitions. The following command shows the size of sdx (in kB units):

awk '$4 == "sdx" {print $3}' </proc/partitions

Thus:

dd if=/dev/zero of=/dev/sdx bs=1k count=1024 \
   seek=$(($(awk '$4 == "sdx" {print $3}' </proc/partitions) - 1024))

Using the seek to get to the end of the drive works very well, i.e.:

seek=$((blockdev --getsz /dev/sda - 2048))

However, when you use this, I recommend that you either know that your count value is correct, or not use it at all. The reason I say this is that drives can have either 512 byte sectors or 4k sectors, and if you use this solution with a drive that has 4k sectors on it, you won't go to the end of the drive with that count value, and may miss the RAID information at the end (I have run into this).