Subject: Re: Big IDE disks -- install problems
To: None <Havard.Eidnes@runit.sintef.no>
From: Michael Graff <explorer@flame.org>
List: port-i386
Date: 09/15/1998 12:37:27
Havard.Eidnes@runit.sintef.no writes:

>  o Using the "default" geometry (2055c/255h/63s), newfs complains
>    loudly that with that large a cylinder group, I would have to
>    jack up the block size from 8K to 32K and the fragment size
>    from 1K to 4K.  Even though the disk is large I'm not
>    particularly keen on wasting that much disk space.

Is that what the bootup string prints?

The trick I've learned with LBA disks (IDE, SCSI) is pretty simple,
but a little scarry at first.

(1) In the BIOS fdisk info, put a "sensible" geometry that will use
    the majority of the disk.  I usually end up coding the heads to
    255 and sectors to 63, and doing the math to come up with the
    number of cylinders.

(2) In the NetBSD disklabel, put the data the drive reports, including
    heads, cylinders, sectors/track, _and_ sectors on the disk.  If
    NetBSD is the first or only partition on the drive, start at
    sector 63, not 0.

(3) On the i386, the c partition should be the NetBSD portion of the
    drive, the d partition the whole drive (starting at 0, size == #
    of disk sectors) and the other partitions wherever they need to
    go.

This has worked with IDE and SCSI reliably for me.  Anything else
broke in some way.

Here's how I did my disk:

root@aerie# fdisk wd0
******* Working on device /dev/rwd0d *******
Warning: BIOS sector numbering starts with sector 1
parameters extracted from in-core disklabel are:
cylinders=6136 heads=16 sectors/track=63 (1008 sectors/cylinder)

parameters to be used for BIOS calculations are:
cylinders=767 heads=128 sectors/track=63 (8064 sectors/cylinder)

...
1: sysid 169 (NetBSD)
    start 3072384, size 3104640 (1515 MB), flag 0x0
        beg: cylinder  381, head   0, sector  1
        end: cylinder  765, head 127, sector 63

root@aerie# dmesg | grep ^wd0
wd0 at wdc2 drive 0: <WDC AC33100H>
wd0: using 16-sector 16-bit pio transfers, lba mode
wd0 3020MB, 6136 cyl, 16 head, 63 sec, 512 bytes/sect x 6185088 sectors

root@aerie# disklabel wd0
# /dev/rwd0d:
type: ST506
disk: mydisk
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 6136
total sectors: 6185088
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

8 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:   305424  3072384      4.2BSD     1024  8192    16   # (Cyl. 3048 - 3350)
  b:   526176  3377808        swap                        # (Cyl. 3351 - 3872)
  c:  3104640  3072384      unused        0     0         # (Cyl. 3048 - 6127)
  d:  6185088        0      unused        0     0         # (Cyl.    0 - 6135)
  e:  2281104  3903984      4.2BSD     1024  8192    16   # (Cyl. 3873 - 6135)
  f:  3072321       63       MSDOS                        # (Cyl. 0*- 3047*)