Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Dec 2008 20:47:41 +0100
From:      Marius Strobl <marius@alchemy.franken.de>
To:        David Cornejo <dcornejo@gmail.com>, marcel@FreeBSD.org
Cc:        freebsd-sparc64@FreeBSD.org
Subject:   Re: invalid disk label on updated current ultra60
Message-ID:  <20081231194741.GA57089@alchemy.franken.de>
In-Reply-To: <6b8e8f4f0812281128lf48f391r38f063f7f797404@mail.gmail.com>
References:  <6b8e8f4f0812281128lf48f391r38f063f7f797404@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 28, 2008 at 09:28:49AM -1000, David Cornejo wrote:
> Hi,
> 
> I've got an ultra60 that works fine with a kernel built Nov 22nd  and
> new kernels starting at least a couple of days ago claim that the
> disklabel on da0 & da1 are invalid and mounting root fails.  This is a
> fairly old system that was probably installed with 6 or 7 and upgraded
> to 8.  I haven't seen this problem on my x86/amd64 machines is there
> some incantation to make the disklabels valid?
> 

Apparently the problem are labels (originally) generated by
Solaris, which uses the native geometry reported by the
target rather than a synthetic one based on 255 heads and
63 sectors as demonstrated by the following format(1M) output
for two identical disks, the first labeled with format(1M)
and the second with sunlabel(8) (after zeroing the previous
one):
       0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@1f,700000/scsi@2/sd@0,0
       1. c1t1d0 <FreeBSD68G cyl 8922 alt 2 hd 255 sec 63>
          /pci@1f,700000/scsi@2/sd@1,0

The 63 sectors limit of GEOM_PART_VTOC8 also causes problems
with IDE disks > 32GB where FreeBSD uses a synthetic geometry
based on 255 sectors like Solaris does in order to circumvent
the 16-bit cylinders, heads and sectors fields of the Sun and
VTOC8 disk labels. I think the upper limits for heads and
sectors therefore should be just removed from GEOM_PART_VTOC8,
which should also be safe, i.e. no upper bound needed, as done
by the below patch in order for their maximum value to be used.
Marcel, are you okay with this? Do you have a good idea how
to avoid the warning regarding geometry mismatch for labels
created by Solaris?

Marius

Index: g_part_vtoc8.c
===================================================================
--- g_part_vtoc8.c	(revision 186424)
+++ g_part_vtoc8.c	(working copy)
@@ -371,7 +371,7 @@ g_part_vtoc8_read(struct g_part_table *basetable,
 	msize = pp->mediasize / pp->sectorsize;
 
 	sectors = be16dec(&table->vtoc.nsecs);
-	if (sectors < 1 || sectors > 63)
+	if (sectors < 1)
 		goto invalid_label;
 	if (sectors != basetable->gpt_sectors && !basetable->gpt_fixgeom) {
 		g_part_geometry_heads(msize, sectors, &chs, &heads);
@@ -382,13 +382,15 @@ g_part_vtoc8_read(struct g_part_table *basetable,
 	}
 
 	heads = be16dec(&table->vtoc.nheads);
-	if (heads < 1 || heads > 255)
+	if (heads < 1)
 		goto invalid_label;
 	if (heads != basetable->gpt_heads && !basetable->gpt_fixgeom)
 		basetable->gpt_heads = heads;
 	if (sectors != basetable->gpt_sectors ||
 	    heads != basetable->gpt_heads)
-		printf("GEOM: %s: geometry does not match label.\n", pp->name);
+		printf("GEOM: %s: geometry does not match VTOC label "
+		    "(%uh,%us != %uh,%us).\n", pp->name, heads, sectors,
+		    basetable->gpt_heads, basetable->gpt_sectors);
 
 	table->secpercyl = heads * sectors;
 	cyls = be16dec(&table->vtoc.ncyls);
@@ -444,7 +446,7 @@ g_part_vtoc8_read(struct g_part_table *basetable,
 	return (0);
 
  invalid_label:
-	printf("GEOM: %s: invalid disklabel.\n", pp->name);
+	printf("GEOM: %s: invalid VTOC label.\n", pp->name);
 	return (EINVAL);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081231194741.GA57089>