PDA

View Full Version : Dual Boot Linux and Windows


llbbl
09-01-2004, 06:51 AM
1
c h a p t e r
1
Having Linux and
Windows on the Same PC
1.1 Partitions
There is no need to get rid of Windows to run Linux. In fact, there are many ways to run
both of them on the same PC. Each operating system has its own strengths and weaknesses,
so often having both on the same PC can be an advantage.
Before the actual installation, we need to go over some basics of Linux and Windows
such as partitions and filesystems.
A partition is a way of sectioning off space on a hard drive. Most PCs have their hard
drive partitioned into one large drive. It doesn’t have to be this way. Drives can be divided
into several partitions. This is often done to separate the programs from the data and also
for storing multiple operating systems on the same drive.
The first section of a hard drive contains information on the partitions, including where the
start and end of each partition is located. It also contains the location of the boot loader, which
starts loading the operating system. Each operating system has its own boot loader. Windows 3x,
95, and 98 use
IO.SYS
and
DOS.SYS
, Windows NT uses
NTLOADER
, and Linux uses
LILO
. There
are also commercial and shareware boot loaders, such as Norton System Commander, that are
designed to make it easier to boot with multiple configurations and multiple operating systems.
1.2 Filesystems
There are also several different filesystems used by Linux and Windows. A filesystem is
simply a way of organizing files on a partition. Windows uses FAT, FAT16, FAT32 (VFAT),
and NTFS (NT Filesystem). The native filesystem for Linux is ext2, although it supports
many other filesystems.
FAT is the original filesystem used by DOS. It is an eight-bit filesystem and will support
partitions of up to 32 MB. This was no problem in the early 1980s, when most PCs didn’t
even have hard drives.
FAT supports the following file attributes:
• Read-only—When set, the file can’t be deleted or changed.
• Archive—Determines whether a file has been changed. This is used by many backup
programs.
McCune01.fm Page 1 Friday, November 10, 2000 4:31 PM
2
Chapter 1 • Having Linux and Windows on the Same PC
• Hidden—The file doesn’t show up in the directory contents.
• System—Used for system files. System files are treated differently by the
operating system.
Later, as hard drives came into use, the 32 MB limitation of FAT became a burden and
an improved FAT16 replaced it. FAT16 increased the available size of the filesystem to 2
GB. Other than the filesystem size, FAT16 is essentially the same as the original FAT filesystem.
FAT16 is supported by DOS 4.0 and greater, all versions of Windows, and all current
versions of Linux.
With Windows 95 release 2, Microsoft introduced FAT32. This increased the size of the
filesystem to 2 terabytes, which is larger than any hard drives currently available for PCs.
It is also faster and more robust than FAT16.
NTFS is the native filesystem for Windows NT and 2000. Like FAT32, it also supports
2-terabyte filesystem sizes, but the boot partition is currently limited to 7.8 GB. For some
files such as database files, NTFS can support up to 16 exabytes. NTFS offers better reliability
and security than any FAT-based filesystem.
The reliability factors are beyond the scope of this book, but NTFS security considerations
need to be covered. First of all, everything in the filesystem has an owner. By default,
the user who creates an object (anything in the filesystem is an object) is the owner. The
owner has full rights to the object unless the rights are taken away.
There are also groups, which contain users. Three special group accounts are: administrator,
everyone, and guest.
• The administrator account has all rights to the filesystem. This account can change,
create, and delete all objects as well as change the rights of other accounts.
• Everyone is a group that includes all the user accounts on the system. This account is
used to change the rights for every user on the system.
• The guest account is a default account with minimal rights. It is often used for
accounts such as FTP access accounts, which only need access to a few specific files.
Files in NTFS have the same attributes as files in the FAT filesystem: read-only, hidden,
system, and archive. Each user and group can also be assigned rights to objects in the NTFS
filesystem. The rights that can be assigned are:
• List folder contents—Shows up in a directory listing.
• Read—Can read the contents of the object.
• Read and execute—Can read and execute the object.
• Write—Can change or delete the object.
• Modify—Can change the rights on the file.
• Full control—Has all of the above rights.
There are three settings for the rights: allow, deny, and inherited.
• Allow—Allows rights on the object.
• Deny—Takes away rights on the object.
• Inherited—If neither allow nor deny is specified, the object will inherit the rights of
the directory above it.
McCune01.fm Page 2 Friday, November 10, 2000 4:31 PM
1.3 Partition Naming
3
To view the rights of an object on NTFS, right-click on the object and choose Properties.
Then select the Security tab.
Ext or ext2 is the native filesystem for Linux partitions. Ext is the original filesystem for
Linux and ext2 is an improved version of it. Objects (such as files, directories, and devices)
in Linux support three properties: read, write, and execute.
• Read—If set, allows the object to show up in a directory listing and be read.
• Write—If set, allows the object to be written and deleted.
• Execute—If set, allows the object to be executed. This must also be set for directories.
An object has three sets of rights: owner, group, and everyone.
• Owner—The user who created the file, unless it is changed.
• Group—The group that owns the file is the group to which the owner belongs, unless
it is changed.
• Everyone—The right for all other users on the system.
To view the rights of an object, type
ls -l <object name>
. For example, to find the
rights of
index.txt
, type
ls -l index.txt
. The output of this command is as follows:
-rwxrwxr-- 1 root root 6230 Dec 21 00:12 index.txt
Let’s examine what this output means, starting with the first character:
• First character—This is a special attribute such as a directory, link, or device
driver. A link in Linux is similar to a shortcut in Windows.
• Next three characters (
rwx
)—The owner has read, write, and execute properties.
• Next three characters (
rwx
)—The group has read, write, and execute properties.
• Next three characters (
r--
)—Everyone has the read property.

1 root
—The owner’s ID number and name.

root
—The group name, which is also
root
.

6230
—The size of the file in bytes.

Dec 21 00:12
—The last date and time the file was modified.

index.txt
—The filename.
You can change the rights of a file with
chmod
. The owner and group can be changed
with
chown
.
There is one special account in Linux:
root
. The root account is created automatically
when Linux is installed and it has full rights to all objects in the filesystem.
1.3 Partition Naming
Linux and Windows have different ways of naming partitions. Windows simply assigns each
partition a letter starting with C. Letters A and B are reserved for floppy drives, since the
first PCs came with two floppy drives. The remaining drive letters are assigned as follows:
McCune01.fm Page 3 Friday, November 10, 2000 4:31 PM
4



http://www.informit.com/content/images/0130306703/samplechapter/0130306703.pdf

Buy it here:
http://www.informit.com/title/0130306703&aid=3F57BAFE-6844-4E3E-B416-1E4E8B625D34&p=SFCPBAS

llbbl
09-01-2004, 06:53 AM
Chapter 1 • Having Linux and Windows on the Same PC
1. The first primary partition on each drive.
2. The volumes inside the extended partitions on each drive.
3. The remaining primary partitions on each drive.
4. The CD-ROM drive.
For example, if you had two hard drives each with two primary partitions with two volumes
in extended partitions on each drive, they would be named as follows:
C: The first primary partition on the first drive.
D: The first primary partition on the second drive.
E: The first extended partition on the first drive.
F: The second extended partition on the first drive.
G: The first extended partition on the second drive.
H: The second extended partition on the second drive.
I: The second partition on the first drive.
J: The second partition on the second drive.
K: The CD-ROM drive.
These drive letters can’t be changed in Windows 3x and 9x, but they can easily be
changed in Windows NT and 2000.
Figure 1.1
Disk Administration for Windows 2000.
For Windows NT, go to Start -> Programs -> Administrative Tools -> Disk Administrator.
For Windows 2000, go to Start -> Programs -> Administrative Tools -> Configure Your
Server. From here, choose File Server -> Open Computer Management, then choose Storage
-> Disk Management. This allows you to change the partitions and drive letters. You
McCune01.fm Page 4 Friday, November 10, 2000 4:31 PM
1.4 Linux and Windows 95/98
5
can change the drive letter by simply right-clicking on the drive and then choosing Change
Drive Letter and Path. You can then add, edit, or delete the drive. One note, though: You
cannot change your boot partition. This is good because the system won’t boot if you do!
Linux treats partitions differently. The first two letters denote the type of drive, the next
letter is the drive letter, and the last character is the partition number of the drive. There are
four main drive types: IDE (
hd
), SCSI (
sd
), ESDI (
ed
), and RAID (
md
,
rd
, or
ida
). For
example,
hda1
is an IDE drive (
hd
), it is the first IDE drive (
a
), and the first partition (
1
).
sdc5
would represent a SCSI drive (
sd
), the third SCSI drive (
c
), and the fifth partition (
5
).
1.4 Linux and Windows 95/98
First, let’s go over what happens when Linux and Windows 9x boot up.
1.4.1 Booting Linux
When Linux boots, it loads the
LILO
program, which stands for LInux LOader. This then
loads the kernel, which is the core of the operating system. Finally, modules are loaded from
the
/etc/rc.d
directory. Actually, the Linux boot process is a little more complicated than
this, but this description is good enough for our purposes.
The
LILO
program is configured by using the
/etc/lilo.conf
file. A typical
lilo.conf
would look like this:
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz-2.2.13-4mdk
label=linux
root=/dev/hda5
read-only
Let’s go over the lines one at a time:

boot
—This is the device that contains the boot files.

map
—This is the location of the map file. The map file is a binary file containing
disk parameters for the system. The default is
/boot/map
.

install
—This is the file that is installed as the boot sector. The default is
/boot/boot.b
.

prompt timeout
—This is how long it waits before booting in tenths of a second. This
allows time to enter boot parameters manually. In the above example, it is five seconds
(
50
tenths of a second). If you have a multiple boot system, pressing <SHIFT> will
bring up the boot choices. You can set up to 16 different boot configurations.
McCune01.fm Page 5 Friday, November 10, 2000 4:31 PM
6
Chapter 1 • Having Linux and Windows on the Same PC

image
—This is the kernel. The parameters below are kernel parameters:

label
—The name that shows up on the boot menu.

root
—The location of the filesystem.

read-only
—The filesystem is mounted read-only so that it can be checked
for errors with
fsck
. It is then remounted as read/write.
These aren’t the only parameters for
lilo.conf
.
1.4.2 Troubleshooting LILO
LILO
loads the four letters in “LILO” as it goes through the four stages of loading. This can
be helpful in troubleshooting. If
LILO
stops while loading, the letters displayed tell where
it failed:
• (<nothing>)—No part of
LILO
has been loaded.
LILO
either isn’t installed or the partition
on which its boot sector is located isn’t active.

L <error> ...
—The first-stage boot loader has been loaded and started, but it can’t
load the second-stage boot loader. The two-digit error codes indicate the type of problem.
(See the section titled “Disk Error Codes” in Appendix A.) This condition usually
indicates a media failure or a geometry mismatch.

LI
—The first-stage boot loader was able to load the second-stage boot loader, but
could not execute it. This can either be caused by a geometry mismatch or by moving
/boot/boot.b
without running the map installer.

LIL
—The second-stage boot loader has been started, but it can’t load the descriptor
table from the map file. This is typically caused by a media failure or by a geometry
mismatch.
• LIL?—The second-stage boot loader has been loaded at an incorrect address. This is
typically caused by a subtle geometry mismatch or by moving /boot/boot.b without
running the map installer.
• LIL- —The descriptor table is corrupt. This can either be caused by a geometry mismatch
or by moving /boot/map without running the map installer.
• LILO—All parts of LILO have been successfully loaded.
If Linux doesn’t load, it will give an error code. The meanings of the error codes are
listed in Appendix A.
1.4.3 Booting Windows 9x
The way Windows boots is slightly different. The partition points to the boot sector, which
loads the two text files config.sys and autoexec.bat. It then loads the Windows equivalent
of the Linux kernel, win.com. The configuration file for win.com is the Registry,
which consists of two binary files: system.dat and user.dat. While config.sys and
autoexec.bat are text files, Registry files need to be edited with regedit.
McCune01.fm Page 6 Friday, November 10, 2000 4:31 PM
1.4 Linux and Windows 95/98 7
There are several ways to install Linux and Windows 3x/9x on the same machine. They
are listed below, starting with UMSDOS. Before anything is done, back up your hard drive
and run scandisk on the hard drive to correct any errors. This will save you a lot of trouble
down the road.



more info