📄 rhl03.htm
字号:
<BR>
<BR>
</UL>
<P>The process for setting up a partition is to first examine the partition table to make sure any existing partitions are correct. If you have a DOS partition on your drive, it should show in the partition table. If you created Linux swap and file-system
partitions when you were in DOS's fdisk, they should appear in the partition table too, although the partition types will be incorrect.
<BR>
<BR>
<A NAME="E69E22"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Setting Up Linux Partitions</B></FONT></CENTER></H4>
<BR>
<P>To create the Linux swap space, use the n command and give the starting sector number. Usually, this will be immediately after any existing DOS partition (or other operating systems you have installed). Linux's fdisk lets you specify the size of the
partition either by supplying an end sector number or by giving a size in MB. The latter is much easier to work with, so just enter the number of MB you want to set your Linux swap-space partition to. The format is usually +XXM, where XX is the number of
megabytes (such as +16M). You can also specify kilobytes, but you don't want to create a swap partition that is less than 1MB in size.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>Most PC BIOSs cannot handle more than 1024 cylinders on a disk drive. You may not be able to create DOS or Linux partitions or file systems that go beyond the 1,023th cylinder (numbering starts at zero). Some other operating systems, such as SCO
UNIX, enable you to use anything beyond the 1,024 limit. Linux can use partitions beyond the 1,024 limit, but it can't boot from them. If you have a disk drive that has more than 1,023 cylinders, make sure your primary Linux partition ends before 1,023.
You can create extra partitions following that cylinder and mount them as second file systems.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>The fdisk program will ask you if you want to create a primary or an extended partition. If you are creating a primary partition it wants the number (one to four—remember a DOS partition has to be number 1 to boot). In most cases you should create
only primary partitions, unless you have a large disk drive. Extended partitions can be used to add logical drives inside them, as DOS creates logical drives. In Linux, extended partitions are not the same as extended file systems!
<BR>
<P>After you have created the Linux partition, you should assign its type. Some versions of fdisk prompt for this right away, whereas others let you select the option to assign file-system types from the fdisk menu. In either case, the letter l will
display all known file-system types. Choose the one that designates a Linux swap space (number 82), and check the partition table. Your Linux swap-space partition should have the correct size and partition type displayed. Actually, Linux doesn't care about
the partition-type numbers and ignores them completely, although it can make autodetection of the Linux partitions a little easier during installation. Some other operating systems do note them, though, so it's a good practice to label them correctly to
prevent future problems. It also helps you keep the partition table nicely organized!
<BR>
<P>Next, create your primary Linux file-system partition in the same manner. If you want to use the rest of the disk drive for that partition, you can enter the end sector number of your drive (Linux's fdisk will tell you the range you can use). This would
be the usual default if your hard drive has a DOS, Linux swap space, and Linux file-system partition on it. After you have created the Linux file system, you should identify its file type as 82, which is a "Linux native" type.
<BR>
<P>You should note the size of the swap-space and file-system partitions in blocks; you will need this information later. You can read this straight from the partition table.
<BR>
<P>After you've created the Linux partitions and are satisfied with the partition-table layout, save and exit fdisk. If you don't save the information, you will have to repeat the process again.
<BR>
<BR>
<A NAME="E69E23"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Enabling the Swap Space For Installation</B></FONT></CENTER></H4>
<BR>
<P>When you have set up the disk partitions through the automated installation routine, you don't have to worry about enabling the swap space; it is performed automatically. If you are doing these steps manually, you will have to enable the swap space so
Linux can use it.
<BR>
<P>If you have 4MB of RAM or less, you will have problems installing Linux unless you have the kernel use the swap space. (If you have only 4MB or less of RAM in your system, you should have a swap space of at least 8MB—preferably 16MB.) If you try to
install Linux and get memory error messages, it's because there is not enough RAM and the swap space is needed.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>If you've turned the swap space on and still get error messages, you need either more physical RAM or a larger swap space. To increase the size of a swap-space partition, you may have to remove the existing Linux partitions and re-create them with
fdisk.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>If you have a small amount of RAM, you should enable the swap space to help the installation process. Even if you have lots of RAM, there's no reason not to enable the swap space now, anyway. To enable the swap space, issue the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">mkswap -c partition size</FONT></PRE>
<P>where partition is the name of the partition and size is the size of the partition in blocks. You may have noted this number earlier when setting up the partition table. If not, you can start fdisk again and read the size in blocks from the
partition-table display.
<BR>
<P>For example, if you have set up the Linux swap space on partition /dev/hda2 (the second primary partition on the first non-SCSI drive) and it has a size of 13,565 blocks, you would issue the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">mkswap -c /dev/hda2 13565</FONT></PRE>
<P>The -c option in the command line tells the mkswap utility to check for bad blocks in the partition. If this option is on, it will take a little longer to create the swap partition; however, a bad block in the swap partition can cause your entire system
to crash, so it's worth the delay. If mkswap finds any errors in the swap space, it will generate an error message. However, because mkswap flags bad blocks to be left alone, you can ignore the messages unless there are a considerable number of them, in
which case your hard drive has too many bad blocks!
<BR>
<P>When the swap partition has been formatted, you enable the Linux swap-space partition with the command swapon. Usually you will have to specify the partition, although some versions can figure the partition out automatically from the partition table. It
never hurts to be explicit, though. To enable the swap partition just formatted, enter the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">swapon /dev/hda2</FONT></PRE>
<P>You will have to repeat the format and swapon commands for each swap partition, if you created more than one. As soon as the swapon command is executed, the Linux kernel will start to use the new swap space as an extension of the physical RAM.
<BR>
<BR>
<A NAME="E69E24"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Creating the Linux File-System Partition</B></FONT></CENTER></H4>
<BR>
<P>When you have a swap space configured and working, you can set up the Linux file system. This step may be automated by some Linux installation scripts, or you may have to execute it yourself. Either way, this section explains what is going on.
<BR>
<P>You will have already allocated the partition table to support a Linux file system. Now you can create the file system with the mkfs (make file system) command. The exact format of the command depends on the type of file system you are setting up. The
most popular file system (for reasons of speed and flexibility) is called the Second Extended file system (which has nothing to do with extended partitions on a hard disk). To create a Second Extended file system, issue the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">mke2fs -c partition size</FONT></PRE>
<P>where partition is the device name and size is the size of the partition in blocks (taken from the partition display in fdisk). The size doesn't have to be specified with mke2fs as it can figure it out from the partition information. For example, to
create a file system in /dev/hda3, the command would be
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">mke2fs -c /dev/hda3</FONT></PRE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>When specifying the size of a partition, make sure you use blocks and not sectors or cylinders. Using the wrong value will result in errors or only a fraction of your partition being used.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>The mke2fs utility will check the partition for bad blocks (the -c option) then set the file system up properly in that partition. If you are setting up a large partition, the disk check can take a few minutes—but you should not ignore it unless
you know your disk is good.
<BR>
<P>The other file systems available to Linux are the Xia file system, the Extended file system, and the Minix file system. The Xia file system is good, but not as popular as the Second Extended. The Extended file system is an older version of Second
Extended, whereas the Minix file system is compatible with the old Minix operating system. You can create these file systems with the following commands:
<BR>
<UL>
<LI>Extended—mkefs
<BR>
<BR>
<LI>Minix—mkfs
<BR>
<BR>
<LI>Xia—mkxfs
<BR>
<BR>
</UL>
<P>All three commands take the same arguments as the Second Extended file-system command. The Minix file system is limited to 64MB.
<BR>
<P>None of the mkfs commands format the filesystem—they simply set it up. You are prompted for a file-system format during the installation process.
<BR>
<BR>
<A NAME="E68E23"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Troubleshooting</B></FONT></CENTER></H3>
<BR>
<P>There are many different problems that can occur while setting up and installing a Linux system, although most of them will be self-explanatory from error messages. A few commonly encountered problems can be easily dealt with, though, so we'll look at
them briefly.
<BR>
<BR>
<A NAME="E69E25"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Software Installation</B></FONT></CENTER></H4>
<BR>
<P>You may encounter a few errors when installing Linux. If you get the message device full, it means you have run out of disk space and need to install fewer components or allocate more hard disk space. If you haven't installed the basic system, you will
need more disk space. You will have to delete your partitions and start the installation process again, allocating more to Linux.
<BR>
<P>Errors such as read error, file not found, and tar: read error are indicative of a problem with either the disk medium you are installing from, or an incomplete Disk Set. These problems usually occur with floppies, and they tend to indicate a bad
diskette. All you can do in most cases is replace the diskette with a new one.
<BR>
<BR>
<A NAME="E69E26"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Hard Disk and Disk Controller</B></FONT></CENTER></H4>
<BR>
<P>When Linux boots it displays a few messages, one of the most important being a partition check. You will see messages like this:
<BR>
<PRE>
<FONT COLOR="#000080">Partition check:
hda: hda1 hda2 hda3
hdb: hdb1 hdb2</FONT></PRE>
<P>In this example, the first non-SCSI disk has three partitions and the second disk has two. Your system's output will probably be different, of course. If you don't see any partition information, either the hard disk controller is not recognized
properly, or the disk drives themselves are not accessible. There are a number of potential causes for these problems, including the obvious:
<BR>
<UL>
<LI>Check the cables inside the computer. The hard-disk cable should run from the adapter card to each drive's connector. Make sure the cables are connected in the proper manner (the red strip on the cable is at pin 1 on the connector).
<BR>
<BR>
<LI>Confirm that the power connector is attached to each disk drive. Without power, your drive won't spin up and Linux can't touch it.
<BR>
<BR>
<LI>Check the partition table to make sure you created a Linux partition properly.
<BR>
<BR>
</UL>
<P>After that, if the drive is not working properly with Linux but works fine when you boot DOS, a kernel driver for the hard disk is probably at fault. Some IDE drives, for example, are not as well-behaved (that is, conforming to the IDE standards) as
others, and your IDE kernel driver may not be able to talk to your drives. Try using a different kernel image and see if the problem solves itself. If you are using a SCSI kernel and adapter and the drives are not recognized, use the utilities that came
with the SCSI adapter card to force a check of the hard drives. They may have a SCSI ID set incorrectly.
<BR>
<BR>
<A NAME="E69E27"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Device Conflicts</B></FONT></CENTER></H4>
<BR>
<P>One of the most commonly encountered problems is hardware not recognized properly. This can happen to a CD-ROM, a network card, and even a hard disk. Most of the time this is caused by a conflict in the IRQ (interrupt), DMA (Direct Memory Address), or
I/O address settings. When two devices have the same settings on any one of the three characteristics, Linux and the BIOS may not be able to communicate with the device properly.
<BR>
<P>A symptom of this problem may be Linux hanging when it tries to find a specific device, as explained on the boot messages. When Linux boots up, it generates verbose messages on the console that explain what it is doing. If you see a message that it is
trying to connect to the network card, for example, and it never gets past that point, chances are that the network card has a conflict with another device. (Totally failed cards are very rare and don't usually stop the boot process; Linux ignores devices
it can't access. The problem with a working card with conflicting settings is that Linux is getting messages from two devices that don't act the same.)
<BR>
<P>To check for conflicts, you can run a diagnostic utility under DOS such as MSD or Norton Info. Windows 95 users can use the System icon in the Control Panel to obtain this information. These diagnostics can show you the current IRQ, DMA, and I/O
addresses and pinpoint any conflicts. They can also be used for finding available settings.
<BR>
<P>Alternately, you will have to check the settings of every device in your system for conflicts. Usually, network cards will conflict with sound boards, non-SCSI tape driver cards, video cards, and similar add-on cards. Most cards use DIPs or jumpers to
set these parameters, so check them against the documentation. To help isolate the problem, remove cards that are not necessary, such as a sound card, and see if the boot process moves past the device that caused the hang-up.
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -