Linux Know-How provides a collection of introductory texts on often needed Linux skills.


Harddisk partitioning

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 file system 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 file systems 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 ("file systems") 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 file systems are the ones that you are more likely to use. Other file systems (not listed below) are available as add-ons (for example journaling file systems, compressed, encrypted, ...).

minix is the file system used in the Minix operating system, the first to run under Linux. It has a number of shortcomings: a 64MB partition size limit, short filenames, a single time stamp, etc. It remains useful for floppies and RAM disks.
ext is an elaborate extension of the minix file system. It has been completely superseded by the second version of the extended file system (ext2) and will eventually be removed from the kernel.
ext2 is the high performance disk file system used by Linux for fixed disks as well as removable media. The second extended file system was designed as an extension of the extended file system (ext). ext2 offers the best performance (in terms of speed and CPU usage) of the file systems supported under Linux. In short, ext2 is the main (default, typical) Linux file system.
ext3 is an extension of the ext2 file system with journaling. It is backwards and forward compatibile with ext2. It means that ext2 can be converted into ext3 without reformatting or data loss (just re-mounting the partion is required). ext3 can be changed back to ext2, also without data loss. I use ext3 extensively since Oct.2001--it is simple and trouble-free. It is included as an installation "option" since RedHat 7.2 and Mandrake 8.0. It is highly recommended that you use this file system.
xiafs was designed and implemented to be a stable, safe file system by extending the Minix file system code. It provides the basic most requested features without undue complexity. The xia file system is no longer actively developed or maintained. It is used infrequently.
msdos is the file system used by DOS, Windows, and some OS/2 computers. msdos filenames can be no longer than 8 characters followed by an optional period and 3 character extension.
umsdos is an extended DOS file system used by Linux. It adds capability for long filenames, UID/GID, POSIX permissions, and special files (devices, named pipes, etc.) under the DOS file system, without sacrificing compatibility with DOS.
vfat is an extended DOS file system used by Microsoft Windows95 and Windows NT. VFAT adds capability for long filenames under the MSDOS file system.
proc is a pseudo-file system which is used as an interface to kernel data structures rather than reading and interpreting /dev/kmem. In particular, its files do not take up disk space. See man 5 proc.
iso9660 is a CD-ROM file system type conforming to the ISO 9660 standard. Two extensions (listed below) are automatically supported.
High Sierra Linux supports High Sierra, the precursor to the ISO 9660 standard for CD-ROM file systems. It is automatically recognized within the iso9660 file system support under Linux.
Rock Ridge Linux also supports the System Use Sharing Protocol records specified by the Rock Ridge Interchange Protocol. They are used to further describe the files in the iso9660 file system to a UNIX host, and provide information such as long filenames, UID/GID, POSIX permissions, and devices. It is automatically recognized within the iso9660 file system support under Linux.
hpfs is the High Performance file system, used in OS/2. This file system is read-only under Linux due to the lack of available documentation.
sysv is an implementation of the SystemV/Coherent file system for Linux. It implements all of Xenix FS, SystemV/386 FS, and Coherent FS.
nfs is the network file system used to access disks located on remote computers.
smb is a network file system that supports the SMB protocol, used by MS Windows for Workgroups, Windows NT, and Lan Manager. To use smb fs, you need a special mount program, which can be found in the ksmbfs package, found at ftp://sunsite.unc.edu/pub/Linux/system/file systems/smbfs. [Standard linux command "smbmount" will also do.]
ncpfs is a network file system that supports the NCP protocol, used by Novell NetWare.
devpts is a pseudo file system, traditionally mounted on /dev/pts. In order to acquire a pseudo terminal, a process opens /dev/ptmx; the number of the pseudo terminal is then made available to the process and the pseudo terminal slave can be accessed as /dev/pts/<number>.
fat is not a separate file system, but a common part of the msdos, umsdos and vfat file systems.
UFS is a file system widely used in different operating systems.
swap is a special partition type used for swapping data from memory to hard drive.
raiserfs is a brand new journaling file system available as standard with Linux kernel version 2.4.1 up (January 2001).
hfs (=hierarchical files system)--MacIntosh file system. It is a late beta version., i.e., not recommended for use with critical data, unless read-only.
ntfs MS Windows NT file system. It is still "experimental" under Linux, i.e. not recommeded for production machines, unless read-only (Aug.2001).


Last Update: 2010-12-16