projectatomic / container-storage-setup

Service to set up storage for Docker and other container systems
Apache License 2.0
153 stars 77 forks source link

Zero first 4MB of device being partitioned #269

Closed rhvgoyal closed 6 years ago

rhvgoyal commented 6 years ago

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

rhvgoyal commented 6 years ago

cc @rhatdan @cgwalters

rhatdan commented 6 years ago

LGTM

rhatdan commented 6 years ago

@fkluknav @lsm5 need new build of docker for RHEL to fix this issue. No changes to docker required, just container-storage-setup.