Subject: Re: Disklabels... (continued)
To: Secret Asian Man <cchen@nougat.org>
From: Justin Tripp <justin@ee.byu.edu>
List: port-hp300
Date: 07/21/2000 21:45:13
As far as I can tell, everything should be okay.  The only thing that is
possible is odd is that the cpg (Cylinders per group) column is zeros.  
It should be 16.

I have looked at the source code of disklabel, and it does not seem to
help.

       for (i = 0; i < lp->d_npartitions; i++) {
                part = 'a' + i;
                pp = &lp->d_partitions[i];
                if (pp->p_size == 0)
                   continue;
                if (boffset <= pp->p_offset) {
                  if (pp->p_fstype == FS_BOOT)
                    pp->p_fstype = FS_UNUSED;
                } else if (pp->p_fstype != FS_BOOT) {
                    if (pp->p_fstype != FS_UNUSED) {
                      warnx("boot overlaps used partition %c", part);
                      errors++;
                    } else {
                      pp->p_fstype = FS_BOOT;
                       warnx("warning, boot overlaps partition %c, %s",
                             part, "marked as FS_BOOT");
                    }
                }
        }
        if (errors)
                errx(4, "cannot install boot program");

It seems that disklabel starts at a and loops through the partitions
looking for a place to put the boot block.  If there is no room, it
attempts to place some of it in a separate partion.  pp is equal to the
partion information.  The first check sees if the boffset which is :

boffset = bootsize / lp->d_secsize;  (The size of the boot block in
					sectors.)
if this will fit in the offset available in the current partition.  One
partition is 1008 * 512 = 516096 bytes.  I believe the boot block is the
one found in /usr/mdec, which is only 87k + maybe 80K more
(?).  Certainly, the 1 cylinder provides enough space.  My own machine,
has slightly larger cylinders (524288 bytes) and that works ...

So, if there is not space, it checks to see if the partition is not the
boot partition.  Then it checks to see if the partition is being
used.  That is where the error comes from.  I do not understand why this
error is occuring -- I would try allocating one more cylinder just to see
if it helps ... 

					.justin.

On Thu, 20 Jul 2000, Secret Asian Man wrote:

;)The saga continues: This time, with what seems like a valid disklabel, garned via the kernel's magic SCSI "gimme your information please" facilities...
;)
;)hagel# disklabel sd0
;)# /dev/rsd0c:
;)type: SCSI
;)disk: SCSI disk
;)label: SUN1.05 cyl 2036
;)flags:
;)bytes/sector: 512
;)sectors/track: 72
;)tracks/cylinder: 14
;)sectors/cylinder: 1008
;)cylinders: 2036
;)total sectors: 2052288
;)rpm: 5400
;)interleave: 1
;)trackskew: 0
;)cylinderskew: 0
;)headswitch: 0           # milliseconds
;)track-to-track seek: 0  # milliseconds
;)drivedata: 0 
;)
;)4 partitions:
;)#        size   offset     fstype   [fsize bsize   cpg]
;)  a:   256032     1008     4.2BSD     1024  8192     0   # (Cyl.    1 - 254)
;)  b:   256032   257040     4.2BSD     1024  8192     0   # (Cyl.  255 - 508)
;)  c:  2052288        0       boot                        # (Cyl.    0 - 2035)
;)  d:  1539216   513072     4.2BSD     1024  8192     0   # (Cyl.  509 - 2035)
;)
;)And it seems fine; I give 1 cylinder's space for the bootloader, and...
;)
;)hagel# disklabel -B sd0
;)disklabel: boot overlaps used partition a
;)disklabel: boot overlaps used partition c
;)disklabel: cannot install boot program
;)
;)It still fails. I thought this was a FAQ, but I can't find much of anything on this...
;)
;)any more ideas?
;)
;)cc
;)
;)-- 
;)Christopher Kyin-hwa Chen <cchen@nougat.org>
;)<http://www.nougat.org/~cchen/>
;)"Norman Schwarzkopf! Something tells me you wanna go home!" --Beck
;)

------------------------------------------------------------------------
Justin Leonard Tripp                                   justin@ee.byu.edu
Configurable Computing Laboratory Research Assistant      CB 461 x8-7206
Electrical and Computer Engineering Department  Brigham Young University