2.10 How do I partition my hard drive?

Before Linux installation, you might really want to know what a hard drive partition is. The concern is that you may delete your MS Windows partition when you really don't mean to--you want two separate partitions to dual boot. This means: MS Windows is on one partition, Linux is on a separate partition. You do not normally install Linux on free space on your MS Windows-allocated partition(s). It is possible to install Linux on a MS Windows partition, but we do not recommend it. If you delete a partition from hard drive, all the content on that partition is gone.

If you plan a dual boot (Linux and MS Windows on the same computer), first use your DOS/Win utility FDISK to make the MS Windows partition(s). Leave part (half?) of the hard drive(s) unpartitioned for Linux. You will create and format the Linux partitions during your RedHat (or Mandrake or whatever else) installation. Linux will recognize the free (unpartitioned) space on the hard drive and use it to create partition(s) in a non-Microsoft format.

Make the MS Windows partition "primary" and "bootable". Install, configure, and test your MS Windows before Linux installation. If you plan to run Linux only (no dual boot), you need just a clean hard drive (no partitions) to start with.

It is possible to have only one Linux partition (plus one for MS Windows if you dual-boot). But it is better to have more partitions so that you can keep users' data separate from the rest of the operating system. This way, if something ever goes wrong, or if you have to reformat or re-install the operating system, you don't lose the users' data. (You can perform a complete Linux re-install without losing the contents of the /home directory that contains all user data if you skip the "re-format" option given to you during installation. But for that, the /home directory must be on its own partition.)

During the Linux setup, you will be asked to partition the available space on your hard drive(s). There are many possible ways to partition, depending on your hard drive space, requirements, and taste. I like Linux hard drive partitions like this (for a modest total of 2 GB of hardrive space which I give to Linux in this example):

mount point type size

/ ext2 300 MB

/usr ext2 1200 MB

/home ext2 380 MB

swap swap 120 MB

In the above example, I dedicate 300 MB for the root partition that holds the base of the Linux operating system. I allocate 1200 MB to the mount point that will be visible on my filesystem as the /usr directory and will contain the user's programs (the programs that don't come with the base operating system and I install later, for example StarOffice). I dedicate 380 MB for the partition that will be visible as the directory /home and will contain the setting and data of all users on the machine. And I allocate 120 MB to a "raw" partition for the operating system to use as the virtual memory (extension of the physical, silicon memory on the hard drive, so-called swap). (If your Linux is ancient, kernel version lower than 2.2 as in RH5.2 and earlier, your swap partition cannot be larger than approximately 127 MB.) The rule of thumb is that the swap should be about twice the amount of the physical memory (RAM). If you need more (e.g. if you have lots of physical memory, or you expect to run custom programs with really large data structures) you might want to create a larger swap partition during the installation (or several smaller swap partitions) or add a swap file(s) later.

2 GB is a respectable amount of disk space and should be sufficient for users who like having many applications. (This is because Linux applications tend to be slimmer than their MS Windows equivalents). However, if you try to install everything that's available on the modern distribution CDs, you will surely run out of disk space. My experience is that however large the hard drive space, it will get filled and I regret I don't have more :-) .

If my space on the hard drive is really restricted, I may consider a two-partition setup like this (for a lean 650 MB total dedicated to Linux):

mount point type size

/ ext2 600 MB

swap swap 50 MB

In this example, I dedicate 600 MB to the base of the operating system, applications, and user documents/data, and allow 50 MB for the swap partition (for the operating system to use as the virtual memory). The 50-MB swap should be quite sufficient for medium duty operations. The limitation of 600 MB for the operating system, applications and user data means that you will have to be very selective as to which applications you install or else you risk running out of hard drive space. Try pressing <F1> when installing the optional software that comes on the Red Hat CD--it will give you a short description of what the software does so you could perhaps decide if you really need it. (Don't worry too much if you miss something you need, you can install the missing parts later). You can easily finish the RedHat installation with 200 MB free on your Linux partition (out of 600 MB used in this example) if you make reasonable choices. Please note that "bundling together" the root partition "/" and the /home directory will likely save you some disk space, but it is not the safest solution.

It is possible to install Linux on even less disk space than in the example above, but you will have to be really picky as to what you install.

For a larger available hard drive space, I nowadays (year 2002) consider the following setup (for a comfortable total of 15 GB dedicated to Linux):

mount point type size

/ ext2 800 MB

/usr ext2 5000 MB

/usr/local ext2 3000 MB

/home ext2 5200 MB

swap swap 1000 MB

Please note that the the mount points can reside on different physical hard drives. Linux agglomarates all the hard drive space into a single directory tree.

Another consideration when setting up the partitions on older computers (486?). Many older BIOSes have the restriction that the boot partition cannot extend beyond the 1024th cylinder on your first physical hard drive. To overcome this limitation, simply make the first (bootable) partition so that it ends before the cylinder number 1023 (this makes this partition max approximately 512 MB in size, which is plenty for the "/" root partition). Once Linux boots, the BIOS restriction does not matter any more because Linux takes over the hardware management and it can access the partition(s) beyond the cylinder number 1023.

When installing and using Linux, your drives appear as devices with the following names: hda--first IDE drive (stands for "hard drive a", i.e. the master drive on the first IDE interface), hdb--second IDE drive (i.e., the slave drive on the first IDE interface), hdc--third IDE drive (i.e. the master drive on the second IDE interface), hdd--fourth IDE drive (i.e. the slave drive on the second IDE interface). The numbers mean the partitions on the physical drives: "hda1" means the first IDE hard drive (hd a), first partition (1); "hda2" is the first IDE hard drive, second partition; "hda3"--the first IDE hard drive, third partition; (and so on if you have more than 3 partitions on the first IDE hard drive); "hdb1"--second IDE hard drive, first partition (or just "hdb" if it is the CDROM installed as a slave on your first IDE interface). "hdc1"--third IDE hard drive, first partition, etc. SCSI drives have analogous names but start with the letters "sd" (="SCSI drive"), followed by the letter indicating the SCSI interface and by the number indicating the SCSI device id. For example, "sda4" means "first SCSI interface, id number 4". If you have an external zip drive attached to your parallel port, it will appear as SCSI device "sda4" (zip drives work in a SCSI-emulation mode).

The listing of partitions that your Linux setup program presents to you during installation will include any MS Windows partitions which you have. For example, I have the following MS Windows partition:

mount point type size comment

[no mount] vfat 1200 MB ["Win C drive, hda1]

/mnt/dos_hdd2 vfat 1600 MB ["Win D drive, hdd2]

Don't erase these MS Windows partitions during your Linux installation if you want a dual boot. If you erase the MS Windows partition, MS Windows is gone from your system! If not sure, backup your data from your MS Windows partitions before Linux installation. "msdos", "fat" and "vfat" and "ntfs" are typical filesystems used by DOS and MS Windows 3.x/95/98/NT.

As a quick reference, here is a brief summary of the standard Linux partition types ("filesystems") with a short description. I copied the info from the Linux manual pages: man fs and man mount (with some additions after I had a look at the source code files at /usr/src/linux/fs). The underlined filesystems are the ones that you are more likely to use. Other filesystems (not listed below) are available as add-ons (for example journaling filesystems, compressed, encrypted, ...).



UNIXguide.net
Suggest a Site