From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ciiSW-0004eJ-JT for mharc-grub-devel@gnu.org; Tue, 28 Feb 2017 09:08:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciiSS-0004bi-BH for grub-devel@gnu.org; Tue, 28 Feb 2017 09:08:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciiSQ-0003sL-N1 for grub-devel@gnu.org; Tue, 28 Feb 2017 09:08:52 -0500 Received: from mail-ua0-x22e.google.com ([2607:f8b0:400c:c08::22e]:35338) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciiSQ-0003rv-H7 for grub-devel@gnu.org; Tue, 28 Feb 2017 09:08:50 -0500 Received: by mail-ua0-x22e.google.com with SMTP id 40so14206874uau.2 for ; Tue, 28 Feb 2017 06:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=8mOaiC5UkXrFwq6Hc9R5ClJOUnDGaTzvm9wwRfTLulM=; b=j+FnteoMbocG4T4mbGSXqIsI5Wqflg5lSwKNUuQ0SOrUV1FonekijIyuijs9yYkgPB t8aegxFNSEGSfnBVreYy4/ZNWO4SMYw/EC869bPoxkpAqZBjTjihmOznUH9NLyE9r5ho puSe+PzH1+87Xb167TAXL5sP7xi3ke9/CbHNUnJiXqM+HUaJmADqExdAgQxtHfDyuhx3 arNHqjovqI2H1q/f6xxYSUG4WDHoOX8xpTBtJ+FEolnxfEiT2bkag8qqytIh9Fxp/uQi pxvSgguxvhTAzJySln4paNC900lNDvUJm2/zlt0WPnlspvhHWH5xPg8OSWslCf6bqTG2 Z53w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=8mOaiC5UkXrFwq6Hc9R5ClJOUnDGaTzvm9wwRfTLulM=; b=D1J2Fs0Rl0LkUr/mC/faXu7IOEJZXkmFTW0jSxaVvndz27tomEyI+Fb2YCisra1C1j 7OomFtrl0gWZukf62TRjsDdxzo8bzOisJh5twFdFtQya5/EtloPRSiG6ccI//7wvPuax JCTIs38gRxV0ehm+ak46S2D9zz74RtFj6ch0QB9gNU+kfO1fri/ACHuVP1ae1fPispyP R5lKKstwzkauikbOreE/ZNitoO5YTtAL1qMnK6BWcb2FAugYsgk4P+WTgve3UlnJNwYq pEXi22eO62Fkd1swJ5UV+Hupzcw9+7Hv9XZNwZI4y+3Mtl1T5G0YCg4wfaBnTqxMaY3M C4Kg== X-Gm-Message-State: AMke39mvyDkEemkBEO/bzpJng1biaV5w8TpbXMKhNwn1Hs0M5OtZ9yJJ+/E87qaChdUCC0+YFvNbbhiOD91VQg== X-Received: by 10.176.90.147 with SMTP id w19mr1126631uae.0.1488290928149; Tue, 28 Feb 2017 06:08:48 -0800 (PST) MIME-Version: 1.0 References: <20170214180035.3461-1-skenton@ou.edu> <2e48f17a-20d7-c9cb-2300-1bc5fec88f12@gmail.com> In-Reply-To: From: "Vladimir 'phcoder' Serbinenko" Date: Tue, 28 Feb 2017 14:08:37 +0000 Message-ID: Subject: Re: [PATCH 1/1] add --partuuid to probe To: The development of GNU GRUB Content-Type: multipart/alternative; boundary=f403045f8a2018d6ca054997bc97 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c08::22e X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2017 14:08:54 -0000 --f403045f8a2018d6ca054997bc97 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Feb 27, 2017, 20:11 Andrei Borzenkov wrote: > 27.02.2017 21:20, Vladimir 'phcoder' Serbinenko =D0=BF=D0=B8=D1=88=D0=B5= =D1=82: > > On Mon, Feb 27, 2017, 09:55 Andrei Borzenkov > wrote: > > > >> 27.02.2017 03:37, Vladimir 'phcoder' Serbinenko =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: > >> ... > >>>>>>> This is not NT-style. NT uses partition offset. Who uses this > format? > >>>> Are > >>>>>> > >>>>>> This is used by util-linux and Linux kernel. > >>>>>> > >>>>>> > >>>>>> * 6) PARTUUID=3D00112233-4455-6677-8899-AABBCCDDEEFF > representing > >>>> the > >>>>>> * unique id of a partition if the partition table provide= s > >> it. > >>>>>> * The UUID may be either an EFI/GPT UUID, or refer to an > >> MSDOS > >>>>>> * partition using the format SSSSSSSS-PP, where SSSSSSSS > is a > >>>>>> zero- > >>>>>> * filled hex representation of the 32-bit "NT disk > >> signature", > >>>>>> and PP > >>>>>> * is a zero-filled hex representation of the 1-based > >> partition > >>>>>> number. > >>>>>> > >>>>>>> you sure that partition numbers are synced with user? Even in > >> presence > >>>> of > >>>>>>> Solaris and bsd partitions. > >>>>>>> > >>>>>> > >>>>>> It is not clear what we should return for nested partition. I'm no= t > >> sure > >>>>>> whether linux kernel scans nested partitions at all in which case = we > >>>>>> probably should follow the suite and assign PARTUUID to top-level > >>>>>> partitions only. > >>>>>> > >>>>> Linux scans nested partitions and it uses though numeration in > >> dev/sdaX, > >>>> in > >>>>> some cases shifting numbering of normal partitions. In those cases > grub > >>>> and > >>>>> Linux numeration get out of sync > >>>>> > >>>> > >>>> Can you provide example? > >>> > >>> Bsd and Solaris partitions. I remember we had problem with numbering = of > >>> those. > >>> > >> > >> Linux ignores nested BSD partitions (just tested). There are no specia= l > >> files created. Of course someone needs to test what happens under > >> *BSD/Solaris in this case. > >> > > Kpartx or normal sdX? Is bsd-partition support enabled in kernel build? > > > > OK I see, kernel skips BSD partition marked as "unused". > > So it appears that kernel always puts special nested partitions after > normal logical MSDOS partitions, so it will not skew MSDOS partition > numbers. > > [ 1.529752] vda: vda1 vda2 vda3 < vda5 vda6 > > vda2: > > > /* > * Look for partitions in two passes: > * First find the primary and DOS-type extended partitions. > * On the second pass look inside *BSD, Unixware and Solaris > partitions. > */ > > For such partition (vda7) PARTUUID is empty. > > P.S. I wonder whether we correctly map such partition ... no, we do not. > > 10:~ # cat /tmp/foo > (hd0) /dev/vda > 10:~ # grub2-probe -m /tmp/foo -t compatibility_hint -d /dev/vda2 > hd0,msdos2 > 10:~ # grub2-probe -m /tmp/foo -t compatibility_hint -d /dev/vda5 > hd0,msdos5 > 10:~ # grub2-probe -m /tmp/foo -t compatibility_hint -d /dev/vda7 > hd0,msdos2 > WAI. In case when subpartition starts at the same sector as partition itself. > > > >> > >> I never liked idea of artificial partition GUIDs for MBR, but as long = as > >> only Linux is using them and we are consistent with its usage - so be > it. > >> > >>>> I tried to create nested partition table, but > >>>> Linux will not display it (actually attempt to "blockdev --rereadpt > >>>> /dev/vda5" fails with "Invalid argument"). > >>>> > >>>> if (!disk_part_scan_enabled(disk) || bdev !=3D > bdev->bd_contains) > >>>> return -EINVAL; > >>>> > >>>> Where bdev->bd_contains points to containing device for partition an= d > to > >>>> itself for the whole disk. > >>>> > >>>> As util-linux does not scan partition table itself, it does show the= se > >>>> nested partitions either. > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > --f403045f8a2018d6ca054997bc97 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Mon, Feb 27, 2017, 2= 0:11 Andrei Borzenkov <arvidjaar@= gmail.com> wrote:
27.02.20= 17 21:20, Vladimir 'phcoder' Serbinenko =D0=BF=D0=B8=D1=88=D0=B5=D1= =82:
> On Mon, Feb 27, 2017, 09:55 Andrei Borzenkov <arvidjaar@gmail.com= > wrote:
>
>> 27.02.2017 03:37, Vladimir 'phcoder' Serbinenko =D0=BF=D0= =B8=D1=88=D0=B5=D1=82:
>> ...
>>>>>>> This is not NT-style. NT uses partition offset= . Who uses this format?
>>>> Are
>>>>>>
>>>>>> This is used by util-linux and Linux kernel.
>>>>>>
>>>>>>
>>>>>>=C2=A0 *=C2=A0 =C2=A0 =C2=A0 6) PARTUUID=3D00112233= -4455-6677-8899-AABBCCDDEEFF representing
>>>> the
>>>>>>=C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unique id= of a partition if the partition table provides
>> it.
>>>>>>=C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The UUID = may be either an EFI/GPT UUID, or refer to an
>> MSDOS
>>>>>>=C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0partition= using the format SSSSSSSS-PP, where SSSSSSSS is a
>>>>>> zero-
>>>>>>=C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filled he= x representation of the 32-bit "NT disk
>> signature",
>>>>>> and PP
>>>>>>=C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is a zero= -filled hex representation of the 1-based
>> partition
>>>>>> number.
>>>>>>
>>>>>>> you sure that partition numbers are synced wit= h user? Even in
>> presence
>>>> of
>>>>>>> Solaris and bsd partitions.
>>>>>>>
>>>>>>
>>>>>> It is not clear what we should return for nested p= artition. I'm not
>> sure
>>>>>> whether linux kernel scans nested partitions at al= l in which case we
>>>>>> probably should follow the suite and assign PARTUU= ID to top-level
>>>>>> partitions only.
>>>>>>
>>>>> Linux scans nested partitions and it uses though numer= ation in
>> dev/sdaX,
>>>> in
>>>>> some cases shifting numbering of normal partitions. In= those cases grub
>>>> and
>>>>> Linux numeration get out of sync
>>>>>
>>>>
>>>> Can you provide example?
>>>
>>> Bsd and Solaris partitions. I remember we had problem with num= bering of
>>> those.
>>>
>>
>> Linux ignores nested BSD partitions (just tested). There are no sp= ecial
>> files created. Of course someone needs to test what happens under<= br class=3D"gmail_msg"> >> *BSD/Solaris in this case.
>>
> Kpartx or normal sdX? Is bsd-partition support enabled in kernel build= ?
>

OK I see, kernel skips BSD partition marked as "unused".

So it appears that kernel always puts special nested partitions after
normal logical MSDOS partitions, so it will not skew MSDOS partition
numbers.

[=C2=A0 =C2=A0 1.529752]=C2=A0 vda: vda1 vda2 vda3 < vda5 vda6 >
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vda2: <openbsd: = vda7 >


=C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Look for partitions in two passes:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* First find the primary and DOS-type ext= ended partitions.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* On the second pass look inside *BSD, Un= ixware and Solaris
partitions.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/

For such partition (vda7) PARTUUID is empty.

P.S. I wonder whether we correctly map such partition ... no, we do not.
10:~ # cat /tmp/foo
(hd0) /dev/vda
10:~ # grub2-probe -m /tmp/foo -t compatibility_hint -d /dev/vda2
hd0,msdos2
10:~ # grub2-probe -m /tmp/foo -t compatibility_hint -d /dev/vda5
hd0,msdos5
10:~ # grub2-probe -m /tmp/foo -t compatibility_hint -d /dev/vda7
hd0,msdos2
WAI. In case when= subpartition starts at the same sector as partition itself.


>>
>> I never liked idea of artificial partition GUIDs for MBR, but as l= ong as
>> only Linux is using them and we are consistent with its usage - so= be it.
>>
>>>> I tried to create nested partition table, but
>>>> Linux will not display it (actually attempt to "block= dev --rereadpt
>>>> /dev/vda5" fails with "Invalid argument").<= br class=3D"gmail_msg"> >>>>
>>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!disk_part_scan_enabl= ed(disk) || bdev !=3D bdev->bd_contains)
>>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0return -EINVAL;
>>>>
>>>> Where bdev->bd_contains points to containing device for= partition and to
>>>> itself for the whole disk.
>>>>
>>>> As util-linux does not scan partition table itself, it doe= s show these
>>>> nested partitions either.


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/l= istinfo/grub-devel
--f403045f8a2018d6ca054997bc97--