Make wipe_metadata more reliable
Make wipe_metadata more reliable

Get the size of the drive in logical sectors (512 bytes), then wipe the first 10 and last 20 sectors.

We have to use fdisk because parted in SL5 will refuse to display the size of an unlabeled drive. However parted support has been added as a fallback if fdisk fails.

If size cannot be determined by any means then the entire drive gets wiped, as it happened before. This change also prints a message when that happens so that the user is aware - instead of guessing.

The first 10 and last 20 sectors were chosen after reading http://kezhong.wordpress.com/2011/06/14/how-to-remove-bios-raid-metadata-from-disk-on-fedora/. They have been tested with RAL diskservers. They should be enough to wipe gpt partition information and raid metadata.

Discussion has taken place in the old pull request https://github.com/quattor/aii/pull/61, which was closed because of messed up commit history.
jrha/aii,alvarosimon/aii,jouvin/aii,jrha/aii,stdweird/aii,alvarosimon/aii,quattor/aii,jouvin/aii,stdweird/aii