[libvirt] [PATCH v2 3/3] disk: Force clearing of the first 2048 bytes of device prior to mklabel

Peter Krempa pkrempa at redhat.com
Fri Apr 7 14:27:40 UTC 2017


On Fri, Apr 07, 2017 at 09:52:09 -0400, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1439132
> 
> During 'matrix' testing of all possible combinations I found that if
> device is formated with "gpt" first, then an attempt is made to format
> using "mac", a startup will fail.  By adding a clearing of the first
> 2048 bytes of the device (similar to the logical pool code), the issue
> is resolved.

I'm not a fan of this and neither thing this is robust enough:

The problem here is that apparently the "mac" table fits into the first
block on the disk. Since the GPT disklabel is stored at LBA address 1
it is not overwritten at all. Thus it's apparent that the detection tool
then prefers GPT over a older disklabel.

The GPT disklabel has also a secondary copy at the last LBA of the disk.

As for robustness: SECTOR_SIZE is defined as 512 in our code, thus this
code nukes 2k of data. For devices with 4k sectors which are already
available this won't help at all, since LBA 0 will still contain the
protective MBR, and the 3,5k left of LBA 0 will be unused. GPT disklabel
still will start at LBA 1.

Since I'm not a fan of similar code when nuking physical volumes I'd
rather not see this stuff to spread.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170407/e24b52b9/attachment-0001.sig>


More information about the libvir-list mailing list