From: mjj@mlb.dmt.csiro.au (Murray Jensen)
Newsgroups: comp.unix.bsd
Subject: Re: 2nd drive file ... (Actually wd ESDI problems)
Date: 16 Aug 92 18:27:50 GMT
Organization: CSIRO Division of Manufacturing Technology, Melbourne, Australia

From article <92081228768@zone4.ocunix.on.ca>, by andrew@zone4.ocunix.on.ca (Andrew Low):
> In article <193@asgard.mlb.dmt.csiro.au> 
> mjj@mlb.dmt.csiro.au (Murray Jensen) writes:
>>partition C *contains* partitions A, B, E, F, G, H *and* the bad144 area,
>>none of which should overlap if they exist.

Please read the above two lines carefully - the bad144 area is inside
partition C.

> 
> Well, I don't get it because you go to some trouble to explain that the
> bad144 area is contained within the C partition - then..
> 
>>		  size	offset	cylinders
>>	A:	 10360	 80640	 288- 324
>>	B:	 30800	 91000   325- 434
>>	C:	205240	 80640	 288-1020
>>	D:	285880	     0	   0-1020
>>	E:	 80080	   560	   2- 287
>>	H:	163800	121800	 435-1019
> 
> 80640 + 205240 = 285880 (which is the size of the D partition, no?)
> 
> Thus it seems to me that this disktab entry doesn't leave any space
> for the bad144 sector markings.

This table does leave room for the bad144 area - at the end of partition C
*inside* partition C.

The equation you show above simply means that partition C occupies the
205240 sectors starting at sector 80640 relative to the start of the physical
disk. Since I want 386BSD to use the last 100MB of the 140MB disk, it is
important that this equation holds, otherwise I would be wasting space at
the end of the disk. The C partition should cover only the area of the disk
"owned" by 386BSD. Partition D always covers the entire physical disk,
regardless of where partition C is situated. If I had 386BSD use the first
100MB and DOS the last 40MB of the disk then partitions C, D & E would look
like this:

		  size	offset	cylinders
	C:	205240	     0	   0- 732
	D:	285880	     0	   0-1020
	E:	 80640	205240	 733-1020

And partitions A, B and H would change to be inside C. If you don't run DOS
and have given the entire disk over to 386BSD, then partitions C & D will
be identical (and you won't have a partition E - which I should point out
that I chose arbitrarily as the partition I would use to access DOS, and
that I haven't even tried it yet). Another important thing to note is that
the bad144 area would move to cylinder 732 in this case, as this is the last
cylinder of partition C.

Think of the BSD partitions as "viewports" onto the disk, where the D
"viewport" covers the entire disk, the C "viewport" covers that part
of the disk allocated to 386BSD (be it either the entire disk or a single
DOS partition of type 0xA5), and the other A, B, E, F, G & H "viewports"
look into areas of the disk you wish to access. "viewports" are specified
by their size in sectors, and the offset in sectors from sector 0 of the
physical disk. You can do anything you like, but it might be wise to
follow these rules also:
	1. "viewports" A, B, E, F, G & H shouldn't overlap each other.
	2. "viewports" A, B, E, F, G & H should be entirely inside of
	   or outside of "viewport" C i.e. they shouldn't overlap the
	   boundaries of "viewport" C.
	3. "viewports" A, B, E, F, G & H should avoid the last N cylinders of
	   "viewport" C if you are using bad144 bad sector forwarding (where
	   N is enough whole cylinders to cover 1 track plus 126 sectors).
	4. because of 3, avoid using "viewport" C for a 386BSD filesystem.
	   I would also avoid using "viewport" D for a 386BSD filesystem.
	5. bad144 is really only useful for sectors inside of "viewport" C
	   as most other stuff outside won't know bad144 from a bar of soap.
	   e.g. you should access DOS partitions without bad144 mapping and
	   write error handling code into your user level software (e.g.
	   mtools) to handle bad sectors the same way that DOS would (which
	   I might add mtools doesn't seem to do at the moment if my
	   experiences with Linux are anything to go by).
	6. because of 5, if you put a 386BSD filesystem on any of "viewports"
	   A, B, E, F, G or H, then that "viewport" should be entirely contained
	   within "viewport" C, otherwise it won't be covered by bad144.

Sorry if I rambled on a bit here, but I wanted to make sure that I was
expressing myself clearly. It's not easy (well not for me anyway :-)
								Murray...
-- 
Murray Jensen, CSIRO Div of Manufacturing Tech,     Phone: +61 3 487 9263
Locked Bag No. 9, Preston, Vic, 3072, Australia.      Fax: +61 3 484 0878
Internet: mjj@mlb.dmt.csiro.au			   ACSnet: mjj@asgard.dmt.oz
Newsgroups: comp.unix.bsd