*BSD News Article 30892


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.Hawaii.Edu!ames!lll-winken.llnl.gov!decwrl!pa.dec.com!nntpd.lkg.dec.com!oils!jenkins
From: jenkins@oils (Jon Jenkins)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Install to second disk
Date: 20 May 1994 12:32:51 GMT
Organization: Digital Equipment Corporation
Lines: 322
Message-ID: <2rialj$4j7@nntpd.lkg.dec.com>
NNTP-Posting-Host: oils.ozy.dec.com
X-Newsreader: TIN [version 1.2 PL2]


A few days ago i posted a question regarding
installing FreeBSD onto the second hard disk
while retaining MS-DOS (or other os) on the
primary disk and using a boot manager to
select which os to use. Obviously this issue
is a hot topic as it drew many replies
and further requests. So I have gathered the
replies and hints together and reposted back
to the news group.

Please do not take what i say as absolute truth
this is merely a collection of hints and replies
gathered from other sources with a sprinkling
of common sense and misconceptions thrown in.

I work almost exclusively with OSF/1 and my BSD
knowledge IS guaranteed to be at best out of date
and at worst plain WRONG. So please
point out the errors (in fact this is the main 
reason for this posting: to get a consensus
on the best way to do this.

Many thanks to all the people who replied.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NOTE: THIS IS ONLY A COLLECTION OF ITEMS
SENT BY SEVERAL PEOPLE. IT WOULD BE PRUDENT
TO WAIT UNTIL REPLIES APPEAR ON THE NET
SO THAT ERRORS MAY BE CORRECTED
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The problems:

a) The install script does not give the option
to install to a second hard disk.

b) The kernel appears to be hardwired as far as
   swap etc to wd0

c) You need to create new disk info manually
   and rebuild the kernel so that the kernel 
   knows what is going on. ( this implies you
   require a LARGE disk!).

d) If you want to access the primary disk from
   BSD you have to create a (small: few cylinders)
   partition on it, make the partition of type BSD
   (see later), and put the partition name (the
   one in the fstab file) into the partition. This
   requires that the exact disk parameters be known
   and that the start(offset)/length of the "access"
   partition be known. I have been reccomended to
   a prog called fips.exe, but have not used it
   yet, to do all this partitioning (read the 
   doco supplied then READ IT AGAIN!!!).


OK now to the options.

--------------------------------------------
OPTION 1:

Forget RELEASE 1.1 and wait for 1.1.1. A couple
of people from ucb tell me that the next release 
will have all these problems solved and will/may
supply a boot manager as well. No ETA for this
version was given.

---------------------------------------------
OPTION 2:

you will need the following programs and aids
to assit you:

1: a boot manager

BTEASY14.ZIP: ftp from freebsd@freefall.cdrom.com
in the dir /pub/BSD/FreeBSD/FreeBSD-1.1-RELEASE/tools/dos-tools/

                OR
OSBSBETA.EXE: ftp from ftp.prz.tu-berlin.de
in the dir /pub/pc/os-bs    

        READ THE DOCO THEN READ IT AGAIN!!!

2: wd1-filesys.floppy.gz: from ftp.cdrom.com
in the dir /pub/FreeBSD/incoming/

3: a method for configuring the swap device etc

   sources for the kernel and the knowledge to 
   edit & rcompile the kernel for swap and dump
   to wd1 (not difficult to do but dangerous 
   if you dont know what you are doing)

                OR

   a generic wd1 kernel: ftp from ftp.cdrom.com
   in the dir /pub/FreeBSD/incoming/Generic-wd1.kernel.gz


4: know the exact number of 
    i)  cylinders on your disk(s)
    ii) heads (or tracks) on your disk
    iii)sectors per track
    iv) bytes per sector (usually 512)

first some notes on fstab entries. The fstab file
sets up entries for all the disks attached to your
machine.

the entries are as follows (comments CANNOT BE 
INCLUDED in the real file).

#tell system the name of the drive
cp30254|conner 250MB drive:\ # the partition name for this disk
#tell system the drive parameters
:dt=ST506:\       # the disk interface type for IDE (others SCSI etc)
:ty=winchester:\  # a winchester disk (others ?? bernouli etc)
:se#512:\         # 512 bytes per sector
:nc#895:\         # number of cylinders on disk
:nt#10:\          # number of tracks or heads
:ns#55:\          # number of sectors per track
#set up the root partition
:pa#13750:\       # the length of partition a
:oa#0:\           # the offset of partition a 
                    (some use 255 from start why 
                    boot sectors ??)
:ta=4.2BSD:\      # the file system on partition a
:ba#4096:\        # the block size for read/write ops
:fa#512:\         # the block size for segments (purpose ??)
#set up the swap partition
:pb#68750:\       # the length of partition b
:oa#13750:\       # the offset of partition b
:ta=swap:\        # the file system on partition b
#set up the /usr partition
:pe#409750:\      # the length of partition e
:oe#82500:\       # the offset of partition e 
:te=4.2BSD:\      # the file system on partition e
:be#4096:\        # the block size for read/write ops
:fe#512:\         # the block size for segments (purpose ??)
#set up global access partition
:pc#492250:\      # length of whole disk
:oc#0:\           # start of global (some use 255 why boot sectors ??)

etc etc

the numbers are in sectors i.e. total disk = 895*10*55=492250
so you need to know these numbers.

if you are going to make your primary drive accessible
to BSD you will also need an entry for that drive (call it
a different name!) with the small access drive length/ofset 
 etc entered. These numbers can be found from "fdisk" 
or other programs such as "fips".

The default (convention not enforced) partitions and their
mount point are as follows

a=root          # kernel etc
b=swap          # swap and crash area
c==d==whole disk# for idiots
e=/var          # saved core dumps and admin
f=scratch       # wot is this ??
g=???           # do the partion names have to be sequential ??
h=/usr          # the play area

these partitions can be mounted wherever you want (within reason)
but it is usually wise to stick to the convention

Also know that the first few sectors on a hard disk are
usually a boot-loader code (which is what the boot manager
programs replace) and that a further "sector" on the 
disk somewher (usually the first in a partition) is what
actually loads the kernel. This "second" boot loader is
file somewhere in the normal filesystem. The bios on PCs 
loads the first sector on the first disk it can find to 
approx c700 and jumps to it unconditionally. Therfore
what we have to do is replace the boot-loader in cylinder0,
track0, head0 with a generic one (on disk 0) which asks 
us which partition we want to boot from. This is dangerous
activity BACKUP BACKUP BACKUP BACKUP .......... For DOS
keep a system formatted floppy with fdisk on it for emergency
use (the /mbr option of fdisk can be usd to restore the 
original DOS boot sector, see later).

OK here goes:

1: DO A BACKUP ..............
2: DID YOU DO A BACKUP ? NO GOTO STEP 1
3: remove the primary disk and put the second disk in its place
4: get your BSD dist & floppies & source
5: follow the instructions for normal installation
6: get bsd working for this drive!!! (non trivial). Then get
   the sources unpacked and have a look around at the boot code
   and makefies. have a look in the /sys directories for
   system configuration files.
7: i)  save a copy of the kernel config file as .00
   ii) edit the kernel config file "/sys/arch/i386/conf" ??
       and change all references of wd0 to wd1

       except keep the wd1 reference in the the following lines so 
       you will be able to access your primary drive if required:

        controller  wdc0    at isa  port "IO_WDI" bio irq 14 vector wdintr
        disk        wd0     at wdc0 drive 0
        disk        wd1     at wdc0 drive 1


8: i)  save a copy of boot.c (or RCS) 
   ii) edit boot.c and find/change the following lines to be as shown

76,82
      ouraddr,
      argv[7] = memsize(0),
      argv[8] = memsize(1),
      "$Revision 1.11mod $"); /* just to tell us which kernel */
   printf("use hd(1,a) /386bsd to boot when wd0 is also
         installed\n");
   gateA20();
loadstart:

87,90
      part = 0;
      unit = (drive & 0x7f);  /* hard disks start at 0x80 so get unit bits*/
      if (drive&0x80) /* is it a hard drive ? */
         maj=0;         /* yep */
      else
         maj=2;

also you will need to edit the Makefile in the same directory
to change the "disklabel" line for your fstab name and entries. I 
dont know what the other entries on this line are for, anyone care
to enlighten ??

    i.e. disklabel -r -w wd0 <drive_name> newboot biosboot bootbios

    I am not sure why but I am told you then need to do the following
    make all
    make install
    make wd0
    make wd1

9:  build a kernel
    assuming you are in /sys/arch/i386/conf do the following:
    config <filename_you_just_edited>
    cd ../compile/<filename_you_just_edited>
    make depend
    make
    mv /386bsd /386bsd.00
    mv 386bsd /386bsd

10: i)  make a copy of fstab
    ii) edit fstab and change all the mount points 
        to point to /dev/wd1a-h (as required) as well 
        as for other partitions

11: if you are using MS-DOS on your primary hard disk
    make a formatted system disk with fdisk and sys
    on it. also copy the os-bs distributiiion files
    and nortons disktool and the saved boot sector info
    if you have it.


12: Shutdown and put the bsd disk into drive 2 position
    reboot on the primary disk (DOS in my case).

13: use os-bs (or other boot manager) to make a copy of your boot
    sector(s) in case of emergency. Load the generic boot manager
    and follow the instructions. Including the option to
    boot from hard drive 2. Nortons disktool will also save 
    and restore important boot and partition info. The type
    of filesystem for 386BSD is 0xA5 (i think). 

14: Now reboot and the boot manager should give you the option
    of booting from drive 2. When the bsd prompt appears (hopefully)
    boot on the kernel you made earlier. This is done by entering
    something like:

    wd(1,a)new_kernel 

    before the timer expires.

    If all goes well then you can remove the saved files (after 
    extensive testing of both OSs of course). If it doesnt use the 
    formatted floppy then fdisk (undocumented /mbr option) or 
    disktool to reinstall the original boot sector and get onto
    the net to report the problems/ask questions.

------------------------------------------------------
OPTION 3

instead of the steps above download the replacement 
files listed below:

1:
wd1-filesys.floppy.gz: from ftp.cdrom.com 
in the dir /pub/FreeBSD/incoming/

2:
a generic wd1 kernel: ftp from ftp.cdrom.com
in the dir /pub/FreeBSD/incoming/Generic-wd1.kernel.gz

and then install as normal. These replacements are wired to
install to wd1 (so I am led to believe) then goto step 7 
above. You may need to reconfigure swap devices etc but Im told
that this method will work. I have not tried it yet.
----------------------------------------------------------------------
Name:        Dr Jon Jenkins
Location:    Digital Equipment Corp, NaC, 
             Burnett Place, Research Park, 
             Bond University, Gold Coast
             QLD, AUSTRALIA 4229
Phone:       (075) 75-0174
Fax:         (075) 75-0100
Internet:    jenkins@ozy.dec.com

The opinions expressed above are entirely personal and do not
reflect the corporate policy of DEC or the opinions of DEC management.
-----------------------------------------------------------------------