752 lines
		
	
	
	
		
			29 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			752 lines
		
	
	
	
		
			29 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| <!-- $FreeBSD$ -->
 | |
| 
 | |
| <!DOCTYPE ARTICLE PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
 | |
| <!ENTITY % articles.ent PUBLIC "-//FreeBSD//ENTITIES DocBook FreeBSD Articles Entity Set//EN">
 | |
| %articles.ent;
 | |
| ]>
 | |
| 
 | |
| <article>
 | |
|   <articleinfo>
 | |
|     <title>Installing and Using FreeBSD With Other Operating Systems</title>
 | |
| 
 | |
|     <authorgroup>
 | |
|       <author>
 | |
| 	<firstname>Jay</firstname>
 | |
| 
 | |
| 	<surname>Richmond</surname>
 | |
| 
 | |
| 	<affiliation>
 | |
| 	  <address>
 | |
| 	    <email>jayrich@sysc.com</email>
 | |
| 	  </address>
 | |
| 	</affiliation>
 | |
|       </author>
 | |
|     </authorgroup>
 | |
| 
 | |
|     <pubdate>6 August 1996</pubdate>
 | |
| 
 | |
|     <legalnotice id="trademarks" role="trademarks">
 | |
|       &tm-attrib.freebsd;
 | |
|       &tm-attrib.ibm;
 | |
|       &tm-attrib.linux;
 | |
|       &tm-attrib.microsoft;
 | |
|       &tm-attrib.powerquest;
 | |
|       &tm-attrib.general;
 | |
|     </legalnotice>
 | |
| 
 | |
|     <abstract>
 | |
|       <para>This document discusses how to make FreeBSD coexist nicely
 | |
| 	with other popular operating systems such as Linux, &ms-dos;,
 | |
| 	&os2;, and &windows; 95.  Special thanks to: Annelise Anderson
 | |
| 	<email>andrsn@stanford.edu</email>, Randall Hopper
 | |
| 	<email>rhh@ct.picker.com</email>, and &a.jkh;.</para>
 | |
|     </abstract>
 | |
|   </articleinfo>
 | |
| 
 | |
|   <sect1>
 | |
|     <title>Overview</title>
 | |
| 
 | |
|     <para>Most people can not fit these operating systems together
 | |
|       comfortably without having a larger hard disk, so special
 | |
|       information on large EIDE drives is included.  Because there are
 | |
|       so many combinations of possible operating systems and hard disk
 | |
|       configurations, the <xref linkend="ch5"> section may be of the
 | |
|       most use to you.  It contains descriptions of specific working
 | |
|       computer setups that use multiple operating systems.</para>
 | |
| 
 | |
|     <para>This document assumes that you have already made room on
 | |
|       your hard disk for an additional operating system.  Any time you
 | |
|       repartition your hard drive, you run the risk of destroying the
 | |
|       data on the original partitions.  However, if your hard drive is
 | |
|       completely occupied by DOS, you might find the FIPS utility
 | |
|       (included on the FreeBSD CDROM in the
 | |
|       <filename>\TOOLS</filename> directory or via <ulink
 | |
| 	url="ftp://ftp.FreeBSD.org/pub/FreeBSD/tools/">ftp</ulink>)
 | |
|       useful.  It lets you repartition your hard disk without
 | |
|       destroying the data already on it.  There is also a commercial
 | |
|       program available called <application>&partitionmagic;</application>, which lets you size
 | |
|       and delete partitions without consequence.</para>
 | |
|   </sect1>
 | |
| 
 | |
|   <sect1 id="ch2">
 | |
|     <title>Overview of Boot Managers</title>
 | |
| 
 | |
|     <para>These are just brief descriptions of some of the different
 | |
|       boot managers you may encounter.  Depending on your computer
 | |
|       setup, you may find it useful to use more than one of them on
 | |
|       the same system.</para>
 | |
| 
 | |
|     <variablelist>
 | |
|       <varlistentry>
 | |
| 	<term>Boot Easy</term>
 | |
| 
 | |
| 	<listitem>
 | |
| 	  <para>This is the default boot manager used with FreeBSD.
 | |
| 	    It has the ability to boot most anything, including BSD,
 | |
| 	    &os2; (HPFS), &windows; 95 (FAT and FAT32), and Linux.
 | |
| 	    Partitions are selected with the function keys.</para>
 | |
| 	</listitem>
 | |
|       </varlistentry>
 | |
| 
 | |
|       <varlistentry>
 | |
| 	<term>&os2; Boot Manager</term>
 | |
| 
 | |
| 	<listitem>
 | |
| 	  <para>This will boot FAT, FAT32, HPFS, FFS (FreeBSD), and EXT2
 | |
| 	    (Linux).  Partitions
 | |
| 	    are selected using arrow keys.  The &os2; Boot Manager is
 | |
| 	    the only one to use its own separate partition, unlike the
 | |
| 	    others which use the master boot record (MBR).  Therefore,
 | |
| 	    it must be installed below the 1024th cylinder to avoid
 | |
| 	    booting problems.  It can boot Linux using LILO when it is
 | |
| 	    part of the boot sector, not the MBR.  Go to <ulink
 | |
| 	      url="http://www.linuxresources.com/LDP/HOWTO/HOWTO-INDEX.html">Linux
 | |
| 	      HOWTOs</ulink> on the World Wide Web for more
 | |
| 	    information on booting Linux with the &os2; boot
 | |
| 	    manager.</para>
 | |
| 	</listitem>
 | |
|       </varlistentry>
 | |
| 
 | |
|       <varlistentry>
 | |
| 	<term>OS-BS</term>
 | |
| 
 | |
| 	<listitem>
 | |
| 	  <para>This is an alternative to Boot Easy.  It gives you more
 | |
| 	    control over the booting process, with the ability to set
 | |
| 	    the default partition to boot and the booting timeout.
 | |
| 	    The beta version of this programs allows you to boot by
 | |
| 	    selecting the OS with your arrow keys.  It is included on
 | |
| 	    the FreeBSD CD in the <filename class="directory">\TOOLS</filename>
 | |
| 	    directory, and via <ulink
 | |
| 	      url="ftp://ftp.FreeBSD.org/pub/FreeBSD/tools/">ftp</ulink>.</para>
 | |
| 	</listitem>
 | |
|       </varlistentry>
 | |
| 
 | |
|       <varlistentry>
 | |
| 	<term>LILO, or LInux LOader</term>
 | |
| 
 | |
| 	<listitem>
 | |
| 	  <para>This is a limited boot manager.  It will boot FreeBSD,
 | |
| 	    though some customization work is required in the LILO
 | |
| 	    configuration file.</para>
 | |
| 	</listitem>
 | |
|       </varlistentry>
 | |
|     </variablelist>
 | |
| 
 | |
|     <note id="fat32">
 | |
|       <title>About FAT32</title>
 | |
| 
 | |
|       <para>FAT32 is the replacement to the FAT filesystem included in
 | |
| 	Microsoft's OEM SR2 Beta release, which started replacing FAT
 | |
| 	on computers pre-loaded with &windows; 95 towards the
 | |
| 	end of 1996.  It converts the normal FAT filesystem and
 | |
| 	allows you to use smaller cluster sizes for larger hard
 | |
| 	drives.  FAT32 also modifies the traditional FAT boot sector
 | |
| 	and allocation table, making it incompatible with some boot
 | |
| 	managers.</para>
 | |
|     </note>
 | |
|   </sect1>
 | |
| 
 | |
|   <sect1 id="ch3">
 | |
|     <title>A Typical Installation</title>
 | |
| 
 | |
|     <para>Let's say I have two large EIDE hard drives, and I want to
 | |
|       install FreeBSD, Linux, and &windows; 95 on them.</para>
 | |
| 
 | |
|     <para>Here is how I might do it using these hard disks:</para>
 | |
| 
 | |
|     <itemizedlist>
 | |
|       <listitem>
 | |
| 	<para><filename>/dev/wd0</filename> (first physical hard disk)</para>
 | |
|       </listitem>
 | |
| 
 | |
|       <listitem>
 | |
| 	<para><filename>/dev/wd1</filename> (second hard disk)</para>
 | |
|       </listitem>
 | |
|     </itemizedlist>
 | |
| 
 | |
|     <para>Both disks have 1416 cylinders.</para>
 | |
| 
 | |
|     <procedure>
 | |
|       <step>
 | |
| 	<para>I boot from a &ms-dos; or &windows; 95 boot disk that
 | |
| 	  contains the <filename>FDISK.EXE</filename> utility and make a small
 | |
| 	  50 MB primary partition (35-40 for &windows; 95, plus a
 | |
| 	  little breathing room) on the first disk.  Also create a
 | |
| 	  larger partition on the second hard disk for my &windows;
 | |
| 	  applications and data.</para>
 | |
| 	</step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>I reboot and install &windows; 95 (easier said than done)
 | |
| 	  on the <filename>C:</filename> partition.</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>The next thing I do is install Linux.  I am not sure
 | |
| 	  about all the distributions of Linux, but <ulink url="http://www.slackware.com">Slackware</ulink> includes
 | |
| 	  LILO (see <xref linkend="ch2">).  When I am partitioning out
 | |
| 	  my hard disk with Linux <command>fdisk</command>, I would
 | |
| 	  put all of Linux on the first drive (maybe 300 MB for a
 | |
| 	  nice root partition and some swap space).</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>After I install Linux, and are prompted about installing
 | |
| 	  LILO, make <emphasis>sure</emphasis> that I install it on the boot sector of my
 | |
| 	  root Linux partition, not in the MBR (master boot
 | |
| 	  record).</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>The remaining hard disk space can go to FreeBSD.  I also
 | |
| 	  make sure that my FreeBSD root slice does not go beyond the
 | |
| 	  1024th cylinder.  (The 1024th cylinder is 528 MB into the
 | |
| 	  disk with our hypothetical 720 MB disks).  I will use the
 | |
| 	  rest of the hard drive (about 270 MB) for the
 | |
| 	  <filename class="directory">/usr</filename> and <filename class="directory">/</filename> slices if I wish.  The
 | |
| 	  rest of the second hard disk (size depends on the amount of
 | |
| 	  my &windows; application/data partition that I created in step
 | |
| 	  1) can go to the <filename class="directory">/usr/src</filename> slice and swap
 | |
| 	  space.</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>When viewed with the &windows; 95 <command>fdisk</command>
 | |
| 	  utility, my hard drives should now look something like this:
 | |
| 
 | |
| 	  <screen>---------------------------------------------------------------------
 | |
| 
 | |
|                   Display Partition Information
 | |
| 
 | |
| Current fixed disk drive: 1
 | |
| 
 | |
| Partition  Status  Type  Volume_Label  Mbytes  System  Usage
 | |
| C: 1          A   PRI DOS                50    FAT**     7%
 | |
|    2          A   Non-DOS (Linux)       300             43%
 | |
| 
 | |
| Total disk space is  696 Mbytes (1 Mbyte = 1048576 bytes)
 | |
| 
 | |
| Press Esc to continue
 | |
| 
 | |
| ---------------------------------------------------------------------
 | |
| 
 | |
|                   Display Partition Information
 | |
| 
 | |
| Current fixed disk drive: 2
 | |
| 
 | |
| Partition  Status  Type  Volume_Label  Mbytes  System  Usage
 | |
| D: 1          A   PRI DOS                420   FAT**    60%
 | |
| 
 | |
| Total disk space is  696 Mbytes (1 Mbyte = 1048576 bytes)
 | |
| 
 | |
| Press Esc to continue
 | |
| 
 | |
| ---------------------------------------------------------------------</screen>
 | |
| 	  ** May say FAT16 or FAT32 if you are using the OEM SR2
 | |
| 	  update.  See <xref linkend="ch2">.</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>Install FreeBSD.  I make sure to boot with my first hard
 | |
| 	  disk set at <quote>NORMAL</quote> in the BIOS.  If it is not,
 | |
| 	  I will have the enter my true disk geometry at boot time (to
 | |
| 	  get this, boot &windows; 95 and consult Microsoft Diagnostics
 | |
| 	  (<filename>MSD.EXE</filename>), or check your BIOS) with the
 | |
| 	  parameter <literal>hd0=1416,16,63</literal> where
 | |
| 	  <replaceable>1416</replaceable> is the number of cylinders on my hard
 | |
| 	  disk, <replaceable>16</replaceable> is the number of heads per track,
 | |
| 	  and <replaceable>63</replaceable> is the number of sectors per track on
 | |
| 	  the drive.</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>When partitioning out the hard disk, I make sure to
 | |
| 	  install Boot Easy on the first disk.  I do not worry about
 | |
| 	  the second disk, nothing is booting off of it.</para>
 | |
|       </step>
 | |
| 
 | |
|       <step>
 | |
| 	<para>When I reboot, Boot Easy should recognize my three
 | |
| 	  bootable partitions as DOS (&windows; 95), Linux, and BSD
 | |
| 	  (FreeBSD).</para>
 | |
|       </step>
 | |
|     </procedure>
 | |
|   </sect1>
 | |
| 
 | |
|   <sect1 id="ch4">
 | |
|     <title>Special Considerations</title>
 | |
| 
 | |
|     <para>Most operating systems are very picky about where and how
 | |
|       they are placed on the hard disk.  &windows; 95 and DOS need to be
 | |
|       on the first primary partition on the first hard disk.  &os2; is
 | |
|       the exception.  It can be installed on the first or second disk
 | |
|       in a primary or extended partition.  If you are not sure, keep
 | |
|       the beginning of the bootable partitions below the 1024th
 | |
|       cylinder.</para>
 | |
| 
 | |
|     <para>If you install &windows; 95 on an existing BSD system, it will
 | |
|       <quote>destroy</quote> the MBR, and you will have to reinstall your
 | |
|       previous boot manager.  Boot Easy can be reinstalled by using
 | |
|       the <filename>BOOTINST.EXE</filename> utility included in the <filename class="directory">\TOOLS</filename> directory on the
 | |
|       CDROM, and via <ulink
 | |
| 	url="ftp://ftp.FreeBSD.org/pub/FreeBSD/tools/">ftp</ulink>.
 | |
|       You can also re-start the installation process and go to the
 | |
|       partition editor.  From there, mark the FreeBSD partition as
 | |
|       bootable, select Boot Manager, and then type W to (W)rite out
 | |
|       the information to the MBR.  You can now reboot, and Boot Easy
 | |
|       should then recognize &windows; 95 as DOS.</para>
 | |
| 
 | |
|     <para>Please keep in mind that &os2; can read FAT and HPFS
 | |
|       partitions, but not FFS (FreeBSD) or EXT2 (Linux) partitions.
 | |
|       Likewise, &windows; 95 can only read and write to FAT and FAT32
 | |
|       (see <xref linkend="ch2">) partitions.  FreeBSD can read most
 | |
|       filesystems, but currently cannot read HPFS partitions.  Linux
 | |
|       can read HPFS partitions, but can not write to them.  Recent
 | |
|       versions of the Linux kernel (2.x) can read and write to &windows;
 | |
|       95 VFAT partitions (VFAT is what gives &windows; 95 long file
 | |
|       names - it is pretty much the same as FAT).  Linux can read and
 | |
|       write to most filesystems.  Got that?  I hope so.</para>
 | |
|   </sect1>
 | |
| 
 | |
|   <sect1 id="ch5">
 | |
|     <title>Examples</title>
 | |
| 
 | |
|     <para><emphasis>(section needs work, please send your example to
 | |
| 	<email>jayrich@sysc.com</email>)</emphasis>.</para>
 | |
| 
 | |
|     <para>FreeBSD + &windows; 95:  If you installed FreeBSD after &windows; 95,
 | |
|       you should see <literal>DOS</literal> on the Boot Easy menu.  This is
 | |
|       &windows; 95.  If you installed &windows; 95 after FreeBSD, read
 | |
|       <xref linkend="ch4"> above.  As long as your hard disk does not
 | |
|       have 1024 cylinders you should not have a problem booting.  If
 | |
|       one of your partitions goes beyond the 1024th cylinder however,
 | |
|       and you get messages like <errorname>invalid system disk</errorname>
 | |
|       under DOS (&windows; 95) and FreeBSD will not boot, try looking
 | |
|       for a setting in your BIOS called <quote>> 1024 cylinder
 | |
| 	support</quote> or <quote>NORMAL/LBA</quote> mode.  DOS may need LBA
 | |
|       (Logical Block Addressing) in order to boot correctly.  If the
 | |
|       idea of switching BIOS settings every time you boot up does not
 | |
|       appeal to you, you can boot FreeBSD through DOS via the
 | |
|       <filename>FBSDBOOT.EXE</filename> utility on the CD (It should find your
 | |
|       FreeBSD partition and boot it.)</para>
 | |
| 
 | |
|     <para>FreeBSD + &os2; + &windows; 95:  Nothing new here.  The &os2; boot manager
 | |
|       can boot all of these operating systems, so that should not be a
 | |
|       problem.</para>
 | |
| 
 | |
|     <para>FreeBSD + Linux: You can also use Boot Easy to boot both
 | |
|       operating systems.</para>
 | |
| 
 | |
|     <para>FreeBSD + Linux + &windows; 95:  (see <xref linkend="ch3">)</para>
 | |
|   </sect1>
 | |
| 
 | |
|   <sect1 id="sources">
 | |
|     <title>Other Sources of Help</title>
 | |
| 
 | |
|     <para>There are many <ulink
 | |
| 	url="http://www.linuxresources.com/LDP/HOWTO/HOWTO-INDEX.html">Linux
 | |
| 	HOW-TOs</ulink> that deal with multiple operating systems on
 | |
|       the same hard disk.</para>
 | |
| 
 | |
|     <para>The <ulink
 | |
| 	url="http://www.linuxresources.com/LDP/HOWTO/mini/Linux+DOS+Win95+OS2.html">Linux+DOS+Win95+OS2
 | |
| 	mini-HOWTO</ulink> offers help on configuring the &os2; boot
 | |
|       manager, and the <ulink
 | |
| 	url="http://www.linuxresources.com/LDP/HOWTO/mini/Linux+FreeBSD.html">Linux+FreeBSD
 | |
| 	mini-HOWTO</ulink> might be interesting as well.  The <ulink
 | |
| 	url="http://www.in.net/~jkatz/win95/Linux-HOWTO.html">Linux-HOWTO</ulink>
 | |
|       is also helpful.</para>
 | |
| 
 | |
|     <para>The <ulink
 | |
| 	url="http://www.tburke.net/info/ntldr/ntldr_hacking_guide.htm">&windowsnt;
 | |
| 	Loader Hacking Guide</ulink> provides good information on
 | |
|       multibooting &windowsnt;, &windows; 95, and DOS with other operating
 | |
|       systems.</para>
 | |
| 
 | |
|     <para>And Hale Landis's <quote>How It Works</quote> document pack contains some
 | |
|       good info on all sorts of disk geometry and booting related
 | |
|       topics.  You can find it at
 | |
|       <ulink url="ftp://fission.dt.wdc.com/pub/otherdocs/pc_systems/how_it_works/allhiw.zip"></ulink>.</para>
 | |
| 
 | |
|     <para>Finally, do not overlook FreeBSD's kernel documentation on
 | |
|       the booting procedure, available in the kernel source
 | |
|       distribution (it unpacks to <ulink
 | |
| 	url="file://localhost/usr/src/sys/i386/boot/biosboot/README.386BSD">/usr/src/sys/i386/boot/biosboot/README.386BSD</ulink>.</para>
 | |
|   </sect1>
 | |
| 
 | |
|   <sect1>
 | |
|     <title>Technical Details</title>
 | |
| 
 | |
|     <para><emphasis>(Contributed by Randall Hopper,
 | |
| 	<email>rhh@ct.picker.com</email>)</emphasis></para>
 | |
| 
 | |
|     <para>This section attempts to give you enough basic information
 | |
|       about your hard disks and the disk booting process so that you
 | |
|       can troubleshoot most problems you might encounter when getting
 | |
|       set up to boot several operating systems.  It starts in pretty
 | |
|       basic terms, so you may want to skim down in this section until
 | |
|       it begins to look unfamiliar and then start reading.</para>
 | |
| 
 | |
|     <sect2>
 | |
|       <title>Disk Primer</title>
 | |
| 
 | |
|       <para>Three fundamental terms are used to describe the location
 | |
| 	of data on your hard disk: Cylinders, Heads, and Sectors.
 | |
| 	It is not particularly important to know what these terms
 | |
| 	relate to except to know that, together, they identify where
 | |
| 	data is physically on your disk.</para>
 | |
| 
 | |
|       <para>Your disk has a particular number of cylinders, number of
 | |
| 	heads, and number of sectors per cylinder-head (a
 | |
| 	cylinder-head also known now as a track).  Collectively this
 | |
| 	information defines the <quote>physical disk geometry</quote> for your hard
 | |
| 	disk.  There are typically 512 bytes per sector, and 63
 | |
| 	sectors per track, with the number of cylinders and heads
 | |
| 	varying widely from disk to disk.  Thus you can figure the
 | |
| 	number of bytes of data that will fit on your own disk by
 | |
| 	calculating:</para>
 | |
| 
 | |
| 	<informalexample>
 | |
| 	  <para>(# of cylinders) × (# heads) × (63
 | |
| 	    sectors/track) × (512 bytes/sect)</para>
 | |
| 	</informalexample>
 | |
| 
 | |
|       <para>For example, on my 1.6 Gig Western Digital AC31600 EIDE hard
 | |
| 	disk, that is:</para>
 | |
| 
 | |
| 	<informalexample>
 | |
| 	  <para>(3148 cyl) × (16 heads) × (63
 | |
| 	    sectors/track) × (512 bytes/sect)</para>
 | |
| 	</informalexample>
 | |
| 
 | |
|       <para>which is 1,624,670,208 bytes, or around 1.6 Gig.</para>
 | |
| 
 | |
|       <para>You can find out the physical disk geometry (number of
 | |
| 	cylinders, heads, and sectors/track counts) for your hard
 | |
| 	disks using ATAID or other programs off the net.  Your hard
 | |
| 	disk probably came with this information as well.  Be careful
 | |
| 	though: if you are using BIOS LBA (see <xref
 | |
| 	  linkend="limits">), you can not use just any program to get
 | |
| 	the physical geometry.  This is because many programs (e.g.
 | |
| 	<filename>MSD.EXE</filename> or FreeBSD fdisk) do not identify the
 | |
| 	physical disk geometry; they instead report the
 | |
| 	<firstterm>translated geometry</firstterm> (virtual numbers from using
 | |
| 	LBA).  Stay tuned for what that means.</para>
 | |
| 
 | |
|       <para>One other useful thing about these terms.  Given 3
 | |
| 	numbers—a cylinder number, a head number, and a
 | |
| 	sector-within-track number—you identify a specific
 | |
| 	absolute sector (a 512 byte block of data) on your disk.
 | |
| 	Cylinders and Heads are numbered up from 0, and Sectors are
 | |
| 	numbered up from 1.</para>
 | |
| 
 | |
|       <para>For those that are interested in more technical details,
 | |
| 	information on disk geometry, boot sectors, BIOSes, etc. can
 | |
| 	be found all over the net.  Query Lycos, Yahoo, etc. for
 | |
| 	<literal>boot sector</literal> or <literal>master boot record</literal>.
 | |
| 	Among the useful info you will find are Hale Landis's
 | |
| 	<citetitle>How It Works</citetitle> document pack.  See the <xref
 | |
| 	  linkend="sources"> section for a few pointers to this
 | |
| 	pack.</para>
 | |
| 
 | |
|       <para>Ok, enough terminology.  We are talking about booting
 | |
| 	here.</para>
 | |
|     </sect2>
 | |
| 
 | |
|     <sect2 id="booting">
 | |
|       <title>The Booting Process</title>
 | |
| 
 | |
|       <para>On the first sector of your disk (Cyl 0, Head 0, Sector 1)
 | |
| 	lives the Master Boot Record (MBR).  It contains a map of your
 | |
| 	disk.  It identifies up to 4 <firstterm>partitions</firstterm>, each of
 | |
| 	which is a contiguous chunk of that disk.  FreeBSD calls
 | |
| 	partitions <firstterm>slices</firstterm> to avoid confusion with its
 | |
| 	own partitions, but we will not do that here.  Each partition can
 | |
| 	contain its own operating system.</para>
 | |
| 
 | |
|       <para>Each partition entry in the MBR has a <firstterm>Partition
 | |
| 	  ID</firstterm>, a <firstterm>Start Cylinder/Head/Sector</firstterm>, and an
 | |
| 	<firstterm>End Cylinder/Head/Sector</firstterm>.  The Partition ID
 | |
| 	tells what type of partition it is (what OS) and the Start/End
 | |
| 	tells where it is.  <xref linkend="tbl-pid"> lists a
 | |
| 	smattering of some common Partition IDs.</para>
 | |
| 
 | |
|       <table id="tbl-pid">
 | |
| 	<title>Partition IDs</title>
 | |
| 
 | |
| 	<tgroup cols="2">
 | |
| 	  <thead>
 | |
| 	    <row>
 | |
| 	      <entry>ID (hex)</entry>
 | |
| 	      <entry>Description</entry>
 | |
| 	    </row>
 | |
| 	  </thead>
 | |
| 
 | |
| 	  <tbody>
 | |
| 	    <row>
 | |
| 	      <entry>01</entry>
 | |
| 	      <entry>Primary DOS12 (12-bit FAT)</entry>
 | |
| 	    </row>
 | |
| 
 | |
| 	    <row>
 | |
| 	      <entry>04</entry>
 | |
| 	      <entry>Primary DOS16 (16-bit FAT)</entry>
 | |
| 	    </row>
 | |
| 
 | |
| 	    <row>
 | |
| 	      <entry>05</entry>
 | |
| 	      <entry>Extended DOS</entry>
 | |
| 	    </row>
 | |
| 
 | |
| 	    <row>
 | |
| 	      <entry>06</entry>
 | |
| 	      <entry>Primary big DOS (> 32MB)</entry>
 | |
| 	    </row>
 | |
| 
 | |
| 	    <row>
 | |
| 	      <entry>0A</entry>
 | |
| 	      <entry>&os2;</entry>
 | |
| 	    </row>
 | |
| 
 | |
| 	    <row>
 | |
| 	      <entry>83</entry>
 | |
| 	      <entry>Linux (EXT2FS)</entry>
 | |
| 	    </row>
 | |
| 
 | |
| 	    <row>
 | |
| 	      <entry>A5</entry>
 | |
| 	      <entry>FreeBSD, NetBSD, 386BSD (UFS)</entry>
 | |
| 	    </row>
 | |
| 	  </tbody>
 | |
| 	</tgroup>
 | |
|       </table>
 | |
| 
 | |
|       <para>Note that not all partitions are bootable (e.g. Extended
 | |
| 	DOS).  Some are—some are not.  What makes a partition
 | |
| 	bootable is the configuration of the <firstterm>Partition Boot
 | |
| 	  Sector</firstterm> that exists at the beginning of each
 | |
| 	partition.</para>
 | |
| 
 | |
|       <para>When you configure your favorite boot manager, it looks up
 | |
| 	the entries in the MBR partition tables of all your hard disks
 | |
| 	and lets you name the entries in that list.  Then when you
 | |
| 	boot, the boot manager is invoked by special code in the
 | |
| 	Master Boot Sector of the first probed hard disk on your
 | |
| 	system.  It looks at the MBR partition table entry
 | |
| 	corresponding to the partition choice you made, uses the Start
 | |
| 	Cylinder/Head/Sector information for that partition, loads up
 | |
| 	the Partition Boot Sector for that partition, and gives it
 | |
| 	control.  That Boot Sector for the partition itself contains
 | |
| 	enough information to start loading the operating system on
 | |
| 	that partition.</para>
 | |
| 
 | |
|       <para>One thing we just brushed past that is important to know.
 | |
| 	All of your hard disks have MBRs.  However, the one that is
 | |
| 	important is the one on the disk that is first probed by the
 | |
| 	BIOS.  If you have only IDE hard disks, it is the first IDE disk
 | |
| 	(e.g. primary disk on first controller).  Similarly for SCSI
 | |
| 	only systems.  If you have both IDE and SCSI hard disks
 | |
| 	though, the IDE disk is typically probed first by the BIOS, so
 | |
| 	the first IDE disk is the first probed disk.  The boot manager
 | |
| 	you will install will be hooked into the MBR on this first
 | |
| 	probed hard disk that we have just described.</para>
 | |
|     </sect2>
 | |
| 
 | |
|     <sect2 id="limits">
 | |
|       <title>Booting Limitations and Warnings</title>
 | |
| 
 | |
|       <para>Now the interesting stuff that you need to watch out
 | |
| 	for.</para>
 | |
| 
 | |
|       <sect3>
 | |
| 	<title>The dreaded 1024 cylinder limit and how BIOS LBA helps</title>
 | |
| 
 | |
| 	<para>The first part of the booting process is all done
 | |
| 	  through the BIOS, (if that is a new term to you, the BIOS is
 | |
| 	  a software chip on your system motherboard which provides
 | |
| 	  startup code for your computer).  As such, this first part
 | |
| 	  of the process is subject to the limitations of the BIOS
 | |
| 	  interface.</para>
 | |
| 
 | |
| 	<para>The BIOS interface used to read the hard disk during
 | |
| 	  this period (INT 13H, Subfunction 2) allocates 10 bits to
 | |
| 	  the Cylinder Number, 8 bits to the Head Number, and 6 bits
 | |
| 	  to the Sector Number.  This restricts users of this
 | |
| 	  interface (i.e. boot managers hooked into your disk's MBR as
 | |
| 	  well as OS loaders hooked into the Boot Sectors) to the
 | |
| 	  following limits:</para>
 | |
| 
 | |
|       <itemizedlist>
 | |
| 	<listitem>
 | |
| 	  <para>1024 cylinders, max</para>
 | |
| 	</listitem>
 | |
| 
 | |
| 	<listitem>
 | |
| 	  <para>256 heads, max</para>
 | |
| 	</listitem>
 | |
| 
 | |
| 	<listitem>
 | |
| 	  <para>64 sectors/track, max (actually 63, <literal>0</literal>
 | |
| 	    is not available)</para>
 | |
| 	</listitem>
 | |
|       </itemizedlist>
 | |
| 
 | |
| 	<para>Now big hard disks have lots of cylinders but not a lot
 | |
| 	  of heads, so invariably with big hard disks the number of
 | |
| 	  cylinders is greater than 1024.  Given this and the BIOS
 | |
| 	  interface as is, you can not boot off just anywhere on your
 | |
| 	  hard disk.  The boot code (the boot manager and the OS
 | |
| 	  loader hooked into all bootable partitions' Boot Sectors)
 | |
| 	  has to reside below cylinder 1024.  In fact, if your hard
 | |
| 	  disk is typical and has 16 heads, this equates to:</para>
 | |
| 
 | |
| 	<informalexample>
 | |
| 	  <para>1024 cyl/disk × 16 heads/disk × 63
 | |
| 	    sect/(cyl-head) × 512 bytes/sector</para>
 | |
| 	</informalexample>
 | |
| 
 | |
| 	<para>which is around the often-mentioned 528MB limit.</para>
 | |
| 
 | |
| 	<para>This is where BIOS LBA (Logical Block Addressing) comes
 | |
| 	  in.  BIOS LBA gives the user of the BIOS API calls access to
 | |
| 	  physical cylinders above 1024 though the BIOS interfaces by
 | |
| 	  redefining a cylinder.  That is, it remaps your cylinders
 | |
| 	  and heads, making it appear through the BIOS as though the
 | |
| 	  disk has fewer cylinders and more heads than it actually
 | |
| 	  does.  In other words, it takes advantage of the fact that
 | |
| 	  hard disks have relatively few heads and lots of cylinders
 | |
| 	  by shifting the balance between number of cylinders and
 | |
| 	  number of heads so that both numbers lie below the
 | |
| 	  above-mentioned limits (1024 cylinders, 256 heads).</para>
 | |
| 
 | |
| 	<para>With BIOS LBA, the hard disk size limitation is
 | |
| 	  virtually removed (well, pushed up to 8 Gigabytes anyway).
 | |
| 	  If you have an LBA BIOS, you can put FreeBSD or any OS
 | |
| 	  anywhere you want and not hit the 1024 cylinder
 | |
| 	  limit.</para>
 | |
| 
 | |
| 	<para>To use my 1.6 Gig Western Digital as an example again,
 | |
| 	  its physical geometry is:</para>
 | |
| 
 | |
| 	<informalexample>
 | |
| 	  <para>(3148 cyl, 16 heads, 63 sectors/track, 512
 | |
| 	    bytes/sector)</para>
 | |
| 	</informalexample>
 | |
| 
 | |
| 	<para>However, my BIOS LBA remaps this to:</para>
 | |
| 
 | |
| 	<informalexample>
 | |
| 	  <para>(787 cyl, 64 heads, 63 sectors/track, 512
 | |
| 	    bytes/sector)</para>
 | |
| 	</informalexample>
 | |
| 
 | |
| 	<para>giving the same effective size disk, but with cylinder
 | |
| 	  and head counts within the BIOS API's range (Incidentally, I
 | |
| 	  have both Linux and FreeBSD existing on one of my hard disks
 | |
| 	  above the 1024th physical cylinder, and both operating
 | |
| 	  systems boot fine, thanks to BIOS LBA).</para>
 | |
|       </sect3>
 | |
| 
 | |
|       <sect3>
 | |
| 	<title>Boot Managers and Disk Allocation</title>
 | |
| 
 | |
| 	<para>Another gotcha to watch out when installing boot
 | |
| 	  managers is allocating space for your boot manager.  It is
 | |
| 	  best to be aware of this issue up front to save yourself
 | |
| 	  from having to reinstall one or more of your OSs.</para>
 | |
| 
 | |
| 	<para>If you followed the discussion in <xref
 | |
| 	    linkend="booting"> about the Master Boot Sector (where the
 | |
| 	  MBR is), Partition Boot Sectors, and the booting process,
 | |
| 	  you may have been wondering just exactly where on your hard
 | |
| 	  disk that nifty boot manager is going to live.  Well, some
 | |
| 	  boot managers are small enough to fit entirely within the
 | |
| 	  Master Boot Sector (Cylinder 0, Head 0, Sector 0) along with
 | |
| 	  the partition table.  Others need a bit more room and
 | |
| 	  actually extend a few sectors past the Master Boot Sector in
 | |
| 	  the Cylinder 0 Head 0 track, since that is typically
 | |
| 	  free…typically.</para>
 | |
| 
 | |
| 	<para>That is the catch.  Some operating systems (FreeBSD
 | |
| 	  included) let you start their partitions right after the
 | |
| 	  Master Boot Sector at Cylinder 0, Head 0, Sector 2 if you
 | |
| 	  want.  In fact, if you give FreeBSD's sysinstall a disk with
 | |
| 	  an empty chunk up front or the whole disk empty, that is
 | |
| 	  where it will start the FreeBSD partition by default (at least
 | |
| 	  it did when I fell into this trap).  Then when you go to
 | |
| 	  install your boot manager, if it is one that occupies a few
 | |
| 	  extra sectors after the MBR, it will overwrite the front of
 | |
| 	  the first partition's data.  In the case of FreeBSD, this
 | |
| 	  overwrites the disk label, and renders your FreeBSD
 | |
| 	  partition unbootable.</para>
 | |
| 
 | |
| 	<para>The easy way to avoid this problem (and leave yourself
 | |
| 	  the flexibility to try different boot managers later) is
 | |
| 	  just to always leave the first full track on your disk
 | |
| 	  unallocated when you partition your disk.  That is, leave
 | |
| 	  the space from Cylinder 0, Head 0, Sector 2 through Cylinder
 | |
| 	  0, Head 0, Sector 63 unallocated, and start your first
 | |
| 	  partition at Cylinder 0, Head 1, Sector 1.  For what it is
 | |
| 	  worth, when you create a DOS partition at the front of your
 | |
| 	  disk, DOS leaves this space open by default (this is why
 | |
| 	  some boot managers assume it is free).  So creating a DOS
 | |
| 	  partition up at the front of your disk avoids this problem
 | |
| 	  altogether.  I like to do this myself, creating 1 Meg DOS
 | |
| 	  partition up front, because it also avoids my primary DOS
 | |
| 	  drive letters shifting later when I repartition.</para>
 | |
| 
 | |
| 	<para>For reference, the following boot managers use the
 | |
| 	  Master Boot Sector to store their code and data:</para>
 | |
| 
 | |
| 	<itemizedlist>
 | |
| 	  <listitem>
 | |
| 	    <para>OS-BS 1.35</para>
 | |
| 	  </listitem>
 | |
| 
 | |
| 	  <listitem>
 | |
| 	    <para>Boot Easy</para>
 | |
| 	  </listitem>
 | |
| 
 | |
| 	  <listitem>
 | |
| 	    <para>LILO</para>
 | |
| 	  </listitem>
 | |
| 	</itemizedlist>
 | |
| 
 | |
| 	<para>These boot managers use a few additional sectors after
 | |
| 	  the Master Boot Sector:</para>
 | |
| 
 | |
| 	<itemizedlist>
 | |
| 	  <listitem>
 | |
| 	    <para>OS-BS 2.0 Beta 8 (sectors 2-5)</para>
 | |
| 	  </listitem>
 | |
| 
 | |
| 	  <listitem>
 | |
| 	    <para>The &os2; boot manager</para>
 | |
| 	  </listitem>
 | |
| 	</itemizedlist>
 | |
|       </sect3>
 | |
| 
 | |
|       <sect3>
 | |
| 	<title>What if your machine will not boot?</title>
 | |
| 
 | |
| 	<para>At some point when installing boot managers, you might
 | |
| 	  leave the MBR in a state such that your machine will not boot.
 | |
| 	  This is unlikely, but possible when re-FDISKing underneath
 | |
| 	  an already-installed boot manager.</para>
 | |
| 
 | |
| 	<para>If you have a bootable DOS partition on your disk, you
 | |
| 	  can boot off a DOS floppy, and run:</para>
 | |
| 
 | |
| 	<informalexample>
 | |
| 	  <screen>A:\> <userinput>FDISK /MBR</userinput></screen>
 | |
| 	</informalexample>
 | |
| 
 | |
| 	<para>to put the original, simple DOS boot code back into the
 | |
| 	  system.  You can then boot DOS (and DOS only) off the hard
 | |
| 	  drive.  Alternatively, just re-run your boot manager
 | |
| 	  installation program off a bootable floppy.</para>
 | |
|       </sect3>
 | |
|     </sect2>
 | |
|   </sect1>
 | |
| </article>
 |