Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Nov 98 01:39:42 +0700
From:      tedm@toybox.placo.com
To:        FAQ@FreeBSD.ORG
Subject:   Update question #4.1  I have bad blocks on my hard drive
Message-ID:  <9811171012.AA0068@toybox.placo.com>

next in thread | raw e-mail | index | archive | help
Remove everything after:

"for other drive types you are dependent on support from the operating system"

And replace it with the following:

For IDE drives, any bad block is usually a sign of potential trouble.  All 
modern IDE drives come with internal bad-block remapping turned on.  All IDE 
hard drive manufacturers today offer extensive warranties and will replace 
drives with bad blocks on them.

If you still want to attempt to rescue an IDE drive with bad blocks, you can 
attempt to download the IDE drive manufacturer's IDE diagnostic program, and 
run this against the drive.  Sometimes these programs can be set to force the 
drive electronics to rescan the drive for bad blocks and lock them out.

For ESDI, RLL and MFM drives, bad blocks are a normal part of the drive and
are no sign of trouble, generally.  With a PC, the disk drive controller
card and BIOS handle the task of locking out bad sectors.  This is fine for
operating systems like DOS that use BIOS code to access the disk.  However,
FreeBSD's disk driver does not go through BIOS, therefore a mechanism, bad144,
exists that replaces this functionality.  bad144 only works with the wd driver, 
it is NOT able to be used with SCSI.  bad144 works by entering all bad
sectors found into a special file.

One caveat with bad144 - the bad block special file is placed on the last
track of the disk.  As this file may possibly contain a listing for a bad 
sector that would occur near the beginning of the disk, where the /kernel
file might be located, it therefore must be accessible to the bootstrap
program that uses BIOS calls to read the kernel file.  This means that the
disk with bad144 used on it must not exceed 1024 cylinders, 16 heads, and
63 sectors.  This places an effective limit of 500MB on a disk that is 
mapped with bad144

To use bad144, simply set the "Bad Block" scanning to ON in the FreeBSD
fdisk screen during the initial install.  This works up through FreeBSD 2.2.7.
The disk must have less than 1024 cylinders.  It is generally recommended
that the disk drive has been in operation for at least 4 hours prior to this
to allow for thermal expansion and track wandering.

If the disk has more than 1024 cylinders (such as a large ESDI drive) the
ESDI controller uses a special translation mode to make it work under DOS.
The wd driver understands about these translation modes, IF you enter the
"translated" geometry with the "set geometry" command in fdisk.  You must also
NOT use the "dangerously dedicated" mode of creating the FreeBSD partition,
as this ignores the geometry.  Also, even though fdisk will use your overridden 
geometry, it still knows the true size of the disk, and will attempt to 
create a too large FreeBSD partition.  If the disk geometry is changed to the 
translated geometry, the partition MUST be manually created with the number of 
blocks.

A quick trick to use is to set up the large ESDI disk with the ESDI controller, 
boot it with a DOS disk and format it with a DOS partition.  Then, boot the 
FreeBSD install and in the fdisk screen, read off and write down the blocksize 
and block numbers for the DOS partition.  Then, reset the geometry to the same 
that DOS uses, delete the DOS partition, and create a "cooperative" FreeBSD
partition using the blocksize you recorded earlier.  Then, set the partition 
bootable and turn on bad block scanning.  During the actual install, bad144 
will run first, before any filesystems are created.  (you can view this with an 
Alt-F2)  If it has any trouble creating the badsector file, you have set too 
large a disk geometry - reboot the system and start all over again.  (including 
repartitioning and reformatting with DOS)


//-------------------------------------------------------------------------
// Ted Mittelstaedt         See my "Network Community" columns at
//  tedm@toybox.placo.com        http://www.computerbits.com
//  "When they split apart molecules, they found atoms.  When they split
//   apart atoms they found explosions"                                                    

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



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