Subject: Boot an IDE drive on port-i386 - pardon
To: None <port-i386@netbsd.org>
From: Martin Weber <Ephaeton@gmx.net>
List: port-i386
Date: 08/04/2001 23:42:53
Okay this is my idiocy seemingly.

So here comes my problem. When I _upgraded_ to netbsd I had a machine with 
two ide drives and an installed linux. Linux was living on the first disk, 
using the second disk for some data. As I did not want to deal with lilo 
booting the netbsd loader, I switched the boot priority in my bios, masking 
the second drive as the first and vice versa (that is, at boot time, my wd0 
is my wd1 and other way round, when the system boots it's "right" again.) I 
had some problems with the "old" (second) ide drive understanding DMA, and as 
I managed all the moving of all the data from the linux drives to the NetBSD, 
I was newfsing and fdisking/disklabeling the linux drive (which understands 
DMA fine) and pax'ed the data from the second drive to the first (means atm I 
have two mirrors of my working NetBSD system - one on wd0, one on wd1). Now I 
want to boot from my first ide so after paxing, I booted into wd1a:netbsd 
from the boot menu (as I said, wd1 really is wd0) and ran installboot -f 
/usr/mdec/biosboot.sym /dev/rwd0a. Okay, then I rebooted, and changed 
priority in bios, so wd0 REALLY is wd0 now. Gives me a "read err". Okay, so I 
thought I made something wrong, changed priority and booted via my old disk. 
Checked fdisk, which says I have a 16 sector (0 MB) bios partition on wd0. 
Erm strange. I went into fdisk and corrected the information. Ran installboot 
again. Now fdisk says again I have a 16 sector thing at :3 . hmm rebooted, 
did not work. Tried fdisk -B and installboot in various combinations (run 
this or that , or first this and then that or first that and this) and it 
either gives me a bootmenu (F4:NetBSD) which prints again and again and does 
not boot anything or a "read err". Hmm. I don't know how to procede further. 
Here is some verbose info about my box :

phaeton# fdisk wd0
NetBSD disklabel disk geometry:
cylinders: 16383 heads: 16 sectors/track: 63 (1008 sectors/cylinder)

BIOS disk geometry:
cylinders: 1022 heads: 255 sectors/track: 63 (16065 sectors/cylinder)

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: sysid 169 (NetBSD)
    start 0, size 19807200 (9671 MB), flag 0x80
        beg: cylinder    0, head   0, sector  1
        end: cylinder 1021, head 254, sector 63

phaeton# fdisk wd1
NetBSD disklabel disk geometry:
cylinders: 8960 heads: 15 sectors/track: 63 (945 sectors/cylinder)

BIOS disk geometry:
cylinders: 526 heads: 255 sectors/track: 63 (16065 sectors/cylinder)

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: sysid 169 (NetBSD)
    start 63, size 8467137 (4134 MB), flag 0x80
        beg: cylinder    0, head   1, sector  1
        end: cylinder  525, head 254, sector 63
phaeton# disklabel wd0
# /dev/rwd0d:
type: ESDI
disk: IBM-DTTA-351010 
label: ayaken
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 19807200
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size   offset     fstype   [fsize bsize cpg/sgs]
  a:  2048000        0     4.2BSD     1024  8192    16   # (Cyl.    0 - 2031*)
  b:  2048000  2048000       swap                        # (Cyl. 2031*- 4063*)
  e: 15711200  4096000     4.2BSD     1024  8192    16   # (Cyl. 4063*- 19649)

phaeton# disklabel wd1 
# /dev/rwd1d:
type: unknown
disk: banzai
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 15
sectors/cylinder: 945
cylinders: 8960
total sectors: 8467200
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size   offset     fstype   [fsize bsize cpg/sgs]
  a:   699237       63     4.2BSD     1024  8192    16   # (Cyl.    0*- 739)
  b:  1312605   699300       swap                        # (Cyl.  740 - 2128)
  c:  8467137       63     unused        0     0         # (Cyl.    0*- 8959)
  d:  8467200        0     unused        0     0         # (Cyl.    0 - 8959)
  e:  6455295  2011905     4.2BSD     1024  8192    16   # (Cyl. 2129 - 8959)

phaeton# mount
/dev/wd0a on / type ffs (local, soft dependencies)
/dev/wd0e on /usr type ffs (local, soft dependencies)
/dev/wd1a on /altroot type ffs (local)
/dev/wd1e on /altusr type ffs (local, soft dependencies)
kernfs on /kern type kernfs (local)
procfs on /proc type procfs (local)

(this last command shows output after booting wd1a:netbsd from bootpromt at 
wd0a which is masked via bios, in reality i booted wd0 from wd1 If I'm 
booting my wd1 directly I mount wd0 stuff on /alt{root,usr} and wd1 at 
{/,/usr}

If I boot via wd1, with bios masking it as wd0, all works fine, and I can 
boot wd1a:netbsd (which is wd0a:netbsd in reality) or wd0a:netbsd (which is 
wd1a:netbsd). I haven't found out how to boot the real first disk tho. 

Any pointers appreciated.. (yes I've read man fdisk, man installboot... )

Martin Weber

(P.S.: Would this better fit on netbsd-help ?)