summaryrefslogblamecommitdiffstats
path: root/slackbook/html/booting-dual.html
blob: b74eb874b61375b5bfb95008133920e2065c5121 (plain) (tree)




















































































































































































































































































































































                                                                                         
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Dual Booting</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Booting" href="booting.html" />
<link rel="PREVIOUS" title="LOADLIN" href="booting-loadlin.html" />
<link rel="NEXT" title="The Shell" href="shell.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>

<tr>
<td width="10%" align="left" valign="bottom"><a href="booting-loadlin.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 7 Booting</td>
<td width="10%" align="right" valign="bottom"><a href="shell.html"
accesskey="N">Next</a></td>
</tr>
</table>

<hr align="LEFT" width="100%" />
</div>

<div class="SECT1">
<h1 class="SECT1"><a id="BOOTING-DUAL" name="BOOTING-DUAL">7.3 Dual Booting</a></h1>

<p>Many users set up their computers to boot Slackware Linux and another operating
system. We've described several typical dual boot scenarios below, in case you are having
difficulty setting up your system.</p>

<div class="SECT2">
<h2 class="SECT2"><a id="BOOTING-DUAL-WINDOWS" name="BOOTING-DUAL-WINDOWS">7.3.1
Windows</a></h2>

<p>Setting up a computer with both MS Windows and Linux is probably the most common dual
boot scenario. There are numerous ways you can setup the booting, but this section will
cover two.</p>

<p>Often times when setting up a dual boot system, a person will devise a perfect plan
for where everything should go but mess up the installation order. It is very important
to understand that operating systems need to be installed in a certain order for a dual
boot setup to work. Linux always offers control over what, if anything, gets written to
the Master Boot Record. Therefore, it's always advisable to install Linux last. Windows
should be installed first, since it will always write its booter to the Master Boot
Record, overwriting any entry Linux may have put there.</p>

<div class="SECT3">
<h3 class="SECT3"><a id="AEN2577" name="AEN2577">7.3.1.1 Using LILO</a></h3>

<p>Most people will want to use LILO to chose between Linux and Windows. As stated above,
you should install Windows first, then Linux.</p>

<p>Let's say you have a 40GB IDE hard disk as the only drive in your system. Let's also
say that you want to give half of that space to Windows and half of that space to Linux.
This will present a problem when trying to boot Linux.</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
   20GB   Windows boot (C:)
   1GB   Linux root (/)
   19GB  Linux /usr (/usr)
</pre>
</td>
</tr>
</table>

<p>You would also want to set aside an adequate amount of space for a Linux swap
partition. The unwritten rule is to use twice the amount of RAM you have in disk space. A
64MB system would have 128MB of swap, and so on. Adequate swap space is the discussion of
many flames on IRC and Usenet. There's no truly &#8220;right&#8221; way to do it, but
sticking with the rule above should be sufficient.</p>

<p>With your partitions laid out, you should proceed to install Windows. After that is
set up and working, you should install Linux. The LILO installation needs special
attention. You will want to select the expert mode for installing LILO.</p>

<p>Begin a new LILO configuration. You will want to install it to Master Boot Record so
that it can be used to choose between the two operating systems. From the menu, add your
Linux partition and add your Windows (or DOS) partition. Once that's complete, you can
install LILO.</p>

<p>Reboot the computer. LILO should load and will display a menu letting you select
between the operating systems you have installed. Select the name of the OS you wish to
load (these names were selected when you setup LILO).</p>

<p>LILO is quite a configurable boot loader. It's not just limited to booting Linux or
DOS. It can boot just about anything. The man pages for <tt class="COMMAND">lilo</tt>(8)
and <tt class="FILENAME">lilo.conf</tt>(5) provide more detailed information.</p>

<p>What if LILO doesn't work? There are instances where LILO just won't work on a
particular machine. Fortunately, there is another way to dual boot Linux and Windows.</p>
</div>

<div class="SECT3">
<h3 class="SECT3"><a id="AEN2591" name="AEN2591">7.3.1.2 Using LOADLIN</a></h3>

<p>This method can be used if LILO doesn't work on your system, or if you just don't want
to set up LILO. This method is also ideal for the user that reinstalls Windows often.
Each time you reinstall Windows, it will overwrite the Master Boot Record, thus
destroying any LILO installation. With LOADLIN, you are not subject to that problem. The
biggest disadvantage is that you can only use LOADLIN to boot Linux.</p>

<p>With LOADLIN, you can install the operating systems in any order desired. Be careful
about installing things to the Master Boot Record, you do not want to do that. LOADLIN
relies on the Windows partition being bootable. So during the Slackware installation,
make sure you skip the LILO setup.</p>

<p>After installing the operating systems, copy the <tt class="FILENAME">loadlin<var
class="REPLACEABLE">X</var>.zip</tt> (where <var class="REPLACEABLE">X</var> is a version
number, such as <var class="LITERAL">16a</var>) file from root's home directory to your
Windows partition. Also copy your kernel image to the Windows partition. You will need to
be in Linux for this to work. This example shows how to do this:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir /win</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">mount -t vfat /dev/hda1 /win</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir /win/linux</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /root</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cp loadlin* /win/linux</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cp /boot/vmlinuz /win/linux</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /win/linuz</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">unzip loadlin16a.zip</kbd>
</pre>
</td>
</tr>
</table>

<p>That will create a <tt class="FILENAME">C:\LINUX</tt> directory on your Windows
partition (assuming it's <tt class="FILENAME">/dev/hda1</tt>) and copy over the necessary
stuff for LOADLIN. After doing this, you will need to reboot into Windows to setup a boot
menu.</p>

<p>Once in Windows, get to a DOS prompt. First, we need to make sure the system is set to
not boot into the graphical interface.</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
C:\&#62; <kbd class="USERINPUT">cd \</kbd>
C:\&#62; <kbd class="USERINPUT">attrib -r -a -s -h MSDOS.SYS</kbd>
C:\&#62; <kbd class="USERINPUT">edit MSDOS.SYS</kbd>
</pre>
</td>
</tr>
</table>

<p>Add this line to the file:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
BootGUI=0
</pre>
</td>
</tr>
</table>

<p>Now save the file and exit the editor. Now edit <tt
class="FILENAME">C:\AUTOEXEC.BAT</tt> so we can add a boot menu. The following provides
an example of what a boot menu block in <tt class="FILENAME">AUTOEXEC.BAT</tt> would look
like:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
cls
echo System Boot Menu
echo.
echo 1 - Linux
echo 2 - Windows
echo.
choice /c:12 "Selection? -&#62; "
if errorlevel 2 goto WIN
if errorlevel 1 goto LINUX
:LINUX
cls
echo "Starting Linux..."
cd \linux
loadlin c:\linux\vmlinuz root=/dev/hda2 ro
goto END
:WIN
cls
echo "Starting Windows..."
win
goto END
:END
</pre>
</td>
</tr>
</table>

<p>The key line is the one that runs LOADLIN. We tell it the kernel to load, the Linux
root partition, and that we want it mounted read-only initially.</p>

<p>The tools for these two methods are provided with Slackware Linux. There are numerous
other booters on the market, but these should work for most dual boot setups.</p>
</div>

<div class="SECT3">
<h3 class="SECT3"><a id="AEN2633" name="AEN2633">7.3.1.3 Deprecated Windows NT
Hack</a></h3>

<p>This is the least common dual booting situation. In the days of old, LILO was unable
to boot Windows NT, requiring Linux users to hack NTLDR, which presented several more
problems than dual booting between Windows 9x and Linux. Understand that the following
instructions are deprecated. LILO has been able to boot Windows NT/2000/XP/2003 for many
years now. If you are using a legacy machine though, you may need to use just such a
hack.</p>

<ol type="1">
<li>
<p>Install Windows NT</p>
</li>

<li>
<p>Install Linux, making sure LILO is installed to the superblock of the Linux
partition</p>
</li>

<li>
<p>Get the first 512 bytes of the Linux root partition and store it on the Windows NT
partition</p>
</li>

<li>
<p>Edit <tt class="FILENAME">C:\BOOT.INI</tt> under Windows NT to add a Linux option</p>
</li>
</ol>

<p>Installing Windows NT should be fairly straightforward, as should installing Linux.
From there, it gets a little more tricky. Grabbing the first 512 bytes of the Linux
partition is easier than it sounds. You will need to be in Linux to accomplish this.
Assuming your Linux partition is <tt class="FILENAME">/dev/hda2</tt>, issue this
command:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">dd if=/dev/hda2 of=/tmp/bootsect.lnx bs=1 count=512</kbd>
</pre>
</td>
</tr>
</table>

<p>That's it. Now you need to copy bootsect.lnx to the Windows NT partition. Here's where
we run into another problem. Linux does not have stable write support for the NTFS
filesystem. If you installed Windows NT and formatted your drive as NTFS, you will need
to copy this file to a FAT floppy and then read from it under Windows NT. If you
formatted the Windows NT drive as FAT, you can simply mount it under Linux and copy the
file over. Either way, you will want to get <tt class="FILENAME">/tmp/bootsect.lnx</tt>
from the Linux drive to <tt class="FILENAME">C:\BOOTSECT.LNX</tt> on the Windows NT
drive.</p>

<p>The last step is adding a menu option to the Windows NT boot menu. Under Windows NT
open a command prompt.</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
C:\WINNT&#62; <kbd class="USERINPUT">cd \</kbd>
C:\&#62; <kbd class="USERINPUT">attrib -r -a -s -h boot.ini</kbd>
C:\&#62; <kbd class="USERINPUT">edit boot.ini</kbd>
</pre>
</td>
</tr>
</table>

<p>Add this line to the end of the file:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
C:\bootsect.lnx="Slackware Linux"
</pre>
</td>
</tr>
</table>

<p>Save the changes and exit the editor. When you reboot Windows NT, you will have a
Linux option on the menu. Choosing it will boot into Linux.</p>
</div>
</div>

<div class="SECT2">
<h2 class="SECT2"><a id="BOOTING-DUAL-LINUX" name="BOOTING-DUAL-LINUX">7.3.2
Linux</a></h2>

<p>Yes, people really do this. This is definitely the easiest dual boot scenario. You can
simply use LILO and add more entries to the <tt class="FILENAME">/etc/lilo.conf</tt>
file. That's all there is to it.</p>
</div>
</div>

<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="booting-loadlin.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="shell.html"
accesskey="N">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">LOADLIN</td>
<td width="34%" align="center" valign="top"><a href="booting.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">The Shell</td>
</tr>
</table>
</div>
</body>
</html>