From robert@fledge.watson.org  Thu Jan 18 09:09:32 2001
Return-Path: <robert@fledge.watson.org>
Received: from fledge.watson.org (fledge.watson.org [204.156.12.50])
	by hub.freebsd.org (Postfix) with ESMTP id 12FED37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Jan 2001 09:09:32 -0800 (PST)
Received: (from robert@localhost)
	by fledge.watson.org (8.11.1/8.11.1) id f0IH9Va82930;
	Thu, 18 Jan 2001 12:09:31 -0500 (EST)
	(envelope-from robert)
Message-Id: <200101181709.f0IH9Va82930@fledge.watson.org>
Date: Thu, 18 Jan 2001 12:09:31 -0500 (EST)
From: rwatson@freebsd.org
Reply-To: rwatson@freebsd.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: Unable to create root partition. Too big?
X-Send-Pr-Version: 3.2

>Number:         24435
>Category:       kern
>Synopsis:       [libdisk] [patch] changing slice type causes Auto-partition to not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    brucec
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 18 09:10:01 PST 2001
>Closed-Date:    Sat Apr 24 13:51:05 UTC 2010
>Last-Modified:  Sat Apr 24 13:51:05 UTC 2010
>Originator:     Robert Watson
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
NAI Labs
>Environment:

4.2-RELEASE install

>Description:

A co-worker of mine was installing FreeBSD 4.2-RELEASE on a machine
that previously held two FAT partitions.  Rather than delete and
recreate the first partition to change it to a FreeBSD partition,
he changed the partition "type" using T.  The slice editor then showed
"the right thing".  However, when he then got to partition allocation,
hitting A resulted in the following message:

  Unable to create the root partition. Too big?

Going back and deleting the FreeBSD slice (was a FAT slice), then creating
it again caused auto-partitioning to work fine.  It sounds like the
change in slice type is not being propagated properly to the partitioning
phase.  Also, it sounds like the debugging output from the partition
creation is a tad on the not-so-specific-side.

>How-To-Repeat:

Use Partition Magic, DOS Fdisk, or some other magic tool to create
two FAT partitions on a disk.  Then run the 4.2-RELEASE install floppies
and use T to change the first slice to a FreeBSD partition.  Then
continue to the FreeBSD partitioning screen, and hit A for automatic
partition creation.  The failure should occur.

>Fix:

Not attached.


>Release-Note:
>Audit-Trail:

From: Vallo Kallaste <vallo@matti.ee>
To: rwatson@FreeBSD.ORG
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/24435: Unable to create root partition. Too big?
Date: Fri, 19 Jan 2001 08:04:59 +0200

 On Thu, Jan 18, 2001 at 12:09:31PM -0500, rwatson@FreeBSD.ORG wrote:
 
 > 
 > >Number:         24435
 > >Category:       bin
 > >Synopsis:       Changing slice type causes Auto-partition to not work
 > 
 > A co-worker of mine was installing FreeBSD 4.2-RELEASE on a machine
 > that previously held two FAT partitions.  Rather than delete and
 > recreate the first partition to change it to a FreeBSD partition,
 > he changed the partition "type" using T.  The slice editor then showed
 > "the right thing".  However, when he then got to partition allocation,
 > hitting A resulted in the following message:
 > 
 >   Unable to create the root partition. Too big?
 > 
 > Going back and deleting the FreeBSD slice (was a FAT slice), then creating
 > it again caused auto-partitioning to work fine.  It sounds like the
 > change in slice type is not being propagated properly to the partitioning
 > phase.  Also, it sounds like the debugging output from the partition
 > creation is a tad on the not-so-specific-side.
 
 I've encountered this bug also. 4.2-stable as I remember.
 -- 
 
 Vallo Kallaste
 vallo@matti.ee
 

From: Seth Kingsley <sethk@osd.bsdi.com>
To: freebsd-gnats-submit@FreeBSD.org, rwatson@FreeBSD.org
Cc:  
Subject: Re: bin/24435: Changing slice type causes Auto-partition to not work
Date: Thu, 22 Mar 2001 20:48:05 -0800

 This has to do with libdisk(3) not creating an 'unused' partition for
 slice types other than 'freebsd'. This patch to libdisk checks for the
 existance of the 'unused' partition and creates one if need be:
 
 Index: chunk.c
 ===================================================================
 RCS file: /ncvs/src/lib/libdisk/chunk.c,v
 retrieving revision 1.24
 diff -u -r1.24 chunk.c
 --- chunk.c	2001/03/18 21:30:10	1.24
 +++ chunk.c	2001/03/23 04:42:56
 @@ -109,6 +109,32 @@
  	return c2;
  }
  
 +/*
 + * Check to see if this slice has no partitions. If it does not, create
 + * an empty one spanning the entire slice. This can happen when an
 + * existing slice of a different type is changed into a 'freebsd' slice.
 + */
 +void
 +Check_Unused(struct chunk *cp)
 +{
 +	struct chunk	*ncp = new_chunk();
 +
 +	if (cp->part)
 +	    return;
 +	if (!ncp) barfout(1,"malloc failed");
 +	memset(ncp,0,sizeof *ncp);
 +	ncp->disk = cp->disk;
 +	ncp->offset = cp->offset;
 +	ncp->size = cp->size;
 +	ncp->end = cp->end;
 +	ncp->type = unused;
 +#ifdef PC98
 +	ncp->sname = strdup(cp->sname);
 +#endif /* PC98 */
 +	ncp->name = strdup("-");
 +	cp->part = ncp;
 +}
 +
  int
  #ifdef PC98
  Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name,
 @@ -263,6 +289,8 @@
  		c1 = Find_Mother_Chunk(d->chunks,offset,end,freebsd);
  	if(!c1)
  		return __LINE__;
 +	if(type == part)
 +		Check_Unused(c1);
  	for(c2=c1->part;c2;c2=c2->next) {
  		if (c2->type != unused)
  			continue;
 Index: create_chunk.c
 ===================================================================
 RCS file: /ncvs/src/lib/libdisk/create_chunk.c,v
 retrieving revision 1.55
 diff -u -r1.55 create_chunk.c
 --- create_chunk.c	2001/03/18 21:30:10	1.55
 +++ create_chunk.c	2001/03/23 04:45:41
 @@ -240,6 +240,7 @@
      
      if (!parent)
  	parent = d->chunks;
 +    Check_Unused(parent);
      for (c1=parent->part; c1 ; c1 = c1->next) {
  	if (c1->type != unused) continue;
  	if (c1->size < size) continue;
 Index: libdisk.h
 ===================================================================
 RCS file: /ncvs/src/lib/libdisk/libdisk.h,v
 retrieving revision 1.37
 diff -u -r1.37 libdisk.h
 --- libdisk.h	2001/03/18 21:30:10	1.37
 +++ libdisk.h	2001/03/23 04:44:47
 @@ -265,6 +265,7 @@
  void Debug_Chunk(struct chunk *);
  void Free_Chunk(struct chunk *);
  struct chunk * Clone_Chunk(struct chunk *);
 +void Check_Unused(struct chunk *);
  #ifdef PC98
  int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long, const char *);
  #else
 
 -- 
 || Seth Kingsley || BSDi/Open Source Division || sethk@osd.bsdi.com ||

From: Steve Mazerski <smazerski@yahoo.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Cc: rwatson@FreeBSD.org
Subject: Re: bin/24435: Changing slice type causes Auto-partition to not work
Date: Sun, 14 Jul 2002 00:22:37 +0200

 This email submitted to the "Submit Followup" link on:
 
 http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dbin%2F24435
 
 I have experienced the same problem with 4.6-RELEASE
 while attempting to rededicate a Linux ext2fs partition
 as a FreeBSD slice.
 
 Despite having changed the partition type to FreeBSD,
 in the partition allocation screen any attempt to
 create a partition produced the error message
 
   Unable to create the partition. Too big?
 
 I was able to remedy the situation by using the Linux
 fdisk to set the partition system ID to FreeBSD.
 On restarting the installation process, I was able
 to configure the slice correctly; the error message
 did not reoccur.
 
 
 Yours
 
 S.Mazerski
 

From: "Crist J. Clark" <crist.clark@attbi.com>
To: Steve Mazerski <smazerski@yahoo.co.jp>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: bin/24435: Changing slice type causes Auto-partition to not work
Date: Sun, 14 Jul 2002 01:21:31 -0700

 On Sat, Jul 13, 2002 at 03:30:03PM -0700, Steve Mazerski wrote:
 > The following reply was made to PR bin/24435; it has been noted by GNATS.
 > 
 > From: Steve Mazerski <smazerski@yahoo.co.jp>
 > To: freebsd-gnats-submit@FreeBSD.org
 > Cc: rwatson@FreeBSD.org
 > Subject: Re: bin/24435: Changing slice type causes Auto-partition to not work
 > Date: Sun, 14 Jul 2002 00:22:37 +0200
 > 
 >  This email submitted to the "Submit Followup" link on:
 >  
 >  http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dbin%2F24435
 >  
 >  I have experienced the same problem with 4.6-RELEASE
 >  while attempting to rededicate a Linux ext2fs partition
 >  as a FreeBSD slice.
 >  
 >  Despite having changed the partition type to FreeBSD,
 >  in the partition allocation screen any attempt to
 >  create a partition produced the error message
 >  
 >    Unable to create the partition. Too big?
 
 Did you reboot? I believe that once the kernel loads up it's idea of a
 slice table, it doesn't change even though you _do_ change the table
 on the disk.
 
 That would still be a bug tho'.
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

From: Steve Mazerski <smazerski@yahoo.co.jp>
To: "Crist J. Clark" <cjc@FreeBSD.ORG>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: bin/24435: Changing slice type causes Auto-partition to not work
Date: Sun, 14 Jul 2002 11:21:00 +0200

 On Sunday 14 July 2002 10:21, Crist J. Clark wrote:
 > On Sat, Jul 13, 2002 at 03:30:03PM -0700, Steve Mazerski wrote:
 > > The following reply was made to PR bin/24435; it has been noted by GN=
 ATS.
 > >
 > > From: Steve Mazerski <smazerski@yahoo.co.jp>
 > > To: freebsd-gnats-submit@FreeBSD.org
 > > Cc: rwatson@FreeBSD.org
 > > Subject: Re: bin/24435: Changing slice type causes Auto-partition to =
 not
 > > work Date: Sun, 14 Jul 2002 00:22:37 +0200
 > >
 > >  This email submitted to the "Submit Followup" link on:
 > >
 > >  http://www.freebsd.org/cgi/query-pr.cgi?pr=3D3Dbin%2F24435
 > >
 > >  I have experienced the same problem with 4.6-RELEASE
 > >  while attempting to rededicate a Linux ext2fs partition
 > >  as a FreeBSD slice.
 > >
 > >  Despite having changed the partition type to FreeBSD,
 > >  in the partition allocation screen any attempt to
 > >  create a partition produced the error message
 > >
 > >    Unable to create the partition. Too big?
 >
 > Did you reboot? I believe that once the kernel loads up it's idea of a
 > slice table, it doesn't change even though you _do_ change the table
 > on the disk.
 
 I didn't get to the point in the installation program where changes were
 written to disk. I don't know whether it is possible to coerce the=20
 installation programm to commit changes to the partition table before
 proceeding to the disklabel editor. I did restart the installation proces=
 s=20
 several times, in the belief I had missed something.
 
 After rebooting into Linux, changing the partition/slice type to FreeBSD,
 then restarting the installation process, the problem went away.
 
 > That would still be a bug tho'.
 
 I suspect it is.
 
 If I can be of any help (reproducing the situation, testing a fix)
 please let me know.
 
 Many thanks for your feedback.
 
 Yours
 
 S.Mazerski
 
Responsible-Changed-From-To: freebsd-bugs->qa 
Responsible-Changed-By: jhb 
Responsible-Changed-When: Wed Nov 13 08:03:35 PST 2002 
Responsible-Changed-Why:  
This is a sysinstall/libdisk PR, so kick it over to qa@.  There is also a 
patch in the followups that should be tested. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24435 
Responsible-Changed-From-To: freebsd-bugs->brucec  
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sat Mar 13 00:17:49 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24435 
State-Changed-From-To: open->feedback 
State-Changed-By: brucec 
State-Changed-When: Sat Apr 24 13:30:13 UTC 2010 
State-Changed-Why:  
It looks like this was fixed in r109080 in 2003. Can you  
still reproduce this issue? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24435 
State-Changed-From-To: feedback->closed 
State-Changed-By: brucec 
State-Changed-When: Sat Apr 24 13:50:11 UTC 2010 
State-Changed-Why:  
I have confirmed that the bug is present on 4.2 and fixed in 6.3. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24435 
>Unformatted:
