It is possible that disk user passed to us either does not have any
signatures in the beginning or signatures have been wiped but there are
valid lvm signatures present in the middle of disk. Especially at the
start of partition. So in the past there might have been partition on
disk and valid lvm signatures. But somebody deleted partition (and left
signatures in place) and passed the disk to a different VM. Now when this
new VM creates a partition (at same offset by default), then these
signatures immediately become visible to udev and lvm rules and they start
processing /dev/part1 as valid PV.
This is unintentional and it soon starts racing with container-storage-setup
logic of wiping partition signatures and creating new PV label etc.
So before creating a partition, zero out first 4MB of disk. Hopefully this
will wipe out any PV label which is in first partition. This assumes that
first partition offset is with-in first 4MB.
It is possible that disk user passed to us either does not have any signatures in the beginning or signatures have been wiped but there are valid lvm signatures present in the middle of disk. Especially at the start of partition. So in the past there might have been partition on disk and valid lvm signatures. But somebody deleted partition (and left signatures in place) and passed the disk to a different VM. Now when this new VM creates a partition (at same offset by default), then these signatures immediately become visible to udev and lvm rules and they start processing /dev/part1 as valid PV.
This is unintentional and it soon starts racing with container-storage-setup logic of wiping partition signatures and creating new PV label etc.
So before creating a partition, zero out first 4MB of disk. Hopefully this will wipe out any PV label which is in first partition. This assumes that first partition offset is with-in first 4MB.
Signed-off-by: Vivek Goyal vgoyal@redhat.com