📄 rhl03.htm
字号:
<BR>
<PRE>
<FONT COLOR="#000080">gzip -d filename</FONT></PRE>
<P>where filename is the name of the compressed file (including the .gz extension). The -d option tells gzip to decompress the file. When it is completed, the .gz file will have been erased and only the uncompressed file will remain (with the same
filename, less the .gz extension). You should uncompress the boot and root images.
<BR>
<P>The three floppies you need for Red Hat Linux don't have to be blank, as the RAWRITE utility used to copy the image to the floppies doesn't respect DOS formatting conventions. The two floppies must be high density. The disks must be formatted using the
DOS format program. The boot diskette must be the correct size for your system's boot floppy drive (A: in DOS terms).
<BR>
<P>To use the RAWRITE program, enter its name at the DOS prompt with the full path to the utility, such as:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">D:\DOSUTILS\RAWRITE</FONT></PRE>
<P>if your CD-ROM is drive D (or you can copy the files to a directory on your hard disk). RAWRITE will prompt you for the name of the file to copy and then destination drive letter. RAWRITE will then copy the images. Label the disks when the process is
finished.
<BR>
<P>If you have access to a UNIX or Linux system, you can create the boot disks from within that operating system. You will need to put the image files on the UNIX or Linux system and use the dd utility to copy them to floppy. First, make sure the images
are uncompressed (no .gz extension). If they are not, uncompress them with the gunzip utility.
<BR>
<P>To uncompress files in UNIX or Linux, issue the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gunzip filename</FONT></PRE>
<P>where filename is the name of the image file, with its .gz extension. The gunzip utility will erase the compressed file and leave an uncompressed version in its place.
<BR>
<P>To copy the images to a floppy, you need to know the device name of the floppy within the operating system. For most systems, the first floppy drive is /dev/fd0 and the second floppy drive is /dev/fd1. (Some systems treat the floppy drives as a raw
device, which have the names /dev/rfd0 and /dev/rfd1.) Copy image files to the floppy with the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">dd if=filename of=/dev/fd0 obs=18k</FONT></PRE>
<P>where filename is the name of the uncompressed image. The dd command converts file formats. The if and of parts of the command indicate the input and output filenames or devices. The obs portion of the command indicates the output block size (in this
case, 18KB).
<BR>
<P>For example, to copy the BOOT0023.IMG image to the first floppy (3.5-inch 1.44MB), issue the command:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">dd if=boot0023.img of=/dev/fd0 obs=18k</FONT></PRE>
<P>If you already have a Linux system, an easy way to make the boot and root floppies for Red Hat Linux is with a utility supplied on the CD-ROM. There is a Perl program called MKFLOPPIES.PL in the IMAGES subdirectory that can do the entire task for you. A
series of questions will help you determine the proper images.
<BR>
<BR>
<A NAME="E68E21"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Partitioning the Hard Disk</B></FONT></CENTER></H3>
<BR>
<P>Hard disks are divided into partitions or areas dedicated to an operating system. A hard disk can have up to four primary partitions, with some partitions being further divided into more logical drives by the operating system software.
<BR>
<P>Linux prefers to have two partitions: one for the Linux swap space, and one for the Linux software file system itself. The swap space is used as an extension of your machine's physical RAM and can be quite small. The Linux file-system partition tends to
be quite large, as it must hold all the Linux software. You can have several Linux file-system partitions, although one must be designated as the boot partition (where the kernel and primary utilities are located).
<BR>
<P>If you are using an existing hard disk that has an operating system already installed on it, you will have to repartition your hard disk to make room for Linux. This tends to be a destructive process, meaning that anything on your hard disk will be
destroyed. Make backups of your existing data if you want to keep it!
<BR>
<P>Partitioning of a hard disk is done with the fdisk utility from DOS or Linux, or interactively during the Red Hat Linux installation. You don't need to partition the drives before installing Red Hat Linux, but if you do partition during the installation
routine you will have to reboot to make the changes effective. If you have used fdisk in DOS, the Linux version does the same task (although the menus are completely different and much more complicated). Many PC-based UNIX systems also use fdisk to
partition hard drives.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>A DOS utility called FIPS sometimes allows nondestructive changes to your partitions, assuming no data is on the areas that will be repartitioned. FIPS is available from many sources, including most of the Linux FTP sites and some Linux CD-ROMs.
However, you should make backups, just in case!</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>You must decide how much space to allocate to the different partitions before you start, as changing your mind later will mean destroying all the data you have saved to disk. The Linux swap-space partition size will depend on the amount of RAM in your
system, the number of users you expect, and the type of development you will do.
<BR>
<P>If you are going to maintain a DOS partition on the same disk, you will have to balance the disk-space requirements of both operating systems against your total disk capacity. A minimum Linux file-system partition will be about 20MB, although closer to
200MB is needed for a full X-based installation.
<BR>
<BR>
<A NAME="E69E19"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Linux Swap-Space Partition</B></FONT></CENTER></H4>
<BR>
<P>How big should the swap-space partition be? No single number works for all installations, unfortunately. Generally, because the swap space is used as an extension of physical RAM, the more RAM you have, the less swap space is required. You can add the
amount of swap space and the amount of RAM together to get the amount of RAM Linux will use. For example, if you have 8MB of RAM on your machine's motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM.
<BR>
<P>Linux uses the swap space by moving pages of physical RAM to the swap space when it doesn't need that page at the moment, and vice versa when it needs the memory page. So why not make a very large swap space and let Linux think it's in heaven? Because
the swap space is much slower in access time than RAM, and there is a point at which the size of the swap space acts against your Linux system's efficiency, instead of for it.
<BR>
<P>Swap space may not be needed if you have lots of RAM. For example, if you have 16MB of physical RAM and don't intend to do any application development or run X, you won't make much use of the swap space because Linux can fit everything it needs into the
16MB. (You still should have a small swap space, just in case.)
<BR>
<P>If you are running X, developing applications, or running memory-hog applications like databases, swap space is crucial even if you have lots of physical RAM. Even 16MB RAM is not enough for X, so you need swap space.
<BR>
<P>A good rule is to create a swap space with a size of 16MB. Unless you have a very small capacity hard disk, this won't be a major drain on your resources and it does give Linux plenty to work with. If you don't want to allocate this much space, a good
rule is to have a total of 16MB RAM (swap space plus physical RAM). Don't eliminate the swap space completely, though, unless you really have a lot of RAM. At a minimum, set up a 4MB swap space. Running out of RAM can cause Linux to totally lock up or
crash, which isn't a pretty sight!
<BR>
<BR>
<A NAME="E69E20"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Setting Up Partitions</B></FONT></CENTER></H4>
<BR>
<P>Because the versions of fdisk in DOS, OS/2, UNIX, and Linux all differ, all the steps aren't explained here. The fdisk utility is very easy to use, so if you have used PC machines for a while this will not be a problem for you. Remember, though, that
fdisk will destroy existing data on your disk! You can set up your Linux disk partitions either from DOS or from within Linux. It really doesn't matter which approach you use, although the DOS fdisk program is a little easier to use than the Linux version.
If you are using DOS fdisk to repartition a DOS area on your drives, you may as well use it to set up the Linux swap space and file-system partitions, too. The DOS version of fdisk has one problem, though: it can't set the partition type numbers. Linux's
fdisk lets you set the partition types to be recognized more easily (type 82 for Linux swap and type 83 for Linux data).
<BR>
<P>To set up partitions for Linux, remove any existing partitions first (unless you want to keep them as they are). If you intend to use DOS on the same system as Linux, DOS should be the first partition on the disk so it can boot. (There are a few ways to
get by this using LILO, but it is still a good rule to leave DOS as the first partition.) If you are keeping an existing DOS partition, it should be the first partition.
<BR>
<P>You should create a DOS boot disk that can reformat and transfer the DOS kernel to the hard drive, regardless of whether you are leaving an existing DOS partition or creating a new one. To create the boot diskette, use the DOS command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">format a: /s</FONT></PRE>
<P> (assuming A: is the drive the diskette is in). The /s option transfers the operating system kernel. Next, copy the utilities FDISK, FORMAT, SYS, and CHKDSK to the boot floppy. You should also copy an editor, such as EDIT, and your existing CONFIG.SYS
and AUTOEXEC.BAT files (although you could rename them). This disk will let you format any new DOS partitions. Alternatively, if you are starting from scratch with a new DOS partition, you can simply reload DOS from the original diskettes when ready to
format the DOS partition.
<BR>
<P>If you are removing an existing DOS partition and re-creating a smaller one (as you would if your entire disk was DOS before Linux came into your life), follow these steps (after making a backup of your DOS data):
<BR>
<OL>
<LI>Remove the existing DOS partition.
<BR>
<BR>
<LI>Create a new primary DOS partition as the first partition.
<BR>
<BR>
<LI>Make the DOS partition active.
<BR>
<BR>
<LI>Reboot the system from your boot floppy (or DOS disks).
<BR>
<BR>
<LI>Format the DOS partition and transfer the DOS kernel (COMMAND.COM) and hidden .SYS files by using the DOS SYS command or using FORMAT /S.
<BR>
<BR>
<LI>Restore your backup files to the DOS partition (this can be done at any time).
<BR>
<BR>
</OL>
<P>Next, set up the Linux swap-space partition by creating a partition of the proper size. You can do this step either from DOS or when you have booted Linux from the boot and root floppies. For the sake of this chapter, we'll assume you are setting up the
partitions from DOS (although the process is the same either way).
<BR>
<P>Most versions of fdisk enable you to enter the size of the partition in MB, with the utility calculating the sector numbers that apply to it. Set the size of the Linux swap space to whatever size you decided. Don't make the partition active or format
it! You can set up the swap-space partition in an extended disk partition, but a primary partition is a better choice if your disk can support it.
<BR>
<P>Finally, create the Linux file-system partition to be whatever size you want, or the rest of the disk if that's the only partition missing. Again, don't activate or format the partition. When you are running the Linux installation routine, you will
identify and format the swap space and file-system partitions properly.
<BR>
<BR>
<A NAME="E68E22"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Install the Linux Partitions</B></FONT></CENTER></H3>
<BR>
<P>One of the first steps you are asked to do by the installation routine is to set up disk partitions. Red Hat Linux has two disk-partitioning utilities: fdisk and cfdisk. Both perform the same tasks, but cfdisk is a little easier to use. The fdisk
utility, though, will be familiar to users of other Linux versions.
<BR>
<P>If you have more than one hard drive, you can place your Linux partitions on either drive. If you are planning on keeping a DOS partition, though, make sure it is the first partition on the first drive. Linux isn't so picky. If you want to boot Linux
cleanly, place a Linux file system on the first drive. You can also create Linux file systems on the second drive. Linux swap partitions can be on either drive. If you have two drives, putting the swap space on the second drive and the bootable Linux data
partition on the first should provide better performance.
<BR>
<BR>
<A NAME="E69E21"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Linux's fdisk</B></FONT></CENTER></H4>
<BR>
<P>Linux's fdisk program is different from the one in DOS, so you should check the menus frequently to determine the proper commands. During the installation process the disk partitions are detected automatically, and you are placed in the fdisk program.
<BR>
<P>Alternatively, you can run fdisk at any time from a Linux prompt. You invoke the Linux fdisk in the same manner as that in DOS. If you don't specify a drive, fdisk will assume the first one in the system. Otherwise, you can specifically indicate which
disk drive to partition by giving the device name on the command line, as in
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">fdisk /dev/hdb</FONT></PRE>
<P>which will invoke fdisk for the second drive. If your system has IDE, ESDI, or RLL drives, the first is /dev/hda and the second /dev/hdb. SCSI drives are /dev/sda, /dev/sdb, and so on. Because seven SCSI drives can be supported on a single controller,
you could have up to /dev/hdg. (You can go even higher with another controller card, but few Linux systems will require this!)
<BR>
<P>As mentioned previously, Linux fdisk commands are different from the fdisk commands for DOS. Essentially, the commands you need to run the Linux fdisk utility are the following:
<BR>
<UL>
<LI>d—Deletes an existing partition
<BR>
<BR>
<LI>l—Lists all known partition types
<BR>
<BR>
<LI>n—Creates a new partition
<BR>
<BR>
<LI>p—Displays the current partition table
<BR>
<BR>
<LI>q—Quits fdisk without saving changes
<BR>
<BR>
<LI>t—Changes a partition's type code
<BR>
<BR>
<LI>v—Verifies the partition table
<BR>
<BR>
<LI>w—Writes current partition table to disk and exits
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -