- Installing Red Hat Linux
- Installation Tasks
- The X Window System
- Chapter Summary
- Exercises
- Advanced Exercises
Installation Tasks
This section details some common tasks you may need to perform during or after installation. It covers using Disk Druid to partition the disk during installation, using fdisk to modify partitions after installation, using Kickstart to automate installation, and setting up a system that will boot either Windows or Linux (a dual boot system).
Using Disk Druid to Partition the Disk
Disk Druid, a graphical disk-partitioning program that can add, delete, and modify partitions on a hard drive, is part of the Red Hat installation system. You can use Disk Druid only while you are installing a system: It cannot be run on its own. You can use fdisk (page 58) to manipulate partitions after you install Red Hat Linux. As explained earlier, if you want a basic set of partitions, you can allow Disk Druid to partition the hard drive automatically.
Disk Druid includes Clone, a tool that copies the partitioning scheme from a single drive to as many other drives as needed. The Clone option is useful for making multiple copies of a RAID partition/drive when you are creating a large RAID array of identical partitions or identically partitioned drives. Click the RAID button to access the Clone tool, which is active only when at least one unallocated RAID partition exists.
During installation, the Disk Partitioning Setup screen gives you the choice between automatically and manually partitioning the hard disk. Choose automatic partitioning if you do not want to make any decisions about how to split up the hard disk.
The Automatic Partitioning screen gives you the following choices:
- Remove all Linux partitions Removes all Linux partitions, deleting the data on those partitions and creating one or more chunks of free space (page 972) on the disk. You can create new partitions using the free space. If there is only a Linux system on the disk, this choice is the same as the next one.
- Remove all partitions Deletes all the data on the disk and gives you a free space the size of the disk to work with, as though you were working with a new drive.
- Keep all partitions and use existing free space Forces you to install Red Hat Linux in the free space on the disk. Does not work if there is not enough, free space.
Choosing automatic partitioning causes anaconda to split the free space, if possible, into three partitions: /boot (about 100 megabytes), swap (up to a few thousand megabytes), and / (root), which gets the bulk of the disk space.
The Automatic Partitioning screen has a frame that allows you to choose the hard disk you want to install Red Hat Linux on. This frame has meaning only if you have more than one hard disk. At the bottom of the screen is a check box, Review (and modify if needed) the partitions created. Put a check mark in this box to display the initial Disk Druid window (Figure 3-6) when you click Next.
Figure 3-6 Disk Druid: Main screen with Help hidden
When you choose to partition the hard disk manually, Anaconda displays the Disk Setup screen, which is the Disk Druid main screen, shown in Figure 3-6 with the Help column hidden. This screen has three sections, from the top: a graphical representation of the disk drive(s) showing how each is partitioned, a row of command buttons, and a graphical table listing one partition per line. If you are starting with a new disk, no partitions are listed on the screen.
The row of command buttons has the following buttons:
- New Adds a new partition to the disk (page 55).
- Edit Edits the highlighted partition (page 56).
- Delete Deletes the highlighted partition.
- Reset Cancels the changes you have made and causes the Disk Druid table to revert so it matches the layout of the disk.
- RAID Enables you to create software RAID partitions and to join two or more RAID partitions into a RAID device (page 31).
- LVM Enables you to create LVM physical volumes, which you can then use to create LVM logical volumes (page 32).
The Disk Druid table has the following columns:
- Device The name of the device in the /dev directory (for example, /dev/hda1).
- Mount Point/RAID/Volume Specified where the partition will be mounted when the system is brought up (for example, /usr). Also used to specify the RAID device or LVM volume the partition is part of.
- Type The type of partition, such as ext3, swap, or LVM.
- Format A check mark in this column indicates the partition will be formatted as part of the installation procedure. All data on the partition will be lost.
- Size The size of the partition in megabytes.
- Start The number of the block the partition starts on.
- End The number of the block the partition ends on.
At the bottom of the screen is a check box that allows you to hide RAID device and LVM volume group members. Do not check this box if you want to see all the information about the disk drives.
In order to add a new partition to a hard drive, there must be enough free space on the hard drive to accommodate the partition. Click the New button to add a partition; Disk Druid displays the Add Partition window (Figure 3-7). Specify the mount point (the name of the directory that the partition will be mounted over [page 442]) and the filesystem type; use the arrow buttons at the right end of these text boxes to display drop-down menus of choices. If there is more than one drive, mark the check box next to the drive you want the partition to be created on in the Allowable Drives frame. Specify the desired size of the partition and, in the Additional Size Options frame, mark Fixed size to create the partition close to the size you specify. Because of block-size constraints, partitions are not usually exactly the size you specify. Mark Fill all space up to (MB) and fill in the maximum size you want the partition to be to create a partition that takes up the existing free space, up to the maximum size you specify. In other words, Disk Druid does not complain if it cannot create the partition as large as you would like. Mark the third choice, Fill to maximum allowable size, to cause the partition to occupy all the remaining free space on the disk, regardless of size. Mark the Force to be a primary partition check box to create a primary partition. Click OK, and Disk Druid adds the partition to its table (but does not write to the hard disk).
Figure 3-7 Disk Druid: Add Partition window
To modify an existing partition, highlight the partition in the Disk Druid table or the graphical representation of the disk drive and click the Edit button; Disk Druid displays the Edit Partition window (Figure 3-8). From this window, you can change the mount point of a partition or format the partition as another type (ext3, vfat, swap, and so on). You cannot change the size of a partition from this window; instead, you must delete the partition and create a new partition of the desired size.
Figure 3-8 Disk Druid: Edit Partition window
Using the Kickstart Configurator
Kickstart is Red Hat's program that completely or partially automates the same installation and postinstallation configuration on one or more machines. You create a single file that answers all the questions that are normally asked during an installation. Then the installation script refers to this file instead of asking you the questions. Using Kickstart, you can automate language selection, network configuration, keyboard selection, boot loader installation, disk partitioning, mouse selection, X Window System configuration, and more.
The system-config-kickstart (FEDORA) and redhat-config-kickstart (RHEL) utilities run the Kickstart Configurator (Figure 3-9), which creates a Kickstart installation script.
Figure 3-9 Kickstart Configurator
Figure 3-9 shows the first window the Kickstart Configurator displays. The first text box, Language, is the language that will be used for installation. The Language Support box, toward the bottom of the window, is the language that the new system will use after installation.
To generate a Kickstart file (ks.cfg by default), go through each section of this window (along the left side) and fill in the answers and mark the appropriate boxes. Click the Help button for instructions on completing these tasks. When you are finished and click Save File, the Kickstart Configurator gives you a chance to review the generated script before it saves the file.
fdisk: Reports On and Partitions a Hard Disk
The fdisk utility reports on and manipulates hard disk partitions. You can display the size (in 1024-byte blocks) of a hard disk by using the fdisk with the –s option followed by the device name of the hard drive:
# fdisk -s /dev/hda 12714912
Run fdisk with the –l option to display information about partitions on the drives you specify:
# /sbin/fdisk -l /dev/hda Disk /dev/hda: 123.5 GB, 123522416640 bytes 255 heads, 63 sectors/track, 15017 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 2563 20482875 83 Linux /dev/hda3 2564 5113 20482875 83 Linux /dev/hda4 5114 15017 79553880 f Win95 Ext'd (LBA) /dev/hda5 5114 7663 20482843+ 83 Linux /dev/hda6 7664 10213 20482843+ 83 Linux /dev/hda7 10214 11488 10241406 83 Linux /dev/hda8 11489 12125 5116671 83 Linux /dev/hda9 12126 12252 1020096 83 Linux /dev/hda10 12253 12379 1020096 83 Linux /dev/hda11 12380 12506 1020096 83 Linux /dev/hda12 12507 12633 1020096 83 Linux /dev/hda13 12634 12887 2040223+ 82 Linux swap /dev/hda14 12888 15017 17109193+ 8e Linux LVM
In the preceding output, /dev/hda4 is an extended partition (page 28), /dev/hda13 is a swap partition (page 435), and /dev/hda14 specifies a part of the disk that is managed by LVM (page 32).
In addition to reporting on the layout and size of a disk drive, you can use fdisk interactively to modify the layout. Be extremely careful when using fdisk in this manner, and always back up the system before starting. Changing the partition information (the partition table) on a disk destroys the information on the disk. Read the fdisk man page and the Linux Partition mini-HOWTO before modifying a partition table.
To partition a disk, start fdisk without any options and give an m command, which displays the following help message. You can safely ignore a warning message about the number of cylinders being too large.
# /sbin/fdisk /dev/hda Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
When you choose p (print), fdisk displays the current partitions on the disk:
Command (m for help): p Disk /dev/hda: 123.5 GB, 123522416640 bytes 255 heads, 63 sectors/track, 15017 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 2563 20482875 83 Linux /dev/hda3 2564 5113 20482875 83 Linux /dev/hda4 5114 15017 79553880 f Win95 Ext'd (LBA) /dev/hda5 5114 7663 20482843+ 83 Linux /dev/hda6 7664 10213 20482843+ 83 Linux /dev/hda7 10214 11488 10241406 83 Linux /dev/hda8 11489 12125 5116671 83 Linux /dev/hda9 12126 12252 1020096 83 Linux /dev/hda10 12253 12379 1020096 83 Linux /dev/hda11 12380 12506 1020096 83 Linux /dev/hda12 12507 12633 1020096 83 Linux /dev/hda13 12634 12887 2040223+ 82 Linux swap /dev/hda14 12888 15017 17109193+ 8e Linux LVM
Each disk entry includes the filename within the /dev directory, the cylinders the partition starts and ends on (use u to change the units to sectors), the number of 1024 (1 kilobyte) blocks, the ID number of the partition type (l [ell] lists the partition types), and the name of the partition type.
In the preceding example partition 4 defines an extended partition that includes almost the entire disk. You cannot make changes to this partition without affecting all the partitions within it. Following are guidelines to remember when defining a partition table for a disk. For more information, refer to "Partitioning a Disk" on page 29.
- Do not modify the partition that defines the entire disk. This partition is called the backup, or overlap, partition.
- Do not overlap partitions that contain data. If the first partition ends at cylinder 187, the second partition should begin at cylinder 188. If you overlap partitions, the filesystem will become corrupt as data for overlapping files is written to the disk. Because the overlap partition contains no data or filesystem, it is safe to have other partitions overlap it.
- Never put a raw partition on cylinder 0. A few sectors on cylinder 0 are reserved for such things as the disk label, bad blocks, and partition tables. A filesystem will preserve this information, but when you use cylinder 0 as part of a raw partition, this information is deleted, and the disk may become unusable. An example of a raw partition is a swap partition (page 435) or raw database partition, as used for a Sybase or Oracle database. Start all raw partitions at cylinder 1 or greater.
- It is a good idea to put /boot at the beginning of the drive (partition 1) so that there is no issue of Linux having to boot from a partition too far into the drive. When you can afford the disk space, it is desirable to put each major filesystem on a separate partition. Many people choose to combine root, /var, and /usr into a single partition, which generally results in less wasted space but can, on rare occasions, cause problems. You can also put the contents of the boot directory in the root filesystem.
- When using megabytes to specify the size of a partition, remember to check how many cylinders have been allocated so you know where to begin the next partition.
- Use tune2fs (page 447) to make all partitions, except swap and /boot, type ext3, unless you have a reason to do otherwise.
The following sequence of commands defines a 300 megabyte, bootable, Linux partition as partition 1 on a clean disk:
# /sbin/fdisk /dev/hda
Command (m for help): n (create new partition) Command action l logical (5 or over) p primary partition (1-4) p (select primary partition) Partition number (1-4): 1 (select partition number 1) First cylinder (1-1582, default 1): (allow first cylinder to default to 1) Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-2, default 2): +300M (300 MB partition) Command (m for help): t (set partition type) Partition number (1-12): 1 (specify which partition) Hex code (type L to list codes): 83 (83 is Linux, 82 is Linux swap, press L for a list) Changed system type of partition 1 to 83 Command (m for help): a (specify a bootable partition) Partition number (1-12): 1 (specify partition 1 as bootable)
After defining a partition using k or m to specify kilobytes or megabytes, run p to check for the ending cylinder. Do this before defining the next contiguous partition so that you do not waste space or have any overlap. After setting up all the partitions and exiting from fdisk with a w command, make a filesystem (mkfs, page 397) on each partition that is to hold a filesystem (not swap). Use mkswap (page 435) to create a swap partition. You can use e2label (page 396) to label partitions.
Setting Up a Dual-Boot System
A dual-boot system is one that can boot one of two operating systems. Dual-boot in this section refers to a system that can boot Windows or Linux. The biggest problem in setting up a dual-boot system, assuming you want to add Linux to a Windows system, is finding disk space for Linux. The Linux+WindowsNT mini-HOWTO covers installing Linux first and Windows NT second or the other way around. The next section discusses several ways to create the needed space.
Creating Free Space on a Windows System
Typically, you install Red Hat Linux in free space on a hard disk. In order to add Red Hat Linux to a Windows system, you must provide enough free space (refer to "Disk space" on page 25) on a hard disk that already contains Windows. There are several ways to provide/create free space. Following are some ways, from easiest to most difficult:
If there is sufficient free space on the Windows disk, you can install Linux there. This technique is best, but there is rarely enough free space on an installed hard disk.
Add another disk drive to the system and install Linux on the new disk, which contains only free space. This technique is very easy and clean but requires a new disk drive.
If you can delete a big enough Windows partition, you can install Linux in its place. In order to delete a Windows partition, you must have multiple partitions under Windows and be willing to lose any data in the partition you delete. In many cases, you can move the data from the partition you delete to another Windows partition.
Once you are sure a partition contains no useful information, you can use Disk Druid to delete it when you install Linux: From the Disk Partition screen (page 49), choose to partition the disk with Disk Druid manually, highlight the partition you want to delete, and click the Delete button. After deleting the partition, you can install Red Hat Linux in the free space left by the partition you removed.
Installing Red Hat Linux as the Second Operating System
After creating enough free space on a Windows system (previous section), start installing Red Hat Linux. When you get to the Disk Partitioning Setup screen (page 49), you must choose manual partitioning if you need to delete a Windows partition. You can choose either automatic or manual partitioning if you already have free space to install Red Hat Linux in. If you partition the disk automatically, choose to keep all partitions and install Red Hat Linux in free space (page 27). If you partition the disk manually, use Disk Druid (page 53) to delete the appropriate Windows partition if necessary and create the Red Hat Linux partitions in the free space. When you boot, you will be able to choose which operating system you want to run.