FreeBSD trashed after installing Win98SE in lower partition - what to do?

John john at starfire.mn.org
Fri Jan 7 08:42:39 PST 2005


My questions have to do with the mess I have left after trying to do
a dual-boot system with Win98SE and FreeBSD 4.9+.

After running the FreeBSD system for nearly a year, and loving it,
I finally got around to digging up the media I needed to do the
Win98SE install, and my FreeBSD partition is now unbootable.  This,
obviously, is very disturbing.

I'll start off with an overview, and then providing increasingly
greater detail.

1) Install a placeholder C: partition of just under 2Gb for
   future Windows installation.
2) Install FreeBSD in the remaining 65% of the drive, run
   happily for a year
3) Fail in installing FreeBSD 5.2.1 in the placeholder Windows
   partition, rendering computer unusable (BootMgr just beeps)
4) Recreate the Windows boot partition type by hand - the C: drive is now
   gone, but FreeBSD works for weeks.
5) Finally get around to digging up and installing a copy of Windows 98SE.
6) Reinstall BootMgr, so helpfully ripped out by Windows.
FreeBSD now blows up on trying to boot.  Windows 98 works (well, as
well as 98SE ever works).

The questions I'm going to get to and need answers for, based on the
details to follow are
1) What did I do wrong(other than using an MS-operating system, that's
   just a series of unfortunate events which are unavoidable)?
2) Do I have any viable options other than just reinstalling at
   this point (in which case, I might as well just go with 5.3
   and be done with it)?
3) Will this happen again if I need to reinstall Win98se?  What if
   I install XP?  Do I need to make any adjustments to my fdisk
   partitions ward off problems in the future?
4) Is there any action I can take to help prevent others from
   experiencing the pain I have just unwittingly inflicted on myself?

In a little greater detail, this is what I did:

1) Partition and format a "placeholder" C: drive of just under 2Gb
   (1980Mb) in the first part of the disk, and format a C: drive there.
2) Install FreeBSD 4.9-RELEASE on the rest of the drive, and
   use CVSup on a different computer to track things for awhile
   (That's how I got to "stable+"). Run happily for a nearly a
   year, with KDE, OpenOffice, and other fun toys and productive
   tools.
3) Decide that, since I'm not using the Windows partition yet
   anyway, maybe it would be fun and productive to install
   FreeBSD 5.2.1 in that partition to see if some of the laptop-specific
   things that don't in FreeBSD 4 (like suspend/resume, automatic
   battery monitoring, etc).  This process failed, because
   FreeBSD 5.2.1, even though it would BOOT from the CD-ROM drive,
   would not recognize it once the MFS system was up and running!
   I tried again with an NFS install after booting the MFS
   system, but that hung after having scribbled on the 
   disk (still don't know why - gave up.  This, incidentally,
   wiped out the original Win98SE "C" drive formatting, which
   may, ultimately, have been a part of my problems, or maybe it
   has nothing to do with it - any insight here would be appreciated.)
4) The system was now unusable.  BootMgr would just beep at
   me, regardless of whether I picked F1 or F2.
   I used the bootable CD sysinstall program to manually change
   the partition type of the first back to "12" as it had
   been when when the placeholder DOS/Win98 filesystem lived
   there.  The system was now, apparently, back to normal.
   Although there was nothing to boot in the F1 partition, F2
   brought up my FreeBSD 4.9+ system just fine.  I had had
   the DOS/Windows partition mounted as an msdos filesystem
   and I had to remove that from /etc/fstab, but otherwise,
   it seemed fine and I used it for weeks.
5) My son got some Windoze software for Christmas that would
   not run on our old Windoze desktop, so I finally got around
   to installing Windows 98SE, which installed and runs fine.
6) Windows so helpfully overwrote the MBR, eliminating the
   BootMgr.  I used the bootable CD and sysinstall AGAIN to
   restore BootMgr
7) FreeBSD blows chunks when it tries to boot.

That covers the sequence of events in more detail, so let's go deep
with information and what I've done since.

The hardware is a Compaq Armada M700 laptop with a Pentium-III 650,
320Mb of RAM, and a 6Gb hard drive (Toshiba MK6015MAP) with a
kernel-reported geometry of c12416, h15, and s63, and a Compaq
CRN-8241B CD-ROM.

When I try to boot FreeBSD, this is what happens:

BTX loader 1.00 TX version is 1.01
Console: internal video/keyboard
BIOS drive A: is disk0
BIOS drive C: is disk1
BIOS 639kB/326592kB available memory

FreeBSD/i386 bootstrap loader, Revision 0.8
(john at dexter.starfire.mn.org, Tue Feb 17 15:17:21 CST 2004)
Loading /boot/defaults/loader.conf
/kernel text=0x1a3573 data=0x2820c+0x1b8e8 syms=[0x4+02a7e0+0x4+0x31327]
-
Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [kernel]...
/
int=0000000d  err=0000f18c  efl=00010002  eip=0011f405
eax=002a6580  ebx=002e8074  ecx=00000000  edx=00027520
esi=00343b84  edi=002e8074  ebp=0009ea40  esp=00093a3c
cs=0008  ds=0010  es=0010    fs=0010  gs=0010  ss=0010
cs:eip=07 00 00 00 c3 be 74 80-2e 00 8b 3d ec 65 2a 00
ss:esp=8c f1 11 00 7c 4a 09 00-47 95 00 00 00 00 00 80
BTX halted

If I interrupt the boot process, and try one of my two other
kernel files, they fail, though each one is different:

ok unload
ok load kernel.GENERIC
/kernel.GENERIC text=0x32afd5 data=0x4e334+0x34a40 syms=[0x4+0x45c00+0x4+0x4e1fa]
ok boot
spinning bar, the Copyright and Timer messages, then a whole bunch of messages
that fly by at screaming speed for a second (far too fast to perceive)
then self-reboot


ok unload
ok load kernel.old
/kernel.old yaddah yaddah...
ok boot
spinning bar - then BOOM!  reboot - never even gets to the copyright or ID
messages.

I tried booting into fixit on the CD ROM, copying over /etc/group
and /dev/MAKEDEV, creating that ad0s2a, ad0s2b, ad0s2c, ad0s2d, ad0s2e,
ad0s2f, ad0s2g, and ad0s2h and then doing an "fsck -n /dev/ad0s2a"
but the damage was rampant.  I used "-n" for a first pass, just in
case it was a configuration error.  Though I'm beginning to regret it
now, I did not use a separate /usr partition.

By this method, I can fsck my "home"(ad0s2e) and "var"(ad0s2f)
partition  cleanly, with the original geometry, which makes me
think that the geometry is workable, even though an fsck of
of / is so disastrous.

Though I was not clever enough to capture the fdisk table and
geometry before all this went South, I do have what it was after
Windows got done with it:
Cylinders=12416 heads=15 sectors/track=63 (945 blks/cyl)
The data for partition 1 is:
sysid 12,(DOS or Windows 95 with 32 bit FAT, LBA)
    start 63, size 4052097 (1978 Meg), flag 80 (active)
        beg: cyl 0/ sector 1/ head 1;
	end: cyl 1023/ sector 63/ head 14
The data for partition 2 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 4052160, size 7680960 (3750 Meg), flag 0 
        beg: cyl 1023/ sector 63/ head 255;
	end: cyl 1023/ sector 63/ head 14
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

Obviously, the ending value of the CSH notation (btw - why is that
CSH instead of CHS?) for partition 1 is bogus, as are the beginning
and ending for partition 2.  This lead to some concern on my part.
The beginning of partition 2 is coded in an especially odd manner,
to my thinking.

This produces the above results while booting.

FreeBSD fdisk says "Figures below won't work with BIOS for partitions
not in cyl 1", so, thinking that Windows might played with the
geometry, even though it's running in LBA mode, I tried 64 and 256
heads, respectively:

Cylinders=2910 heads=64 sectors/track=63 (4032 blks/cyl)
The data for partition 1 is:
sysid 12,(DOS or Windows 95 with 32 bit FAT, LBA)
    start 63, size 4052097 (1978 Meg), flag 80 (active)
        beg: cyl 0/ sector 1/ head 1;
	end: cyl 1004/ sector 63/ head 63
The data for partition 2 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 4052160, size 7680960 (3750 Meg), flag 0 
        beg: cyl 1005/ sector 1/ head 63;
	end: cyl 1023/ sector 63/ head 63
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

Cylinders=728 heads=256 sectors/track=63 (16128 blks/cyl)
The data for partition 1 is:
sysid 12,(DOS or Windows 95 with 32 bit FAT, LBA)
    start 63, size 4052097 (1978 Meg), flag 80 (active)
        beg: cyl 0/ sector 1/ head 1;
	end: cyl 251/ sector 63/ head 63
The data for partition 2 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 4052160, size 7680960 (3750 Meg), flag 0 
        beg: cyl 251/ sector 1/ head 64;
	end: cyl 727/ sector 63/ head 127
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

Win98 works just fine for both of these, but the F2 for Bootmgr for
FreeBSD just beeps at me.

The fsck of ad0s2a starts out with a partially truncated INode at
inum 16, then unknown file types an "unexpected soft update
inconsistency" for 120-123, another partially untraced Inode at
143, then back to the unknown file type for 144-147, then partiall
truncated 200, 224, and 260, unknown file type for 372-375, 396-399,
624-627, 648-651, 876-879, 900-903, 1128-1131, 1152-1155, 1380-1383,
1404-1407, 1632-1635, etc. etc, always with 4 inodes being trashed,
skip 24, 4 trashed, skip 228, 4 trashed, skip 24, 4 trashed, skip
228, etc, all the way through i=21063.  4 skip 24, 4 skip 228.
That must mean something, but I don't know what.  It is also evident
that the damage goes VERY DEEP into the filesystem, OR the filesystem
parameters were damaged in such a way as to make fsck THINK that
there is wide-spread damage.  I could understand Win98 reaching
slightly out of its partition, but not twenty-one thousand inodes
worth!

After that, we go into the "DUP/BAD NAME" phase, which, with so many
inodes damaged (or believed to be damaged), is very long and
extensive (/usr/local/include stuff, /usr/X11R6 stuff, /usr/local/share
stuff, and /usr/compat/linux seem to be the hardest hit, but
something is obviously wrong with the kernel images, as well).

The BSD partitions look reasonable:
#        size   offset    fstype   [fsize bsize bps/cpg]
a:    3072000        0    4.2BSD        0     0     0   # (Cyl.    0 - 3250*)
b:     967616  6713344      swap                        # (Cyl. 7104*- 8127*)
c:    7680960        0    unused        0     0         # (Cyl.    0 - 8127*)
e:    3379200  3072000    4.2BSD        0     0     0   # (Cyl. 3250*- 6826*)
f:     262144  6451200    4.2BSD        0     0     0   # (Cyl. 6826*- 7104*)

Well, the "fsize bsize and bps/cpg" all being zero seems a bit odd,
but my current running FreeBSD 4.3 systems shows that on some of its
perfectly-functioning disks, too, as well as the fact that I can
cleanly fsck the e and f partitions.

My current guess is that the filesystem parameters are damaged,
and I don't know how to fix them.  So, unless someone knows of an
adjustment I can make to the filesystem my going idea is that I
should just install 5.3 on top of whatever mess I have there, and
move on.  My concern is that I'll somehow cause of of this to happen
again sometime due to the partitioning or other configuration.

Just so you don't have to go all the way back to the top, here are
my basic questions again:
1) What did I do wrong(other than using an MS-operating system, that's
   just a series of unfortunate events which are unavoidable)?
2) Do I have any viable options other than just reinstalling at
   this point (in which case, I might as well just go with 5.3
   and be done with it)?
3) Will this happen again if I need to reinstall Win98se?  What if
   I install XP?  Do I need to make any adjustments to my fdisk
   partitions ward off problems in the future?
4) Is there any action I can take to help prevent others from
   experiencing the pain I have just unwittingly inflicted on myself?

Any observations, information, or suggestions will be gratefully received.

Thank you!

-- 

John Lind
john at starfire.MN.ORG


More information about the freebsd-questions mailing list