[net.bugs.4bsd] Some "hp.c" partitions too big in 4.[12]bsd?

ado@elsie.UUCP (Arthur David Olson) (11/16/84)

Apologies if this has been discussed before.
(I failed to find it in the Mt. Xinu reports.)

The bad144(8) writeup in the 4.1bsd UNIX Programmer's Manual reads (in part):
	The bad sector information and replacement sectors are conventionally
	only accessable through the "c" file system partition of the disk.
(The spelling "accessible" is used in the 4.2bsd manual.)

Although clearly an effort was made to have this be so, the bad sector
information and replacement sectors of rm05's can be accessed (and clobbered)
through the "f" and "g" file system partitions if you use "hp.c" as distributed
with either 4.1bsd or 4.2bsd; those of rm80's can be accessed (and clobbered)
through the "h" file system partition on 4.1bsd (through the "f" and "g" file
system partitions on 4.2bsd).  The same may be true of other types of disk;
rm05's and rm80's are what we have.

If you want to ensure that bad sector information and replacement sectors can
only be accessed through the "c" file partition, I believe these are the changes
to "hp.c".  Be sure to read the notes that follows them.  As is so often true,
the trade secretivity of the code involved precludes a clearer posting.

The first change is to the "rm5_sizes" ("rm05_sizes" in 4.2bsd) table in "hp.c":

> #ifdef OLDVERSION
> 	86240,	681,		/* F=cyl 681 thru 822 */
> 	158592,	562,		/* G=cyl 562 thru 822 */
> #else
> 	32*19*(823-681)-(32+126), 681,	/* F=cyl 681 thru 822 less bad sector */
> 					/* 86178 512-byte sectors net */
> 					/* 43089 1024-byte sectors */
> 	32*19*(823-562)-(32+126), 562,	/* G=cyl 562 thru 822 less bad sector */
> 					/* 158530 512-byte sectors net */
> 					/* 79265 1024-byte sectors */
> #endif

The second change, to "rm80_sizes", comes in two flavors. . .one for 4.1bsd:

> #ifdef OLDVERSION
> 	110143,	305,		/* H=cyl 305 thru 558 */
> #else
> 	31*14*(559-305)-(31+126), 305,	/* H=cyl 305 thru 558 less bad sector */
> 					/* 110079 512-byte sectors net */
> 					/* 55039 1024-byte sectors */
> #endif

. . .and one for 4.2bsd:

> #ifdef OLDVERSION
> 	120559,	281,		/* F=cyl 281 thru 558 */
> 	192603,	115,		/* G=cyl 115 thru 558 */
> #else
> 	31*14*(559-281)-(31+126), 281,	/* F=cyl 281 thru 558 less bad sector */
>  					/* 120495 512-byte sectors net */
> 	31*14*(559-115)-(31+126), 115,	/* G=cyl 115 thru 558 less bad sector */
>  					/* 192539 512-byte sectors net */
> #endif

In each of the expressions of the form
	31*14*(559-115)-(31+126)
the first number is the number of sectors per track, the second is the number of
tracks per cylinder, the third is the number of cylinders per disk, and the
fourth is number of the starting cylinder for the partition.  The result of the
multiplications is the number of sectors that you'd have in the partition if it
were to include the bad sector stuff.  The fifth number is the number of sectors
per track--the last track on the disk is used to hold bad sector information--
and the sixth number, 126, is the number of bad sector replacement sectors used
in DEC's scheme.  The sum of these last two must be subtracted from the result
of the multiplications for the "bad sector sectors" to be excluded from the
partition.

If, in an affected partition, you've set up a file system that's big enough to
have used some of the "bad sector sectors," then BEFORE you install a system
with the above changes you get to "dump" the file systsem (and, of course, you
get to "restor" it after you install the system).  You can skip doing this if
the "mkfs" command you used to set up the file system specified a sufficiently
small size; "sufficiently small" is any number less than or equal to the
"1024-byte sectors" counts in the comments above on a 4.1bsd system.
There's probably more work to do if you're running 4.2bsd; since we're running
4.1bsd, someone else surely knows better than I.

The code distributed with 4.1bsd and 4.2bsd works fine with "perfect" packs;
if, providentially, you have such packs, you may want to avoid making any
system changes so as to avoid doing "dump"s and "restor"s.

In any case, I'd advise waiting until some UNIX wizards give their opinions
on this matter before doing anything.  While I THINK I've got this right. . .
--
UNIX is an AT&T Bell Laboratories trademark.
Bugs is a Warner Brothers trademark.
THINK is an IBM trademark.
HP is a Hewlett-Packard trademark.
Mt. Xinu may be a Mt. Xinu trademark.
--
	..decvax!seismo!elsie!ado			(301) 496-5688
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks