bin/148253: sysinstall(8): sysinstall partition=<SIZE> creates invalid partition type

Joël FAEDI joel.faedi at gmail.com
Sat Jul 3 21:40:04 UTC 2010


The following reply was made to PR bin/148253; it has been noted by GNATS.

From: =?ISO-8859-1?Q?Jo=EBl_FAEDI?= <joel.faedi at gmail.com>
To: bug-followup at FreeBSD.org, bjones at castlejones.net
Cc:  
Subject: Re: bin/148253: sysinstall(8): sysinstall partition=&lt;SIZE&gt; 
	creates invalid partition type
Date: Sat, 3 Jul 2010 23:12:37 +0200

 --0016e6dab38bbbdba8048a8229bb
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Hello,
 
 I notice that other calls to 'Create_Chunk' in disks.c use SUBTYPE_FREEBSD
 constant for and problematic calls have a "3" hardcoded...
 So I think the following patch for "/usr/src/usr.sbin/sysinstall/disks.c"
 will solve this problem.
 
  --- disks.c.orig        2010-06-14 04:09:06.000000000 +0200
 +++ disks.c     2010-07-03 22:01:14.000000000 +0200
 @@ -959,7 +959,7 @@
                 /* If a chunk is at least 10MB in size, use it. */
                 if (chunk_info[i]->type =3D=3D unused && chunk_info[i]->siz=
 e >
 (10 * ONE_MEG)) {
                     Create_Chunk(d, chunk_info[i]->offset,
 chunk_info[i]->size,
 -                                freebsd, 3,
 +                                freebsd, SUBTYPE_FREEBSD,
                                  (chunk_info[i]->flags & CHUNK_ALIGN),
                                  "FreeBSD");
                     variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -992,7 +992,7 @@
             for (i =3D 0; chunk_info[i]; i++) {
                 /* If a chunk is at least sz MB, use it. */
                 if (chunk_info[i]->type =3D=3D unused && chunk_info[i]->siz=
 e >=3D
 sz) {
 -                   Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
 +                   Create_Chunk(d, chunk_info[i]->offset, sz, freebsd,
 SUBTYPE_FREEBSD,
                                  (chunk_info[i]->flags & CHUNK_ALIGN),
                                  "FreeBSD");
                     variable_set2(DISK_PARTITIONED, "yes", 0);
 
 My version of FreeBSD:
 FreeBSD xxxx 8.1-RC1 FreeBSD 8.1-RC1 #0: Mon Jun 14 14:44:53 UTC 2010
 root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
 
 My tests:
 1 Modify sysinstall and compile it (without installing it for now)
 1.1 cd /usr/src/usr.sbin/sysinstall
 1.2. apply the patch
 1.3. make
 
 2 Make a test on an unused external USB disk with the shipped "sysinstall"
 2.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 count=3D64
 2.2 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1 partit=
 ion=3D10G
 bootManager=3Dboot diskPartitionEditor diskPartitionWrite
 2.3 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1 partit=
 ion=3D15G
 bootManager=3Dboot diskPartitionEditor diskPartitionWrite
 2.4 fdisk /dev/da1
 ******* Working on device /dev/da1 *******
 parameters extracted from in-core disklabel are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Figures below won't work with BIOS for partitions not in cyl 1
 parameters to be used for BIOS calculations are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Media sector size is 512
 Warning: BIOS sector numbering starts with sector 1
 Information from DOS bootblock is:
 The data for partition 1 is:
 sysid 3 (0x03),(XENIX /usr file system)
     start 63, size 20964762 (10236 Meg), flag 0
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 2 is:
 sysid 3 (0x03),(XENIX /usr file system)
     start 20964825, size 31455270 (15359 Meg), flag 0
         beg: cyl 1023/ head 255/ sector 63;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 3 is:
 <UNUSED>
 The data for partition 4 is:
 <UNUSED>
 
 3 Make the same tests with the external USB disk but with the patched
 "sysinstall"
 3.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 count=3D64
 3.2 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonInteractive=3DYE=
 S
 disk=3Dda1 partition=3D10G bootManager=3Dboot diskPartitionEditor
 diskPartitionWrite
 3.3 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonInteractive=3DYE=
 S
 disk=3Dda1 partition=3D15G bootManager=3Dboot diskPartitionEditor
 diskPartitionWrite
 3.4 fdisk /dev/da1
 ******* Working on device /dev/da1 *******
 parameters extracted from in-core disklabel are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Figures below won't work with BIOS for partitions not in cyl 1
 parameters to be used for BIOS calculations are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Media sector size is 512
 Warning: BIOS sector numbering starts with sector 1
 Information from DOS bootblock is:
 The data for partition 1 is:
 sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 63, size 20964762 (10236 Meg), flag 80 (active)
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 2 is:
 sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 20964825, size 31455270 (15359 Meg), flag 80 (active)
         beg: cyl 1023/ head 255/ sector 63;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 3 is:
 <UNUSED>
 The data for partition 4 is:
 <UNUSED>
 
 It work !
 
 Best regards,
 
 Jo=EBl FAEDI
 
 --0016e6dab38bbbdba8048a8229bb
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Hello,<br><br>I notice that other calls to &#39;Create_Chunk&#39; in disks.=
 c use=20
 SUBTYPE_FREEBSD constant for and problematic calls have a &quot;3&quot; har=
 dcoded... <br>So I think the following patch for &quot;/usr/src/usr.sbin/sy=
 sinstall/disks.c&quot; will solve this problem. <br><br>=A0--- disks.c.orig=
 =A0=A0=A0=A0=A0=A0=A0 2010-06-14 04:09:06.000000000 +0200<br>
 +++ disks.c=A0=A0=A0=A0 2010-07-03 22:01:14.000000000 +0200<br>@@ -959,7 +9=
 59,7 @@<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* If a chunk is a=
 t least 10MB in size, use it. */<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0 if (chunk_info[i]-&gt;type =3D=3D unused &amp;&amp; chunk_info[i]-&g=
 t;size &gt; (10 * ONE_MEG)) {<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Create_Chunk(d, c=
 hunk_info[i]-&gt;offset, chunk_info[i]-&gt;size,<br>-=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fr=
 eebsd, 3,<br>+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 freebsd, SUBTYPE_FREEBSD,<br>=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0 (chunk_info[i]-&gt;flags &amp; CHUNK_ALIGN),<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0 &quot;FreeBSD&quot;);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 variable_set2(DISK_PARTITIONED, &quot;yes&qu=
 ot;, 0);<br>@@ -992,7 +992,7 @@<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (i=
  =3D 0; chunk_info[i]; i++) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0 /* If a chunk is at least sz MB, use it. */<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (chunk_info[i]-&gt;type =
 =3D=3D unused &amp;&amp; chunk_info[i]-&gt;size &gt;=3D sz) {<br>-=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Create_Chunk(d, chunk_info[i]=
 -&gt;offset, sz, freebsd, 3,<br>+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0 Create_Chunk(d, chunk_info[i]-&gt;offset, sz, freebsd, SUBTYPE=
 _FREEBSD,<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0 (chunk_info[i]-&gt;flags &amp; CHUNK_ALIGN),<br>=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0 &quot;FreeBSD&quot;);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0 variable_set2(DISK_PARTITIONED, &quot;yes&quot;=
 , 0);<br><br>My version of FreeBSD:<br>
 FreeBSD xxxx 8.1-RC1 FreeBSD 8.1-RC1 #0: Mon Jun 14 14:44:53 UTC 2010=A0=A0=
 =A0=A0 root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC=A0 i386<br=
 ><br>My tests:<br>1 Modify sysinstall and compile it (without installing it=
  for now)<br>
 1.1 cd /usr/src/usr.sbin/sysinstall<br>1.2. apply the patch<br>1.3. make<br=
 ><br>2 Make a test on an unused external USB disk with the shipped &quot;sy=
 sinstall&quot;<br>2.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 count=3D64<b=
 r>2.2 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1 part=
 ition=3D10G bootManager=3Dboot diskPartitionEditor diskPartitionWrite<br>
 2.3 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1=20
 partition=3D15G bootManager=3Dboot diskPartitionEditor diskPartitionWrite<b=
 r>2.4 fdisk /dev/da1<br>******* Working on device /dev/da1 *******<br>param=
 eters extracted from in-core disklabel are:<br>cylinders=3D3648 heads=3D255=
  sectors/track=3D63 (16065 blks/cyl)<br>
 <br>Figures below won&#39;t work with BIOS for partitions not in cyl 1<br>p=
 arameters to be used for BIOS calculations are:<br>cylinders=3D3648 heads=
 =3D255 sectors/track=3D63 (16065 blks/cyl)<br><br>Media sector size is 512<=
 br>Warning: BIOS sector numbering starts with sector 1<br>
 Information from DOS bootblock is:<br>The data for partition 1 is:<br>sysid=
  3 (0x03),(XENIX /usr file system)<br>=A0=A0=A0 start 63, size 20964762 (10=
 236 Meg), flag 0<br>=A0=A0=A0=A0=A0=A0=A0 beg: cyl 0/ head 1/ sector 1;<br>=
 =A0=A0=A0=A0=A0=A0=A0 end: cyl 1023/ head 254/ sector 63<br>
 The data for partition 2 is:<br>sysid 3 (0x03),(XENIX /usr file system)<br>=
 =A0=A0=A0 start 20964825, size 31455270 (15359 Meg), flag 0<br>=A0=A0=A0=A0=
 =A0=A0=A0 beg: cyl 1023/ head 255/ sector 63;<br>=A0=A0=A0=A0=A0=A0=A0 end:=
  cyl 1023/ head 254/ sector 63<br>
 The data for partition 3 is:<br>&lt;UNUSED&gt;<br>The data for partition 4 =
 is:<br>&lt;UNUSED&gt;<br><br>3 Make the same tests with the external USB di=
 sk but with the patched=20
 &quot;sysinstall&quot;<br>3.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 coun=
 t=3D64<br>3.2 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonIntera=
 ctive=3DYES disk=3Dda1 partition=3D10G bootManager=3Dboot diskPartitionEdit=
 or diskPartitionWrite<br>
 3.3 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonInteractive=3DYE=
 S=20
 disk=3Dda1 partition=3D15G bootManager=3Dboot diskPartitionEditor=20
 diskPartitionWrite<br>3.4 fdisk /dev/da1<br>******* Working on device /dev/=
 da1 *******<br>parameters extracted from in-core disklabel are:<br>cylinder=
 s=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)<br><br>Figures bel=
 ow won&#39;t work with BIOS for partitions not in cyl 1<br>
 parameters to be used for BIOS calculations are:<br>cylinders=3D3648 heads=
 =3D255 sectors/track=3D63 (16065 blks/cyl)<br><br>Media sector size is 512<=
 br>Warning: BIOS sector numbering starts with sector 1<br>Information from =
 DOS bootblock is:<br>
 The data for partition 1 is:<br>sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br=
 >=A0=A0=A0 start 63, size 20964762 (10236 Meg), flag 80 (active)<br>=A0=A0=
 =A0=A0=A0=A0=A0 beg: cyl 0/ head 1/ sector 1;<br>=A0=A0=A0=A0=A0=A0=A0 end:=
  cyl 1023/ head 254/ sector 63<br>
 The data for partition 2 is:<br>sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br=
 >=A0=A0=A0 start 20964825, size 31455270 (15359 Meg), flag 80 (active)<br>=
 =A0=A0=A0=A0=A0=A0=A0 beg: cyl 1023/ head 255/ sector 63;<br>=A0=A0=A0=A0=
 =A0=A0=A0 end: cyl 1023/ head 254/ sector 63<br>
 The data for partition 3 is:<br>&lt;UNUSED&gt;<br>The data for partition 4 =
 is:<br>&lt;UNUSED&gt;<br><br>It work !<br><br>Best regards,<br><br>Jo=EBl F=
 AEDI<br><br><br>
 
 --0016e6dab38bbbdba8048a8229bb--


More information about the freebsd-bugs mailing list