[parted-devel] [PATCH] More correct handling of the HeaderSize field in GPT labels
Matthew S. Harris
mharris312 at gmail.com
Mon Jul 9 16:01:08 UTC 2007
On 7/9/07, Jim Meyering <jim at meyering.net> wrote:
> Jim Meyering <jim at meyering.net> wrote:
> ...
> > For example, can you give me a sequence of commands to create a
> > small image for which parted-before-your-patch fails, yet with your
> > patch it works?
> >
> > E.g.,
> >
> > dev=loop-file
> > dd if=/dev/zero of=$dev bs=1 count=50K 2> /dev/null
> > ./parted -s $dev mklabel gpt
> > # change HeaderSize and checksum
> > # do something with the label, e.g., ./parted -s $dev p
>
> Alternatively, just create a ZFS partition on OpenSolaris,
> tell me the commands you used (for reference), send me the first
> few KB of the image, and I'll do the rest.
The form of the "# change HeaderSize and checksum" commands would be
# In both the primary and backup GPT tables, change HeaderSize to 512
# and set the checksum appropriately.
echo -ne '\0\02\0\0\0200\072\0253\0203' | dd of=$dev bs=1 conv=notrunc seek=524
echo -ne '\0\02\0\0\0164\0155\062\0176' | dd of=$dev bs=1 conv=notrunc
seek=50700
(where the first four bytes written are the header size and the second
four bytes are the CRC) but yesterday I had trouble getting checksum
values to work: I added print statements to print the computed
checksum, but the value seemed to change after I modified the checksum
in the image, which shouldn't happen.
Tonight I may try to extract the label from my ZFS partition, but (1)
I don't think I have a spare disk I can use to create a new ZFS
partition, and (2) Parted may not work correctly on it yet because I
haven't sent you the other bugfix.
Matthew
More information about the parted-devel
mailing list