荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: afan (不死鸟人), 信区: Linux
标  题: win2000/linux双重启动的方法
发信站: 荔园晨风BBS站 (Sat Mar  9 16:22:52 2002), 转信

A dual-boot system is a computer that has two operating
systems installed and can boot any one of the operating
systems at any time. Dual-boot systems are most common among
 Linux users who want to use Windows-specific applications
or games. In this chapter I show you how to dual-boot Red
Hat Linux with Windows 2000, Windows NT, and Windows 98
operating systems, which are the most common dual-boot
scenarios. I also discuss the commercial tool called
VMware that lets you boot a second operating systems
within another!

Dual-Booting with Windows NT/2000
At the time of this book's writing, Windows 2000 is
Microsoft's latest released version of their professional
and server-class operating system. Windows 2000 is built
on Windows NT technology. Dual-booting Linux with Windows
2000 or Windows NT (I just call it "Windows") requires the
same process, which is discussed in the following sections
of this chapter. In this book I use NT/2000 to mean
Windows 2000 and Windows NT.

Note

Windows XP Professional, which should be out by the time
this book is released, is based on Windows 2000. Windows
XP Professional users should be fine with the Windows
NT/2000 instructions for the most part.

Prerequisites for dual-booting Linux and Windows NT/2000
You must have Windows NT/2000 installed on the first
partition of your first hard disk.

Note

In this section I assume that you are using a IDE hard
disk (/dev/hda) and have at least two partitions
(/dev/hda1 and /dev/hda2). If you're using a SCSI hard disk,
 the instructions provided here will still apply, just
replace all instances of hda with sda, which is the first
SCSI hard disk in your system.

After you've installed Windows NT/2000 on /dev/hda1, the
operating system is loaded by the Windows NT/2000 boot
loader program called NTLoader. This program is installed on
 the Master Boot Record (MBR) of the first bootable hard
disk on your system, which is /dev/hda.

There are two ways you can enable dual-booting on your
system:

* Use LILO as a boot loader; you can use Linux boot loader
program called LILO to boot either operating system.
During this process you'll see a Linux-based
LILO-generated boot options screen It is also much easier to
 implement than the other option.

Note

You can also use GRUB, a GNU boot loader tool, to
dual-boot Linux with Windows NT/2000. You can learn about
GRUB at www.gnu.org/directory/grub.html.

* You can also use a Windows NT/2000 boot loader called
NTLoader to load either operating system. This process
will display an NTLoader-generated boot options screen. This
 is appropriate for a Windows NT/2000-heavy environment,
where users are more familiar with Windows than they are
with Linux.

Dual-booting using LILO
To use LILO as a boot loader for booting to either Windows
NT/2000 or Linux on system boot, you must perform the
following tasks when installing Red Hat Linux on a system
with a preexisting Windows NT/2000 installation:

* If you are not using a bootable CD-ROM to install Red
Hat Linux, you must create the boot floppy during the
installation process.

Caution

You must select the custom installation class instead of
either the Workstation, Server, or Laptop classes that are
offered in the installation process. Choosing anything but
the custom installation will overwrite the MBR that NTLoader
 resides on and will make it impossible for you to boot
Windows NT/2000 without appropriate rescue or boot disks
of that operating system.

Note

If you make a mistake and install the Linux boot loader on
the MBR, you must reboot the system with Windows NT/2000
recovery disks and select Recover. Next, switch to
command-line mode, log on as Administrator, and run the
fixboot and fixmbr commands to reinstall Windows NT/2000
boot loader on the MBR.

* During the installation process you're asked if you wish
to install a boot loader on your system. A boot loader
such as LILO or GRUB is only needed for a dual-boot system.
 A single-boot Linux system does not require such programs.
 Because you wish to dual-boot Linux with Windows NT/2000,
you must choose to install a boot loader; in this case it
will be LILO.

* Choose the first sector of the root disk partition,
typically /dev/hda2, as the location for LILO to avoid
overwriting the Windows MBR.

* You will need to write a label name for the existing
Windows NT/2000 operating system. Any name is fine; I
usually use win2k or winnt as the label to identify the
operating system in the boot menu, as shown in Figure 3-1.


* You're then asked to select one of the operating systems
as the default. Choose Linux or Windows as necessary.

* Finally, install Red Hat Linux as usual.

After you've installed Red Hat Linux, use the newly
created Linux boot disk to boot Red Hat Linux. If you are
using a bootable CD-ROM, use the linux rescue command at
LILO prompt to boot Linux. Here I will assume that you are
using a bootable CD-ROM and booting Linux in rescue mode.
After you have booted Linux you need to fix the /etc/lilo.
conf file.

In rescue mode, the root file system is mounted on
/mnt/sysimage, which can be accessed from the shell prompt.
 You can also mount it as / by running chroot
/mnt/sysimage command. The /etc/lilo.conf file for a
dual-boot system using /dev/hda1 for Windows NT/2000 and
/dev/hda2 for Red Hat Linux is shown in Listing 3-1.

Listing 3-1
The /etc/lilo.conf file

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
message=/boot/message
linear
default=linux
image=/boot/vmlinuz-2.4.7-0.1.19
   label=linux
   read-only
   root=/dev/hda2
other=/dev/hda1
   optional
   label=win2k

The first line in the preceding tells LILO that the boot
device is /dev/hda (the very first IDE hard disk). The
next line sets the map file path, and the following line
sets the install file path. The prompt line tells LILO to
prompt the user to select an operating system; without
this line the default operating system specified by the
default=linux line can be automatically loaded. The
timeout=50 line sets the timeout value to be 5 seconds (it
shows 50 because it's measured in tenths of a second).
When a user does not manually select a different operating
system at the LILO prompt, the default operating system,
identified by the default=label line, is loaded
(default=linux in the listing).

The image= line defines the Linux kernel image to boot
when booting the operating system labeled linux as
instructed by the label=linux line. The operating system
boots from the root device, set by the root= line (such as
root=dev/hda2 in the preceding listing), in read-only mode.
 The root partition is read-only only during boot, and later
 it goes in read-write mode.

The other=/dev/hda1 line states where to find the
alternative operating system that is labeled win2k by
using label=win2k.

If you're setting up a dual-boot system where /dev/hda1
contains the Windows NT/2000 operating system and
/dev/hda2 contains the Linux operating system, make sure
your /etc/lilo.conf looks like the above. After you've
edited the lilo.conf file, make sure that you run /sbin/lilo
 to find out if LILO likes the configuration file.

If you get an error message stating a problem with the
"liner" line, change that line to lba32, which is used to
use logical block addressing to access disk, and then
rerun /sbin/lilo. When LILO is happy it will show a line
such as the following:

* Added linux
* Added win2k

Now you should reboot your system by running
/sbin/shutdown -r now and choosing one of the operating
systems from the boot menu. Make sure that you test-boot
into both operating systems to ensure that you are able to
successfully dual-boot your system to either Linux or
Windows.

Dual-booting by using NTLoader
There is no technical advantage to dual-booting by using the
 Windows NT/2000 boot loader - NTLoader - over LILO.
However, if you're using Linux as a secondary operating
system and want to keep it under a low profile, you might
want to use NTLoader instead of LILO. NTLoader is often used
 in Windows NT/2000 environments where users are already
familiar with NTLoader. Before you can dual-boot Linux and
Windows NT/2000 with NTLoader, you must ensure that the
following prerequisites are met:

* Windows NT/2000 must be installed on the first partition
of the first disk. Here I assume that you are using an IDE
disk and that Windows NT/2000 therefore is installed on
/dev/hda1 (for SCSI, the equivalent is /dev/sda1).

* Windows NT/2000 has installed the NTLoader in MBR, which
is what the Windows NT/2000 installer does by default.

* You have Windows NT/2000 recovery disk set.

* Linux is installed on any partition of any disk other than
 the first partition of the first disk. Here I will assume
that you have installed Linux on /dev/hda2. Note that you
could also have Linux installed on a different hard disk
partition, such as /dev/hdb1, the first partition of the
second IDE hard disk, or wherever.

Caution

As mentioned before, it's extremely important that you do
not install Linux on MBR. If you make a mistake and
install Linux boot loader on MBR, then you must reboot the
system with Window NT/2000 recovery disks or Windows NT/2000
 bootable CD-ROM and select recover option and switch to
recover console mode. Then, log on as Administrator and
run the fixboot and fixmbr commands to reinstall Windows
NT/2000 boot loader on MBR.

* You must have a Linux boot disk or a bootable Linux CD-ROM
 that provides the rescue option, which is available in
the official Red Hat Linux CD-ROM #1.

* You need an MS-DOS formatted blank floppy disk. If you
do not have a floppy drive, you will have to write access to
 a remote FTP site where you can temporarily keep a file. Or
 you'll need a valid e-mail account, to which you can send
an attachment.

* Make sure that you've installed Linux with the MS-DOS or
Windows connectivity option so that the mcopy program is
installed. Note that you can ignore this requirement if
you don't plan on using a floppy disk.

After you've ensured that the above prerequisites are met,
you can follow these steps to dual-boot Linux and Windows
NT/2000 using NTLoader:

      1. Because NTLoader is not yet configured to boot
Linux, you have to use the Linux boot disk to boot the
system to Linux. If you do not have a boot disk, you can use
 the bootable Linux CD in rescue mode by entering linux
rescue at the LILO prompt.

      2. Copy the boot sector of your Linux installation
using dd if=/dev/linux_boot_device bs=512 count=1
of=linux_bs.bin command. For example, if you've installed
Linux on /dev/hda2 then this command will be as follows:

dd if=/dev/hda2 bs=512 count=1 of=linux_bs.bin

The dd command allows you to copy the first 512 bytes from
the /dev/hda2 device to a file called linux_bs.bin.

      3. The linux_bs.bin file needs to be in the Windows
NT/2000 partition of your hard disk. If you have a floppy
drive and a blank, MS-DOS-formatted floppy you can mount
it under Linux using the mount -t msdos /dev/fd0 /mnt/floppy
 command. After you have the floppy disk mounted, change
to the directory where you saved the file and copy the
linux_bs.bin file to the floppy using the mcopy linux_bs.bin
 a: command. Skip the next step if you have this file stored
 on a floppy.

      4. If you do not have a floppy drive or a floppy disk,
 you can FTP or e-mail the linux_bs.bin file to a remote FTP
 site or your e-mail account. This assumes that you have
networking or Internet connectivity set up under Linux.

XREF

For more information on how to set up networking or Internet
 connectivity, see Chapter 6.

After you've stored the file in a remote FTP site or sent it
 to yourself via e-mail, you have to retrieve it from
Windows NT/2000 side. This also assumes that you have
Windows NT/2000 configured for networking and/or Internet
connectivity. For information on how to set up networking
and/or Internet connectivity on Windows, see an
appropriate user's manual.

      5. Restart your machine using the shutdown -r now
command in Linux and log on to Windows NT/2000 as
Administrator user.

      6. Copy the linux_bs.bin file in the C:\ directory
of your Windows NT/2000 installation either from the floppy,
 by getting it from the remote FTP site, or by downloading
it from an e-mail attachment.

      7. Run Windows Explorer (not Internet Explorer) by
clicking Start@@>Run and entering explorer in the open
location. Once Explorer has started, choose Tools@@>Folder
Options and then click on the View tab of the Folder Options
 dialog window. Enable the Show hidden files and folders
option under the Hidden Files and Folders section and then
click first Apply and then the OK button to activate your
changes.

      8. In the Explorer window, enter C:\ as the address
location or use the folder navigation tree to locate your
Windows NT/2000 hard disk. You should see a file called
boot.ini in the C:\ directory. Double click this file to
open it in your default text editor (Notepad), and the
contents should be similar to the following:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft
Windows
2000 Professional" /fastdetect

The last two lines shown above are actually a single line
that displays the Microsoft Windows 2000 Professional boot
option.

      9. Add a new line c:\linux_bs.bin="Red Hat Linux" in
c:\boot.ini using the text editor and then save the file.

    10. Using Windows Explorer, select the linux_bs.bin file
 and click the right mouse button and choose Properties from
 the context menu to view the file's properties. You can
also click the file and then choose File@@>Properties in
Explorer.

    11. Turn the read-only flag on for the linux_bs.bin file
 in the file properties window by checking the appropriate
check box under the attributes section of the file's
Properties window.

    12. Reboot Windows NT/2000 and you should see "Red Hat
Linux" as a boot option in the boot menu displayed by
NTLoader. Select that listing to boot Linux, or select the
Windows option to boot Windows.

Dual-booting Linux with Windows 98
Booting Red Hat Linux alongside Windows 98 is less
complicated than booting Linux and Windows NT/2000 systems.
 Unlike Windows NT/2000, Windows 98 does not come with a
boot loader such as NTLoader and therefore LILO or GRUB is
necessary. Keep the following things in mind when setting up
 a dual-boot Windows 98 and Linux using LILO:

* Install Windows 98 on the first partition of your first
hard disk before you install Red Hat Linux. Make sure that
you have a second partition or a second disk to install
Linux on.

* You have two choices of installing Linux: the
Workstation class or the Custom class. If you install
Linux using Workstation installation (see Chapter 1 for
details), you have less that you need to do during Linux
installation. If you do install by using a Custom
installation, you must make sure that you install LILO on
the MBR. The Workstation installation automatically installs
 LILO on MBR for you.

* After Linux is installed and LILO is installed on the MBR,
 you can boot either operating system from LILO when you
next reboot.

Booting Windows within Linux by Using VMware
The VMware products are amazing virtual machine solutions
that allow you to boot another operating system while you
are running one. For example, you can be on Linux and run
VMware for Linux to run Windows NT/2000 on your Linux
desktop. Similarly you can run VMware on Windows NT/2000 and
 load Linux on your Windows desktop.

VMware virtual machines are commercial products that you can
 freely evaluate from www.vmware.com. A license file is
necessary to evaluate the product, so when you download
the evaluation make sure you also fill out the evaluation
form to get a temporary license file sent to you by e-mail.


When you use VMware, you're practically setting up a machine
 within a machine. In other words, you are creating a
virtual computer within a running computer. VMware
requires that you click a button to switch on the power of
the virtual computer, and then it even goes through the
standard BIOS Power On Self Test (POST) process, hardware
detection, and so on.

VMware is an interesting and potentially useful scenario
where you need to have access to Linux applications from
Windows, or if you require access to Windows applications
while working within Linux. VMware uses terminology such
as host operating system, which is the term meaning the
operating system that's running the VMware product, and
guest operating system, which is the term that refers to the
 operating system that's being run under VMware itself.
VMware even allows you to run the guest operating system
in full screen mode, as well as the ability to switch back
to a windowed mode by pressing Ctrl+Alt+Esc.

--
※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.1.181]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店