📄 ch03.htm
字号:
<CENTER>
<H3><A NAME="Heading26<FONT COLOR="#000077">A Sample Run</FONT></H3>
</CENTER>
<P>Let's start with an example using my hard disk as the starting point for use with
fdisk. My hard drive is about 540MB. I want to use 63MB for DOS, exactly 16MB for
swap space, and the rest for Linux. Keep in mind that the numbers you see on your
screen are completely different from those in this book because it's very unlikely
that you will choose the same setup I have listed here.</P>
<P>First, use the <TT>p</TT> command to display the current partition table. As you
can see here, /dev/hda1 (the first partition on /dev/hda) is a DOS partition of 63,000
blocks on my machine:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Command (m for help): p
Disk /dev/hda: 16 heads, 63 sectors, 1024 cylinders
Units = cylinders of 1008 * 512 bytes
Device Boot Begin Start End Blocks Id System
/dev/hda1 * 2 2 126 63000 6 DOS 16-bit >=32M
Command (m for help):
</FONT></PRE>
<P>This output shows the begin and end cylinder numbers on the hard drive, the number
of blocks used, and the type of the block. I know from my hard drive's documentation
that it has 1,024 cylinders, and that information is echoed on the screen from fdisk.</P>
<P>From the preceding listing, I see that I am using 126 cylinders for my DOS partition.
For some unexplained reason, cylinder 1 is not used. (It was a mistake when I installed
DOS the nth time while writing this book, so I have to live with it.)</P>
<P>I determine the number of cylinders I will use for the swap space as 16,000 /
1,024, or about 15,624 blocks. This is not an exact science, so you can just guess
and still be in the ballpark. I am going to use 30 cylinders for my swap space. I
decide arbitrarily to place this on cylinders 994 through 1,024. In retrospect, this
was not a good idea because I would almost always place the swap space in the lower-numbered
sectors. The seek time is supposedly faster for lower-numbered cylinders...a myth
maybe?</P>
<P>Anyhow, this leaves me with the cylinders from 127 to 993 for Linux. I will now
create a new partition using the <TT>n</TT> command. The Linux root partition is
going to be 463MB in size.</P>
<P>I am asked whether I want to create an extended or a primary partition. In most
cases, you want to use primary partitions, unless you need more than four partitions
on a drive. I will choose the <TT>p</TT> option to make this a primary partition.
Then I am asked for the starting cylinder and the size of the partition:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Partition number (1-4): 2
First cylinder (127-1024): 127
Last cylinder or +size or +sizeM or +sizeK (128-1024): +993M
</FONT></PRE>
<P>The value for the first cylinder should be one greater than the value of the last
cylinder for the previous partition. In this case, /dev/hda1 ended on cylinder 126,
so the new partition starts at cylinder 127. The number <TT>+993M</TT> specifies
a partition of 993MB. Be sure to use the <TT>M</TT> for specifying megabytes. <TT>K</TT>
is used to specify kilobytes, and nothing is used for bytes. For example, <TT>+993K</TT>
would 993KB, and <TT>+993</TT> would specify just 993 bytes for the partition.</P>
<P>After you have created the partition, you have to set its type. Press the <TT>t</TT>
key on the command option to set the type of partition:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Command (m for help): t
Partition number (1-4): 2
Hex code (L to list): L
</FONT></PRE>
<P>The <TT>L</TT> response to the hex code command lists several partition types:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Command (m for help): L
0 Empty 9 AIX bootable 75 PC/IX b7 BSDI fs
1 DOS 12-bit FAT a OS/2 Boot Manag 80 Old MINIX b8 BSDI swap
2 XENIX root 40 Venix 80286 81 Linux/MINIX c7 Syrinx
3 XENIX usr 51 Novell? 82 Linux swap db CP/M
4 DOS 16-bit <32M 52 Microport 83 Linux native e1 DOS access
5 Extended 63 GNU HURD 93 Amoeba e3 DOS R/O
6 DOS 16-bit >=32 64 Novell Netware 94 Amoeba BBT f2 DOS secondary
7 OS/2 HPFS 65 Novell Netware a5 BSD/386 ff BBT
8 AIX
Command (m for help):t
Partition number (1-4): 2
Hex code (L to list): 83
</FONT></PRE>
<P>You should use the <TT>Linux native</TT> selection, <TT>83</TT>, for the partition
you will be storing your Linux data on. Onward, ho! To create the partition space,
I need a 16MB swap partition, which I will place in /dev/hda3. Actually, the setup
program that we will run shortly will let you create this from a menu as well. While
we are here, let's just go ahead and create it and enable it with the menu later.
(The command to enable swap space manually is <TT>mkswap</TT>. In my humble opinion,
you should use the menu version for enabling swap space.) The procedure is the same
as for the data partition, except that we will choose type <TT>82</TT> for the Linux
partition type:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (994-1024): 994
Last cylinder or +size or +sizeM or +sizeK (994-1024): 1024
Command (m for help): t
Partition number (1-4): 3
Hex code (L to list): 82
</FONT></PRE>
<P>Because this a swap partition, choose the type <TT>Linux swap</TT>, <TT>82</TT>.</P>
<P>This is what my hard drive's partition table looks like:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Command (m for help): p
Disk /dev/hda: 16 heads, 63 sectors, 1024 cylinders
Units = cylinders of 1008 * 512 bytes
Device Boot Begin Start End Blocks Id System
/dev/hda1 * 2 2 126 63000 6 DOS 16-bit >=32M
/dev/hda2 * 127 127 993 436968 82 Linux swap
/dev/hda3 * 994 994 1024 15624 83 Linux native
</FONT></PRE>
<P>If you are following along with your own hard drive with me, stop! The numbers
you see on-screen will most certainly be different than those shown here. Be sure
to write down on paper your own information corresponding to the information shown
here, especially the size of each partition in blocks. You will need this partition
and block information later.</P>
<P>Wait! You are not done yet.</P>
<P>These changes have been made only to a copy in memory of the on-disk partition
table. You now have to write this new table with its changes to disk. Save these
changes to disk and quit with the <TT>w</TT> command. Use the <TT>q</TT> command
to quit fdisk without saving changes.</P>
<P>Press Ctrl-Alt-Delete to reset the machine. While it's rebooting, swap floppies
to ensure that the boot disk is in drive A. You really do not have to reboot after
running fdisk during the installation process, but it will remove any possible inconsistencies
between the tables in memory and those on disk. Play it safe and reboot. In normal
operation, such as running fdisk from a running Linux system, you should reboot just
to be safe.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading27<FONT COLOR="#000077"><B>WARNING:</B> </FONT>If you see any
error messages at this point about "sectors greater than 1024," you should
check to see whether you have the right type of hard drive in your CMOS. The warning
comes with older controller cards that cannot boot Linux off a partition that is
on a cylinder greater than 1023. The error is not harmful, however, because you can
boot into Linux and install away on a partition located on a sector that is on cylinder
1023 (or less). For more information, consult the Linux documentation at<FONT COLOR="#0066FF"></FONT>
</DL>
<DL>
<DD><FONT COLOR="#0066FF">http://sunsite.unc.edu/mdw/HOWTO/mini/Large-Disk</FONT>
<HR>
<FONT COLOR="#0066FF"></FONT>
</DL>
<PRE><FONT COLOR="#0066FF"></FONT></PRE>
<CENTER>
<H3><A NAME="Heading28<FONT COLOR="#000077">Installing Linux Files</FONT></H3>
</CENTER>
<P>You have created the partitions for the drive and are now ready to install the
file system and software for Linux.</P>
<P>Installing the Slackware release is simple when compared to what you have just
been through. You use the <TT>setup</TT> command, which guides you through a series
of menus with which you can specify the means of installation, the partitions to
use, and so forth.</P>
<P>Now issue the following command:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF"># setup
</FONT></PRE>
<P>You see a menu with the following options. You can navigate the menu with the
arrow keys on your keyboard. Use the spacebar or Enter key to select the option that
the highlighted cursor is on.
<UL>
<LI>HELP: Navigation help.
<P>
<LI>KEYMAP: To remap the keyboard.
<P>
<LI>QUICK: For experienced Linux users making an update to an existing system.
<P>
<LI>MAKE TAGS: Allows you to tag certain packages for installation.
<P>
<LI>ADDSWAP: Lets you create and start the swap partition for the system.
<P>
<LI>TARGET: Lets you select the target partition to do the setup on. This also lets
you format the partition for use with Linux.
<P>
<LI>SOURCE: Lets you specify the source of all the packages. In your case, you would
select the CD-ROM. If you booted from a root file system disk that has network support,
<TT>NFS.gz</TT>, you can mount the directory with the source across a network.
<P>
<LI>DISK SET: Lets you select which disk sets to install.
<P>
<LI>INSTALL: Starts the installation process.
<P>
<LI>CONFIGURE: Lets you configure your devices: Mouse, Display, Time, and Network.
<P>
<LI>PKG TOOL: Lets you manage packages installed on your computer. You can use this
option to add or remove packages after installation is complete.
<P>
<LI>EXIT: Is the best way to bail out of the setup program.
</UL>
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading29<FONT COLOR="#000077"><B>CAUTION:</B> </FONT>The setup program
is not very forgiving of incorrectly typed keys. Read every screen carefully, and
be sure of what you are doing when you select any option other than the default.
Most of the defaults on the screen are probably what you want anyway. Do not use
the spacebar or Esc key as a cancel button in the setup program's menu. These are
interpreted as the Enter key.
<HR>
</DL>
<DL>
<DT><B></B></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading30<FONT COLOR="#000077"><B>CAUTION:</B> </FONT>Pressing the
Cancel button displayed on-screen while you are installing a package does not bail
you out of the entire installation process. In fact, it only cancels the installation
of the package whose dialog box you see on-screen. If you mistakenly decide not to
install a package, you can always install it later. If you install a package you
did not want (for example, the Ethernet drivers for a card you do not have), you
can uninstall it later, too. So don't worry.
<HR>
</DL>
<P>You should follow the sequence of menu items in the order in which they are displayed.
Do not venture into the QUICK and MAKE TAGS menu options. The defaults work in almost
all cases.</P>
<P>If you have not created the swap space earlier, the ADDSWAP selection presents
a menu to let you create such a partition. If a swap partition already exists, as
in the previous exercise, the ADDSWAP option asks whether you want to enable this
swap partition. If the setup program is being run from a boot disk (as it was the
first time), you should enable the swap partition. In the future when you run setup
from a running Linux system, do not enable the swap partition, because it will be
enabled every time you boot up.</P>
<P>The SOURCE and TARGET options specify the source of installable packages and the
partition to install these items on. If your CD-ROM is not the correct one, this
is when you will find out. This is a bit late in the process, but that's how it works,
folks. If you get errors about not being able to mount the CD-ROM, you have to start
over with a different CD-ROM driver.</P>
<P>The installation program lets you select the packages to install from the DISK
SET items. The A set is required for Linux to even run. The AP set offers the features
you probably will not be able to live without. You probably want to install the X
and D sets for the X Window and documentation on Linux. There is no hard and fast
rule about the other packages that are present on the CD-ROM. You can always run
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -