Next Up Previous Contents Index
Disk Partitions

2.7 Disk Partitions

Please Note: If you intend to perform a workstation- or server-class installation, and you already have sufficient unpartitioned disk space available, you don't need to read this section, and may turn to Section 2.8. Otherwise, please read this section in order to determine the best approach to freeing disk space for your Red Hat Linux installation.

In order to install Red Hat Linux, you must make disk space available for it. This disk space needs to be separate from the disk space used by other operating systems you may have installed on your computer, such as Windows, OS/2, or even a different version of Linux.

A disk can be divided into different partitions. Each partition can be accessed as if it was a separate disk. Furthermore, each partition has a type that is used to indicate how information is stored in the partition. For example, there are different partition types used by DOS, OS/2, and Linux.

Please Note: You must install Red Hat Linux to one or more partitions having a partition type of ``Linux native''. Red Hat Linux also requires a swap partition, which has a partition type of ``Linux swap''. This means that an installation of Red Hat Linux requires at least two partitions:

We will discuss partitioning issues in more detail below. For now, keep in mind that Red Hat Linux requires at least two dedicated partitions, and that you cannot install Red Hat Linux to a DOS/Windows partition!

Even if you will be installing Red Hat Linux on its own hard disk, or on a computer which contains no other operating system, you'll still need to create partitions for Red Hat Linux to use. In this case it's pretty easy, as there are no other partitions on the hard disk to worry about.

On the other hand, you may wish to install Red Hat Linux on a disk which already contains software or data from a different operating system. Things can get a little trickier in this situation, since a mistake can destroy your existing partitions, not to mention the data they contain!

During the installation process, you'll be given the chance to create partitions for Red Hat Linux. At this point, your main concern is making sure you have sufficient disk space available to create those partitions. Let's review the different ways to free up space for Red Hat Linux partitions.

2.7.1 Partition Naming Scheme

Linux refers to disk partitions using a combination of letters and numbers which may be confusing, particularly if you're used to the ``C drive'' way of referring to hard disks and their partitions. Red Hat Linux uses a naming scheme that is more flexible and conveys more information than the approach used by other operating systems. Here is a summary:

First Two Letters -- The first two letters of the partition name indicate the type of device on which the partition resides. You'll normally see either hd (for IDE disks), or sd (for SCSI disks).

The Next Letter -- This letter indicates which device the partition is on. For example,
/dev/hda (the first IDE hard disk) or /dev/sdb (the second SCSI disk).

The number The final number denotes the partition. The first four (primary or extended) partitions are numbered 1 through 4. Logical partitions start at 5. E.g., /dev/hda3 is the third primary or extended partition on the first IDE hard disk; /dev/sdb6 is the second logical partition on the second SCSI hard disk.

Keep this information in mind; it will make things easier to understand when you're setting up the partitions Red Hat Linux requires.

2.7.2 Repartitioning Strategies

There are three possible scenarios you may face when attempting to repartition your hard disk:

Let's look at each scenario in order.

2.7.2.1 Using Unpartitioned Free Space

In this situation, the partitions already defined do not span the entire hard disk, leaving unallocated space that is not part of any defined partition. If you think about it, an unused hard disk also falls into this category; the only difference is that all the space is not part of any defined partition.

In this case, you can simply create the necessary partitions from the unused space.

2.7.2.2 Using Space From An Unused Partition

Last year you replaced that tiny 105MB hard drive on your Windows system with a 1.2GB monster. You partitioned it into two equal parts, figuring that you'd use the C: ``drive'' (really the drive's first partition) for Windows, and the D: ``drive'' (really the drive's second partition) for your collection of freeware programs downloaded from the Internet. Well, you'd been so used to using C: that you never put anything of substance on D:.

If you find yourself in this situation, you can use the space allocated to the unused partition. In this case, you'll first need to delete the partition, and then create the appropriate Linux partitions in its place. You can either delete the partition using DOS fdisk, or you'll be given the opportunity to do so during a custom-class installation.

2.7.2.3 Using Free Space From An Active Partition

This is the most common situation. It is also, unfortunately, the hardest to deal with. The main problem is that you have enough free space, but it's presently allocated to a partition that is in use. If you purchased a computer with pre-installed software, the hard disk most likely has one massive partition holding the operating system and data.

Aside from adding a new hard drive to your system, you have two choices:

Destructive Repartitioning -- Basically, you delete the single large partition, and create several smaller ones. As you might imagine, any data you had in that partition is destroyed. This means that making a complete backup is necessary. For your own sake, make two backups, use verification (if available in your backup software), and try to read data from your backup before you delete the partition. Note also that if there was an operating system of some type installed on that partition, it will need to be reinstalled as well.

After creating a smaller partition for your existing software, you can reinstall any software, restore your data, and continue with your Red Hat Linux installation.

Non-Destructive Repartitioning -- Here, you run a program that does the seemingly impossible; it makes a big partition smaller without losing any of the files stored in that partition. Many people have found this method to be reliable and trouble-free. What software should you use to perform this feat? There are several disk management software products on the market; you'll have to do some research to find the one that is best for your situation.

[Intel Systems: As a convenience to our customers, we provide the fips utility. This is a freely available program that can resize FAT (File Allocation Table) partitions. It's included on the Red Hat Linux/Intel CD-ROM in the dosutils directory.

Please Note: Many people have successfully used fips to repartition their hard drives. However, because of the nature of the operations carried out by fips, and the wide variety of hardware and software configurations under which it must run, Red Hat Software cannot guarantee that fips will work properly on your system. Therefore, no installation support whatsoever is available for fips; use it at your own risk.

That said, if you decide to repartition your hard drive with fips, it is vital that you do two things:

Should use decide to use fips, be aware that after fips runs you will be left with two partitions: the one you resized, and the one fips created out of the newly-freed space. If your goal is to use that space to install Red Hat Linux, you should delete the newly-created partition, either by using fdisk under your current operating system, or while setting up partitions during a custom-class installation. ]

2.7.3 Disk Partitions and Other Operating Systems

If your Red Hat Linux partitions will be sharing a hard disk with partitions used by other operating systems, most of the time you'll have no problems. However, there are certain combinations of Linux and other operating systems that require extra care. Information on creating disk partitions compatible with other operating systems is available in several HOWTOs and Mini-HOWTOs, available on the Red Hat Linux CD in the doc/HOWTO and doc/HOWTO/mini directories. In particular, the Mini-HOWTOs whose names start with Linux+ are quite helpful.

[Intel Systems: If Red Hat Linux/Intel will coexist on your machine with OS/2, you must create your disk partitions with the OS/2 partitioning software---otherwise, OS/2 may not recognize the disk partitions. During the installation, do not create any new partitions, but do set the proper partition types for your Linux partitions using the Linux fdisk.]

2.7.4 One Last Wrinkle: Using LILO

[Intel Systems: LILO (the LInux LOader) is the most commonly used method to boot Red Hat Linux on Intel-based systems. Being an operating system loader, LILO operates ``outside'' of any operating system, using only the Basic I/O System (or BIOS) built into the computer hardware itself. This section describes LILO's interactions with PC BIOSes, and is specific to Intel-compatible computers. ]

[Alpha Systems: Alpha owners may skip ahead to Section 2.7.5.]

[SPARC Systems: SPARC owners may skip ahead to Section 2.7.5.]

2.7.4.1 BIOS-Related Limitations Impacting LILO

LILO is subject to some limitations imposed by the BIOS in most Intel-based computers. Specifically, most BIOSes can't access more than two hard drives and they can't access any data stored beyond cylinder 1023 (the 1024th cylinder) of any drive. Note that some recent BIOSes do not have these limitations, but this is by no means universal.

All the data LILO needs to access at boot time (including the Linux kernel) are located in the /boot directory, which is normally part of the root partition (known as /). Here are the guidelines you must follow if you are going to use LILO to boot your Red Hat Linux system:

On First Two IDE Drives -- If you have 2 IDE (or EIDE) drives, /boot must be located on one of them. Note that this two-drive limit also includes any IDE CD-ROM drives on your primary IDE controller. So, if you have one IDE hard drive, and one IDE CD-ROM on your primary controller, /boot must be located on the first hard drive only, even if you have other hard drives on your secondary IDE controller.

On First IDE Or First SCSI Drive -- If you have one IDE (or EIDE) drive and one or more SCSI drives, /boot must be located either on the IDE drive or the SCSI drive at ID 0. No other SCSI IDs will work.

On First Two SCSI Drives -- If you have only SCSI hard drives, /boot must be located on a drive at ID 0 or ID 1. No other SCSI IDs will work.

Partition Completely Below Cylinder 1023 -- No matter which of the above configurations apply, the partition that holds /boot must be located entirely below cylinder 1023. If the partition holding /boot straddles cylinder 1023, you may face a situation where LILO will work initially (because all the necessary information is below cylinder 1023), but will fail if a new kernel is to be loaded, and that kernel resides above cylinder 1023.

As mentioned earlier, it is possible that some of the newer BIOSes may permit LILO to work with configurations that don't meet our guidelines. Likewise, some of LILO's more esoteric features may be used to get a Linux system started, even if the configuration doesn't meet our guidelines. However, due to the number of variables involved, Red Hat Software cannot support such extraordinary efforts.

Please Note: Disk Druid as well as the workstation- and server-class installs take these BIOS-related limitations into account. However, if you decide to use fdisk instead, it is your responsibility to ensure that you keep these limitations in mind.

2.7.5 How Many Partitions?

Although you can install Red Hat Linux in a single large partition (subject to any of the partitioning considerations we've mentioned so far), it's a much better idea to split things up a bit. We recommend the following layout as a compromise between single-partition simplicity, and multi-partition flexibility:

Please Note: If you plan to install all the software packages that come with Red Hat Linux, you will need to use the larger partitions sizes shown here. In fact, you may want to increase the sizes above our recommendations, to allow for future growth without needing to repartition.

A swap partition -- Swap partitions are used to support virtual memory. If your computer has 16 MB of RAM or less, you must create a swap partition. Even if you have more memory, a swap partition is still recommended. The minimum size of your swap partition should be equal to your computer's RAM, or 16 MB (whichever is larger). The largest useable swap partition is roughly 127 MB, so making a swap partition larger than that will result in wasted space. Note, however, that you can create and use more than one swap partition (although this is usually only necessary for large server installations).

A root partition -- The root partition is where / (the root directory) resides. It only needs to contain things necessary to boot your system, as well as system configuration files. A root partition of 50 MB to 100 MB works well for most systems.

[Intel Systems: Don't forget the LILO constraints we mentioned in Section 2.7.4!]

A /usr partition -- The /usr partition is where much of the software on a Red Hat Linux system resides. This partition should be between 300 MB and 700 MB, depending on how many packages you plan to install. If at all possible, try to be generous with the /usr partition. Any RPM-based packages you install later will (in general) use more space from /usr than from any other partition.

A /home partition -- This is where users' home directories go; the size of /home depends on how many users you plan to have on your Red Hat Linux system and what they might store in their home directories.

[Alpha Systems: The following partition is specific to Red Hat Linux/Alpha installations.]

A MILO partition -- Alpha owners that will be using MILO to boot their systems should create a 1.5 MB DOS partition where MILO can be copied after the installation is complete.

Additionally, your circumstances may warrant creating one of more of the following partitions:

A /usr/local partition -- Traditionally, /usr/local has been used to hold things you wish to keep separate from the rest of your Red Hat Linux system, such as software that is not available as an RPM package. The size depends on the amount of such software you anticipate putting on your system.

A /usr/src partition -- There are two things that normally are stored in /usr/src on a Red Hat Linux system:

Linux Kernel Sources -- The complete sources for the Linux kernel are stored here, and new kernels are built here. At present, the kernel sources are approximately 30MB in size. Keep in mind that you'll want to have additional free space for building kernels, and you may want to keep more than one version of the kernel available.

Sources For RPM-Based Packages -- If a source package file (aka SRPM) is installed, the files are stored here. Note that, unless specified otherwise, any packages built will also use a build directory located here.

Again, the size of this partition would depend on the amount of software you anticipate building.

A /tmp partition -- As the name implies, the /tmp partition is for temporary files. Creating a partition dedicated to /tmp is a good idea for larger, multiuser systems or network server machines. The reason is that many active users can fill the root partition (/), which is where /tmp is located. It's not necessary to dedicate a partition to /tmp on single-user workstations.

A /var partition -- Your Red Hat Linux system will write to log files in /var/log. Files queued for printing will normally be written to /var/spool. These are just two examples of data that is written to /var. Unless otherwise configured, /var will be part of the root filesystem, and normally will not have much available free space. If you anticipate a lot of print, mail, or log activity on your system, you might want to consider creating a partition dedicated to /var. In general, only multiuser or server systems would make effective use of a separate /var filesystem.

An /opt partition -- Some third-party software is designed to install itself under /opt. Unless an /opt partition is created, software that attempts to install itself under /opt will end up on the root partition, which may not have sufficient free space. Of course, this is not the only way of solving the /opt problem; it is also possible to create an /opt symbolic link to another partition with more space (such as /usr).

A /boot partition -- While many of the partitions mentioned here make sense only for very large, active systems, this partition might be very useful on a small system, where free space is tight. If you recall, back in Section 2.7.4, we discussed the various limitatons imposed by the standard PC BIOS, and how these limitations impact the LILO bootloader. All the files LILO needs to access (at boot time) are in the /boot directory. Since the files (including the Linux kernel) in /boot only take up a megabyte or so, if you're having trouble finding space for a 100 MB root partition in a place where LILO can get at it, you might have better luck trying to squeeze in a 5-10 MB (generously oversized) partition for /boot. You'll still need to create a root partition, but it can now be located anywhere on your system -- the BIOS restrictions only apply to the partition holding /boot.


Next Up Previous Contents Index