
"Daniel P. Berrange" <berrange@redhat.com> wrote: ...
+ for (i = 0 ; i < pool->def->source.ndevice ; i++) { + int fd; + char zeros[512]; + memset(zeros, 0, sizeof(zeros)); ... is it really 512 or the block size on the device used ? But 512 is probably sufficient for LVM to consider it cleared, just wondering ...
The 'pvcreate' man page explicitly says the first sector
<quote> For whole disk devices only the partition table must be erased, which will effectively destroy all data on that disk. This can be done by zeroing the first sector with:
dd if=/dev/zero of=PhysicalVolume bs=512 count=1 </quote>
So 512 is fine for MSDOS partition tables at least.
How about giving the constant a name? That'd make it more readable. #define SECTOR_SIZE 512 -- Jim, who has spent far too much time dealing with hard-coded literal array sizes like that in parted, when I made parts of it work with larger-than-512-byte sectors.