📄 lsg03.htm
字号:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">dd if=<filename> of=/dev/fd0 obs=18k</FONT></PRE>
<P>where filename is the name of the decompressed image. The dd command converts file formats. The if and of parts of the command indicate the input and output filenames of devices. The obs portion of the command indicates the output block size (in this case, 18K).
<BR>
<P>For example, to copy the scsi and color144 images to the first floppy drive (3.5-inch 1.44M), issue the following two commands:
<BR>
<PRE>
<FONT COLOR="#000080">dd if=scsi of=/dev/fd0 obs=18k
dd if=color144 of=/dev/fd0 obs=18k</FONT></PRE>
<P>Linux is particularly stubborn about telling you your progress, so you won't see many messages. When dd starts the copy, it tells you how many blocks it will move. When it finishes, it returns the shell prompt to you without any message (unless the procedure failed). Figure 3.2 shows the command for copying the root kernel scsi to a floppy disk. After you copy both the root and boot kernels, you have completed this stage of the installation. The two floppy disks are now ready to boot a minimum Linux system for you.
<BR>
<P><B> <A HREF="03LSG02.gif">Figure 3.2.</B>
<BR><B>You can use the </B><B>dd</B><B> command to copy the boot and root images to floppy </B><B>disk from any Linux or UNIX system.</A></B>
<BR>
<BR>
<A NAME="E68E12"></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, which are areas dedicated to an operating system. A hard disk can have up to four primary partitions, with some partitions being divided into more logical drives by the operating system software. A more complete discussion of partitions is in <A HREF="lsg04.htm">Chapter 4</A>, "LILO."
<BR>
<P>If you are running Linux from a DOS partition using the UMSDOS root image, you don't have to worry about repartitioning your drives. Your existing drive's partitions will be used. However, because UMSDOS is a poor filesystem compared to Linux's, you will probably want to create your own Linux partitions. Check the later section "Using UMSDOS" for information on setting up UMSDOS.
<BR>
<P>Linux prefers two partitions: one for the Linux swap space and one for the Linux software filesystem itself. The swap space is used as an extension of your machine's physical RAM and can be quite small. Technically, you don't need a swap partition, especially if you have lots of RAM, but it is a very good idea to create one anyway as your system can grind to a halt suddenly if RAM is exhausted. The Linux filesystem partition tends to be quite large, as it must hold all the Linux software. You can have several Linux filesystem partitions to hold utilities, applications, and user files, although one partition must be designated as the boot partition (where the kernel and primary utilities are located).
<BR>
<P>If you are using a 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 process will destroy anything already on your hard disk, so make backups of any existing data you want to keep!
<BR>
<P>You use the fdisk utility to partition a hard disk. The Linux version of fdisk does the same task as FDISK in DOS, 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 non-destructive 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 on 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 depends 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 filesystem partition will be about 20M, although closer to 100M is needed for a full X-based installation.
<BR>
<BR>
<A NAME="E69E29"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Determining the Size of the 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. 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 8M of RAM on your machine's motherboard and a 16M swap space partition, Linux will behave as though you had 24M RAM.
<BR>
<P>Linux uses the swap space by moving pages of physical RAM to the swap space when it doesn't need them, and moving them back again when it needs the memory pages. Why not make a very large swap space and let Linux think it's in heaven? The swap space is much slower in access time than RAM, and there is a point at which the size of the swap space starts to act against your Linux system's efficiency instead of for it. In addition, most versions of Linux have an upper limit of 16M for each swap partition. Those versions of Linux will, however, let you partition more than 16M to a swap space, but it will only use the first 16M. If needed, though, you can create multiple swap partitions. Up to eight swap partitions can exist, each up to 16M in size. The latest versions of Linux allow swap partitions larger than 16M, but it is wise to keep that size as a guide.
<BR>
<P>You may not even need swap space if you have lots of RAM. For example, if you have 16M of physical RAM and don't intend to do any application development or run X, you probably won't make much use of the swap space because Linux can fit everything it needs in the 16M. (You still should have a small swap space, just in case.) 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 16M RAM is not enough for X, so you need swap space.
<BR>
<P>A good rule is to create a swap space with the maximum size limit of 16M. Unless you have a very small capacity hard disk, a swap space of this size won't be a major drain on your resources, and it gives Linux plenty of space with which to work. If you don't want to allocate this much space, a good rule is to have a total of 16M RAM (swap space plus physical RAM). Don't eliminate the swap space completely, though, even if you have a lot of RAM. At a minimum, set up a 4M swap space. Running out of RAM can cause Linux to lock up or crash.
<BR>
<P>Once a swap space partition has been created, it is just like any other partition on the hard drive. If you want to change its size, you have to remove the existing partition and create a new one, although the space must be contiguous on the hard drive (which can be difficult to do if you have used all the space the drive offers for other partitions).
<BR>
<BR>
<A NAME="E69E30"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Setting up Partitions</B></FONT></CENTER></H4>
<BR>
<P>You use the fdisk utility to set up the partitions on your hard disk. Remember 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 Linux's. If you are using DOS FDISK to repartition a DOS area on your drives, use it to set up the Linux swap space and filesystem partitions, too.
<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. (You can use LILO to get by this restriction, but it is still a good rule to leave DOS as the first partition.) If you are keeping an existing DOS partition on your hard drive, leave the first partition as DOS if you can.
<BR>
<P>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 disk, use the DOS
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">format a: /s</FONT></PRE>
<P>command (assuming A: is the drive the disk is in). The /s option transfers the operating system kernel. Next, copy the utilities FDISK, FORMAT, SYS, and CHKDSK to the boot disk. You should also copy an editor such as EDIT(which requires the QBASIC files as well), 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 reload DOS from the original floppy disks when ready to format the DOS partition.
<BR>
<P>If you are removing an existing DOS partition and recreating 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 disk (or DOS disks).
<BR>
<BR>
<LI>Format the DOS partition and transfer the DOS kernel (COMMAND.COM).
<BR>
<BR>
<LI>Restore your backup files to the DOS partition. (You can do this step at anytime).
<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 floppy disks. The rest of this section assumes that you are setting up the partitions from DOS, although the process is the same either way.
<BR>
<P>Most versions of FDISK allow you to enter the size of the partition in megabytes, with the utility calculating the sector numbers that apply to it. Set the size of the Linux swap space to whatever size you decided, up to a maximum of 16M. 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 filesystem partition to be whatever size you want; you can even make it the size of 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 filesystem partitions properly.
<BR>
<BR>
<A NAME="E69E31"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Using UMSDOS</B></FONT></CENTER></H4>
<BR>
<P>UMSDOS allows you to use an existing DOS partition to house your Linux system. However, since you will be forcing Linux to use the DOS disk layout, you will suffer some performance limitations compared to creating a dedicated Linux partition. On the other hand, using UMSDOS lets you keep your disk drive the way it is, preventing the hassle of repartitioning and reformatting your drive. It is also a fast and easy way to install Linux if you only want to experiment for a while before installing a full system.
<BR>
<P>Note that UMSDOS does not let you run DOS and Linux at the same time. UMSDOS (UNIX in MS-DOS) only creates the Linux filesystem under the DOS formatted partition, although the partition is modified to allow long filenames, Linux file permissions, and more. When you start the system, you still have to choose between booting Linux or DOS as the operating system. If you start DOS, you can't use the extended Linux filenames, although you will be able to snoop around the directories. Filenames may not make much sense because of the contraction from long Linux filenames to DOS-compatible filenames, though.
<BR>
<P>The only limitation about UMSDOS is that the DOS filesystem is not designed as well as the Linux filesystem, so you get some performance degradation. This problem isn't major as most people don't notice the difference unless they are running a file-intensive application like X or compiling programs. You can always start with UMSDOS; then if you decide you like Linux enough, back up the Linux data and repartition the drive to create a true Linux filesystem.
<BR>
<P>If you want to use UMSDOS, you have to perform a few extra steps when setting up the disk. You must still create the boot and root disks, although you will need a root image that supports UMSDOS. (Most distributions have the root images umsds144 and umsds12 for this purpose.) When you boot Linux and it asks which partition to use for the filesystem, you specify the DOS partition. UMSDOS then initializes the filesystem for you. After that, the procedure for installing the rest of Linux is the same as it is for a dedicated Linux partition.
<BR>
<BR>
<A NAME="E68E13"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Installing the Linux Partitions</B></FONT></CENTER></H3>
<BR>
<P>The Linux installation process starts when you boot your system from the boot floppy disk. After the kernel has loaded, you will be prompted to remove the boot floppy disk and insert your root floppy disk. When the root filesystem has been read, you will either be sent directly to an installation script, or presented with the login prompt. Log in as root. No password is required, because you haven't yet added one to the system.
<BR>
<P>The first step is to set up the disk partitions, if you haven't already done so, using fdisk. 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 that partition is the first partition on the first drive. Linux isn't so picky. If you want to boot Linux cleanly, place a Linux filesystem on the first drive. You can also create Linux filesystems on the second drive. A Linux swap partition can be on either drive, although keeping it on the first drive with the first filesystem is a good idea.
<BR>
<BR>
<A NAME="E69E32"></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 than the one in DOS, so check the menus frequently to determine the proper commands. You invoke Linux's fdisk in the same manner as DOS'. If you don't specify a drive, fdisk assumes 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 invokes fdisk for the second drive. If your system has IDE, ESDI, or RLL drives, the first drive is /dev/hda and the second is /dev/hdb. SCSI drives are /dev/sda, /dev/sdb, and so on. Because a single controller can support seven SCSI drives, you could have up to /dev/hdg. (You can go even higher with another controller card, but few Linux systems will require that many drives!)
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>You should not use Linux's fdisk utility to create partitions for operating systems other than Linux. If, for example, you want a DOS partition on your disk, create it with DOS' FDISK. Linux does not write the partition table properly for other operating systems.</NOTE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -