Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jun 1995 20:35:38 -0700 (PDT)
From:      Poul-Henning Kamp <phk@ref.tfs.com>
To:        jkh@freebsd.org, faq@freebsd.org, doc@freebsd.org
Subject:   more doc
Message-ID:  <199506070335.UAA00460@ref.tfs.com>

next in thread | raw e-mail | index | archive | help
Bruce and I have read it and OK'ed it.

Forwarded message:
From: John Lind <john@starfire.mn.org>
Message-Id: <199506061915.OAA15611@starfire.mn.org>
Subject: Re: panic: page fault booting 2.0.5A
To: phk@ref.tfs.com (Poul-Henning Kamp)
Date: Tue, 6 Jun 1995 14:15:24 -0500 (CDT)
In-Reply-To: <199506061755.KAA28096@ref.tfs.com> from "Poul-Henning Kamp" at Jun 6, 95 10:54:57 am
X-Mailer: ELM [version 2.4 PL23]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 11081     

> How about
> 
> After the kernel is loaded, it uses its own device drive instead of the
> BIOS to access the disk.

Done!  I have incorporated the changes suggested by Bruce, as well.
I believe that I have been faithful to his intent, but if there is
time and he is willing, he could certainly take a look at the new
version.

I do have one concern -- after incoporating the changes, the name of
the FreeBSD driver ("wd") no longer appears...  Do you think that that
is important?

                                  FreeBSD
             Using "Mature Technology" (MFM, ESDI) hard drives

First, please read and make sure that you understand the "diskspace" FAQ.

The term "partition" has become overloaded when referring to an area of a
hard disk drive.  I will use "slice" in this document to refer to an area
which is a "partition" to DOS FDISK.  This usage is consistent with most of
current FreeBSD.  I will use the word "partition" to refer to an area de-
fined by a FreeBSD disklabel, of which there is one per FreeBSD slice.  The
FreeBSD partitions may contain filesystems, swap space, or be available as
raw disk devices to applications.

This document covers the steps you will need to perform before starting the
FreeBSD installation and which are specific to these types of disk drives.

1 Disk layout planning
2 Disk installation (may already be done)
3 Low-level formatting (may or may not be required)

If your drive is installed and formatted properly, careful planning is all
that you need to do.

During the installation, there is only one special step that is required.
This is also one place where the FreeBSD taxonomic convention breaks down
-- the assignment of slices is called "Partitioning" in the FreeBSD proce-
dures at the time of this writing.  During that step, when you assign the
FDISK slices, be sure to specify that the bad144 lists should be created
(the "B" command).

1 Disk layout planning
----------------------

To be able to make the right decisions regarding the setup of slices for
FreeBSD, you need to understand that the initial boot stages for FreeBSD
rely on the ROM BIOS, but that the ROM BIOS is not used in any way once the
FreeBSD kernel is loaded.  After the kernel is loaded, it uses its own
driver instead of the BIOS to access the disk.

These older disks do not do automatic bad block management.  Some con-
trollers seem to do so, but this is a feature of the ROM BIOS on that con-
troller, and therefore is not available once FreeBSD is running.  Other
controllers use a different method of bad sector handling (slipping), but
this feature can also induce translations in the sectoring which will pre-
vent successful installation.  Do not use automatic sector mapping or sec-
tor slipping, even if it is supported on the controller, for the same rea-
sons that you cannot use a translated disk geometry.

To be able to use these drives, the driver has to be able to substitute
good sectors for the bad ones.  The FreeBSD filesystems assume "perfect"
disks, so the bad sector handling is done in the driver.  The way this is
done is that a few copies of the list of bad sectors is kept at the end of
the slice.  When a slice is opened, this list is read and kept in the driv-
er.  On every access to the drive, the list is consulted to see if a sub-
stitute sector, also from the end of the slice, must be used rather than
the sector that the filesystem or application is actually asking for.  This
list is called the bad144 list, which name comes from a Digital Equipment
Corporation standard for keeping this information.

There are three reasons that you would be required to use more than one
FreeBSD slice on your disk, and all of them are more probable the larger
your drive is.

1)  The FreeBSD portion of your drive will extend beyond cylinder 1023.
2)  The FreeBSD portion of your drive has (or is likely to have) more than
    126 bad sectors.
3)  You need more than 7 filesystems for FreeBSD.

It is not sufficient to make sure that the entire boot filesystem is inside
of cylinder 1024, unless it just so happens that that filesystem occupies a
flawless part of the disk.  To be able to read the bad144 list during the
boot process (via the ROM BIOS), the end of the slice must be within the
first 1024 cylinders.  There are also some boot managers, e.g. the OS/2
boot manager, that require a bootable slice to be entirely below cylinder
1024.

The bad144 data format only allows for 126 sectors to be mapped.  If your
drive is large, it could easily have more than this many over its entire
size.  I have a 320 Mb drive which is unusually error-filled, but still
within acceptable tolerances, and it has this problem (but it also has more
than 1024 cylinders, so I'd have had to split it, anyway).

The FreeBSD disk label has room for 8 partitions.  It is not recommended
that filesystems be placed on partitions b or c, even on non-booted slices,
so that leaves 6 partitions within each slice which may contain filesys-
tems.  Older versions of FreeBSD did not support filesystems on partition d
either, but the slice-handling capability has eliminated that restriction.
It may be best to avoid using partition d if you can for compatibility pur-
poses.  The installation procedures skip from a to e for this reason.

2 Disk installation
-------------------

Physical installation is outside the scope of this document.  Consult the
documentation provided by your computer, controller, and disk drive ven-
dor(s).

3 Low-level formatting
----------------------

If you are starting from scratch, you may need to low-level format your
drive(s).  If you have been using your drive with the intended controller
for DOS or some other system, and will not be changing the physical orien-
tation of the drive, then you can skip this step.  If the drive is new, if
you are changing the physical orientation of the drive, or it has been used
with a different controller, you may need to do the low-level format.  Be
aware that some drives have jumpers on them to help compensate for changes
in physical orientation (horizontal, right side, or left side), but it is
highly recommended that, if you are changing the physical orientation of
the drive, you redo the low-level format.  The "sag" of the disk head arma-
ture and other effects of gravity are quite significant at the sizes of the
bits and tracks on these drives.  The greater the capacity of your drive,
the more critical this becomes.  With 10-40Mb MFM drives, you may get away
with it.  Beyond that, you are definitely rolling dice.

The MFM drive format is standard, and a drive formatted on one manufacturer
and model of controller should work just fine on another, but ESDI drive
formats vary between manufacturers and sometimes even between models.  A
new ESDI drive (yes, they can still be found new in the box, years old), or
one that has been in use on a different controller or in a different physi-
cal orientation will definitely require reformatting.

As the ESDI specification developed, the ability to put the error map in-
formation (Manufacturer's Defect List, or MDL) on the drive was added.
Since it was not known how the drive would be formatted, or even what the
size of the data part of the sectors would be, each bad spot is expressed
as bytes from the index and length of the bad area in bits.  This informa-
tion is recorded in a few different cylinders on each track and contains
only information pertinent to the corresponding head.  The most universal
place for this information is in the last cylinder.  Later ESDI drives sup-
port a "phantom" cylinder at 0xfff (4095) where this information is kept --
the actual location of this cylinder is beyond the "last" cylinder reported
for data use.  If your drive does not support cylinder 0xfff, or if your
controller doesn't know how to use it, and if you wish to preserve the man-
ufacturer's defect list, do not format the last cylinder of your drive.
The format of the MDL is such that regular data operations will not work on
a track containing that information.

As a further caveat, it as been observed that some controllers hang if the
MDL area is accessed for data use, while others simply report an error and
go on with life.  You will want to be careful to not include the MDL area
in any FreeBSD slice, but you will want to be especially careful in case
your controller is one of those that hangs if you miss.

Now that you have decided how much of the drive to format, you can proceed
with the actual format process.  How this is done varies widely from con-
troller to controller.  For most of them, you need to jump into a special
location in the controller ROM using the DOS DEBUG program.  For a few,
special software is provided on diskette for the controller.  Because these
procedures and the ways to initiate them vary so much, it is outside of the
scope of this document to describe them.  Consult the manufacturer's docu-
mentation for this procedure.

Many of the controllers have the ability to read and use the MDL.  Even
though you cannot use the controller's bad block mapping capability, which
is supported through the BIOS, it may be beneficial to allow the controller
to use this information during the format process.  When the drive was
tested at the factory, it was tested at the operating margins, not just op-
timal conditions.  Therefore, there may be entries in the MDL that would be
missed by a run-of-the-mill data scan.  If the controller is permitted to
use the MDL during formatting, many of them will format the sector with a
special flag set in the sector preamble to guarantee that that sector will
show up as bad on a read.  This is, in fact, the mechanism that some con-
trollers use to handle bad sector mapping, though FreeBSD does not use the
same mechanism.  We can take advantage of this feature as a 'round about
way to get the MDL represented in the bad144 list.  Having the sectors
which contain a bad spot formatted as bad will make certain that you don't
use a sector where some data patterns may fail even though the initial scan
passed that sector as OK.  Even if the sector doesn't produce hard errors,
it may cause soft (correctable) errors and time-consuming retries.

Finally, FreeBSD
----------------

Having made your careful plans and preparations, you are ready to use
FreeBSD on your MFM or ESDI disk drive.  Don't forget to request bad block
scanning during the "Partition" slice assignment, and you should be on your
way to satisfying computing.  Be prepared to allow time for the bad block
scan to take place.  Depending on a variety of system parameters, such as
CPU speed, controller type, disk rotational and seek speeds, and so forth,
this process will take anywhere from several minutes to hours.  If you for-
get to do the scan, it is likely that the installation will fail trying to
make the filesystems, and if it should make the filesystems, it will surely
fail when you start using them.

		   John Lind, Starfire Consulting Services
E-mail: john@starfire.MN.ORG		USnail: PO Box 17247, Mpls MN  55417



-- 
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Just that: dried leaves in boiling water ?



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