Control: tags 738365 upstream wontfix

Michael Gold wrote...

> gdisk should be able to recognise a GPT created with the wrong sector
> size, and rewrite it with the correct size.  An 'advanced mode' option
> could also be added to allow this to be done before the sector size is
> changed.

After looking at the suggestion for a while, I think it's not a good
idea to implement such a feature. Also, a simple workaround exists,
more on that below.


Adjusting from sector size 4096 to 512 (your case) - this is indeed not
to difficult and will also free a few bits at the start and at the end
of the partition (seven [512 bytes] sectors each, at the end possibly
even more).

The other way around however, from 512 to 4096 byte sectors, has
problems. Then the GPT header will require that space freed in the
operation above - and it might not be available. Or you start violating
the GPT specification by dis-allowing partition numbers above 90-ish.

In either way, the boot loader in the MBR will probably have some
pointers wrong and should rather be re-initialized.

In the first situation, bytes in the MBR after offset 512 are lost, but
that area is probably never used.


Working around

Recently, from buster on, losetup allows defining the sector size. In
other words,

    losetup --find --show --sector-size 4096 /dev/sdX

will create a loop device with a sector size matching the GPT data.
Then the kernel and all GPT partitioning tools will identify the table
correctly, making the data accessible.

    Christoph

Attachment: signature.asc
Description: PGP signature

Reply via email to