summaryrefslogtreecommitdiff
path: root/misc/slackbook/html/booting-dual.html
blob: b74eb874b61375b5bfb95008133920e2065c5121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<!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>