Two disks that I had previously used on an mdadm mirrored raid were complaining about preexisting partition information and apparently thought they still belonged to a raid even though I had already zeroed out the superblocks. These disks had also been formated with GPT. Mdadm alerted me to the remnants when trying to setup a new raid.
GPT stores its protective MBR, primary GPT header and primary GPT table within the first couple of logical sectors on a disk. Additionally a backup secondary GPT table and secondary GPT header are stored on the last few logical sectors .
A good practice is to wipe the drives before attempting to use them within a raid or LVM however depending on the size erasing them can take a long time. Luckily we can instruct dd to target the areas where the partition information is written and destroy the records.
fdisk can help you easily determine the total number of sectors on a disk. This information can then be used to target the GPT sectors at the end of a disk.
Destroying the partition information at the beginning of the disk is simple. This command will erase the first 100 512 byte sectors a the hard disk.
sudo dd if=/dev/zero of=/dev/sdb bs=512 count=100
Destroying the GPT partition information at the end of a disk is a little more difficult but can be achieved with a little help from fdisk.
sudo fdisk -l /dev/sdb
Disk /dev/sdb: 120 GiB, 128849018880 bytes, 251658240 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Simply subtract 100 from the sector count to delete the last 100 512 byte sectors. This process is much quicker then having to dd the entire disk.
sudo dd if=/dev/zero of=/dev/sdb bs=512 seek=251658140
If you have a disk larger than 2TB then it is likely that fdisk wont be able to calculate the sectors. The following command can be used instead.
Wipefs can also be used to destroy any preexisting file systems or raid signatures.
sudo wipefs -a /dev/sdx