Section 2.5. Design Your System


[Page 28]

2.5. Design Your System

Now that you've decided what distribution and what tools to put on your system, you should think about how to lay out the file system(s). It is possible to simply install Linux from a CD-ROM, take all the default sizes and placements of components, and get a running system. But you'll be happier later if you take a few minutes to think about what you need from your Linux system and design an appropriate plan.

2.5.1. How Do You Want To Run Linux?

The ideal situation is that you have a PC that you no longer use and can put Linux on it. This way you don't risk losing any data by doing something wrong during the installation of Linux. Used computer stores sell older models at a fraction of the price of a new system. If you already have or can justify buying a spare system, I would strongly recommend going with a completely separate system. However, this is not always possible. If you must use a PC that already runs Windows, you have several different options.

Some distributions can run Linux "live" off a CDKnoppix, Linspire, MEPIS, and SuSE, to name but a few. Be sure the distribution you choose supports running directly from the CD without having to install files on the system.

Another option is to run Linux from within Windows. A commercial product called VMware (www.vmware.com) can emulate PC hardware, allowing you to install Linux running under VMware.

The most likely option is that you will install Linux on your system alongside Windows. If you install Linux along with any other operating system, you create a dual-boot system, because you can boot one of two different operating systems. You can also put multiple distributions of Linux on a system (if you have enough disk space) and create a multiboot system.

WARNING: Only create a dual-boot system if you have the media to enable you to reinstall your original system should it become necessary, and be sure to back up everything on your existing system first! If you make a mistake during the Linux installation, it is possible to wipe out everything on the system, including any existing operating system and data. If you could not reinstall and restore your original system on an empty disk, you should not attempt to create a dual-boot system!

2.5.2. Disk Partitioning

If you plan to install Linux software on your hard drive, you will need to create one or more partitions on the disk. A partition is an area of the disk that is treated as a separate unit. The disk may contain only one partition (the whole disk) or it may be divided into smaller units.

Partitioning a disk is, without question, the most intimidating step of the installation process. If you are trying to keep existing data already on your computer (like an existing Windows partition, for example), it is also the most dangerous. When setting up one or more partitions for Linux to use, you must be careful to avoid overwriting any existing data you wish to preserve.

Every disk drive has a partition table, where information about each partition is stored. Most partition tables allow four entries.


[Page 29]
2.5.2.1. Partition Types

Most disk drives support two types of partitions: primary and extended (or logical) partitions. A primary partition has an entry in the partition table and points to a fixed area on the disk. An extended partition has an entry in the partition table but points to a group of one or more logical partitions. This is useful when you need more than the four partitions that a partition table could support.

You can use either type of partition: to Linux they all work the same. Some partitioning tools don't even show you the difference between primary and extended partitions, they just start using extended partitions when it becomes necessary.

2.5.2.2. Partitioning for Linux

A Linux file system is a hierarchical grouping of names beginning at the root ( / ) of a directory tree. This is known as the root file system. The simplest partitioning for a Linux system is to put the entire root file system in a single partition. You also have the option of creating other partitions for parts of the Linux file system, as we'll see later.

One other partition is required on a Linux system, a swap partition. This partition is used by the virtual memory manager to swap data in and out of memory while the system is running. This is not a file system but rather a raw area on disk in which the kernel can "scribble." This partition is typically 1.52 times the size of the amount of real memory in your system. For example, if your system has 256 MB of memory, your swap partition should be at least 256 MB, but performance will improve if you make it 384 MB or more.

If you have two empty disk drives on your system, you can create swap partitions, each of half the total required size, on each disk. This spreads the swapping activity across different devices and will speed things up somewhat. In this case, any single swap partition should still be big enough to be useful to the system, so don't make them smaller than 64 MB, even if together they will add up to more swap space than you think you need.

If you have two disk drives, but you know one is substantially faster than the other one, use the faster one for the swap partition if possible.

If you dual-boot or multiboot a system with more than one distribution of Linux, you can create just one swap partition on the system and configure all the Linux distributions to use that same partition. Nothing is stored in a swap partition, it is simply an area where the memory manager can write while Linux is running, and since only one distribution of Linux will be running at any one time, they can all use the same swap partition.

2.5.2.3. Partitioning for Linux and Windows

If you must install Linux on a system where Windows is already installed, then you can only create Linux partitions out of free space that Windows is not using. Most Windows systems are installed using all of the disk space on the system, though, so this will be your first problem: how do you free up disk space and make it available to Linux?

If you are really lucky, you have (or could put) a second disk drive in your system. If you have a spare disk drive that Windows is not currently using, then you have a place to put Linux and you don't need to worry about changing anything on the Windows disk drive (however, you still must be very careful that you don't accidentally do anything to the Windows drive during the Linux installation process). Many PCs, however, have only one large disk drive, in which case, you must create your Linux partitions on the same disk drive. This will involve shrinking the existing Windows partition to make room, as we'll see a bit later.


[Page 30]

2.5.3. Linux File Systems

A partition is merely an area on the disk drive that can hold data. For Linux to be able to read and write directories and files, a partition must contain a file system. A file system is a data infrastructure that keeps track of file names and their associated data blocks in a hierarchical structure that makes it easy for humans to navigate around. For the purposes of installing Linux, it is not necessary to have more than a high-level understanding of what a file system is and how it works. Most distributions of Linux come with several different file systems from which to choose.

2.5.3.1. Types of File Systems

Many different file system implementations exist, each with its own advantages and disadvantages for certain types of operations. For example, a journaling file system maintains transaction information about file operations to increase integrity of the file system in the event of a system failure.

All Linux distributions support these common file systems:

  • ext2 the Second Extended file system, the standard Linux file system (listed in some setup programs as "native Linux")

  • ext3 a journaling version of ext2, faster and more reliable

Many distributions include one or more alternate journaling file systems:

  • IBM JFS IBM's journaling file system

  • ReiserFS Hans Reiser's high-performance journaling file system

  • XFS SGI's journaling file system

You may choose any file system available in your distribution's installation program. Most people choose ext2 (linux native) or ext3 unless they have a preference or a need for one of the more specialized file systems.

2.5.3.2. Organization of File Systems

The Linux directory tree, beginning at the root ( / ), is made up of one or more file systems. The important issue for installation is how, if at all, you want to divide your Linux file system across your available partitions. You may put all your files in the root ( / ) file system, create a second partition for the swap partition, and run with only those two partitions. This works fine for most individual workstations. Depending on your intended use of the system, however, you might want to separate certain directories into their own partitions. When you separate a directory onto its own partition, it is connected into the root directory at a mount point, a directory in the root file system.


[Page 31]

The Linux boot files are stored in the /boot directory. This directory is sometimes put in its own small partition to guarantee it stays located at the beginning of a disk drive. This is mostly a historical requirement for old boot hardware that could only read a limited area of the disk and is usually not an issue today.

On a system with many users (such as a server), home directories are often created in a standard place like /home. If /home is part of the root file system, then users can fill up your system's root disk. If you make /home a separate file system and then mount that file system, it looks the same to the users, but they can only fill up that partition, not the root file system. If users do fill up /home, the root file system will still have space, so the system itself will continue to run fine. Users will no longer be able to create new files, but that is a less severe problem than the system's being unable to create new files.

System directories that are used for a lot of temporary data are also good candidates for separate file systems. The /var directory is used to store data such as files to be sent to printers and e-mail messages as they are sent and received. If /var is a separate partition, then these processes won't fail if other partitions are full. The /tmp directory is another place for temporary files that could be segregated from the rest of the system this way, in case some program went crazy creating files.

Even system directories like /usr and /opt, where system files and optional software may be installed, could be put in separate partitions. Of course it is more work to set up separate partitions, but depending on your system usage, it could be worth the effort.

2.5.3.3. Size of File Systems

It is hard to say exactly how much space you'll need for various Linux file systems. A good rule of thumb for /boot (if you make it a separate partition) is at least 10 MB. It only stores files required for booting (the kernel and associated files) so it doesn't require much space.

The minimum amount of space in which you would ever want to install Linux would be about 500 MB, and so the smallest root file system ( / ) you would want would be about that. The more optional software you add, the bigger you'll want this file system (see Figure 2-2 earlier in this chapter).

If you split the entire file system across multiple partitions, you should still never make the root smaller than 500 MB. How big you make the other partitions (especially a directory for users' home directories) is mainly a factor of how much disk space you have available.

2.5.3.4. Sharing File Systems

If you plan to dual-boot your system with Windows or another distribution of Linux, there are a couple of miscellaneous issues you should keep in mind.

Windows partitions can be mounted and read by Linux. Some file systems can be mounted read-write, some can only be mounted read-only. I would recommend you mount any Windows file system read-only so that files are not accidentally altered.

Do not share /boot partitions between different distributions of Linux. Linux expects to be able to write what it needs in /boot, including files that may have the same names between different distributions, so one distribution could overwrite files (e.g., the kernel) of another distribution.


[Page 32]

2.5.4. Boot Loaders

What we refer to as "booting" a computer derived from the word "bootstrap" (as in, to pull yourself up by your bootstraps). The hardware knows how to load a small program from a known location and execute it. That program, in turn, knows where the "real" operating system is located and loads it.

When the boot process starts, the computer loads the contents of the Master Boot Record (MBR) from the first sector of the first disk and executes that program. On a Windows machine, this program then loads Windows, and your PC boots up. On a Linux machine, it's more or less the same. The Linux boot loader program loads the kernel, and Linux boots up.

Most distributions of Linux come with a choice of boot loaders: the original, LILO (the LInux LOader), and the more recent GRUB (the GNU GRand Unified Boot loader). Both do basically the same job: they create boot code to allow you to boot one or more operating systems. Both can install themselves in the MBR, in the first sector of the root partition, or on a floppy disk.

If you install the boot code into the MBR, you will overwrite whatever boot code is already there (e.g., Windows boot code). GRUB and LILO both preserve the option to boot Windows in their boot menus, but I would recommend against altering the MBR if you plan to continue to boot Windows in addition to Linux.

If you install the boot loader to the first sector of the root drive, you still depend on the Windows boot code to find it and transfer control to it. Windows code is notorious for "not playing well with others," and for this reason, I would not recommend this option.

If you plan to dual-boot your Linux system with Windows, you can install the boot loader on the floppy drive (usually /dev/fd0). This removes the need to install a boot loader on your hard drive, and you can leave the Windows boot code in the MBR as it is. When you want to boot Linux, put the floppy with the boot loader into the floppy drive and boot, but if the floppy is not in the drive, Windows will boot. This is by far the safest way to configure a dual-boot system. Be sure to specify /dev/fd0 as the boot location when installing the boot loader in the installation process in this case.

If you are installing a single distribution on a system by itself, then you probably won't be changing the boot loader information, you'll just keep what the installation sets up to boot Linux. If you are installing a multiboot system, you may modify the boot loader information from time to time as you install other operating systems.

2.5.5. Boot Floppy

During the Linux installation process of most distributions, you have the option of creating a boot floppy (you can also create it with the mkbootdisk[2] command after Linux is running). This is a floppy disk that can be used to boot Linux in the case of a system crash or other failure that damages the boot sector of your hard drive. You should always make the boot floppy. You may never use it, and it may seem unnecessary, but it only takes a few minutes, and if you ever need it and don't have it, you could wind up reinstalling your entire system. A boot floppy is a cheap insurance policy.

[2] SuSE has removed mkbootdisk and provides this function through the YaST console.


[Page 33]

Here's my personal story for recommending making a boot floppy. One of the systems I built in preparation to write this Linux edition was a dual-boot system with Mandrake Linux and Windows XP. Everything was working fine until one day I powered up the system and got the message "Lilo timestamp mismatch" and then nothing; no boot menu, no Windows, and no Linux. I couldn't reinstall LILO since I couldn't boot Linux. Because I hadn't made a boot floppy (this was a test system, after all), I had to reinstall both Windows and Linux. Don't let this happen to a system you care about!

You can also use a boot floppy to boot Linux instead of a floppy with a boot loader installed. The floppy disk contains somewhat different information in this case, but the end result is the same. A boot floppy allows you modify kernel parameters and location in the event a "normal boot" is not working because of a failure. But the default behavior is to boot the kernel on your hard drive just like a boot loader.




Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net