Partitioning Schemes
From CLFS-HINTS
There are many different ways to partition drives for a Linux system. It depends on what the system is going to be used for, drive sizes, number of users, if a standalone system... We are going to look at the differnt common partitions used, and some typical partitioning scheams for the different systems.
Contents |
Explanation of the different common partitions
The root Partition
The root partition is the main partion. If there are no other partitions in the system, then all data is stored here.
The swap Partition
Swap partitions are used to support virtual memory. In other words, data is written to a swap partition when there is not enough RAM to store the data your system is processing. The general thumbrule regarding the size of your swap partition is that it should be equal to twice your computer's RAM.
For example, if you have 1GB of RAM or less, your swap partition should be at least equal to the amount of RAM on your system, up to two times the RAM. For more than 1GB of RAM, 2GB of swap is recommended. Creating a large swap space partition will be especially helpful if you plan to upgrade your RAM in the future.
There is some contention on this thumbrule lately as the amount of RAM increases well beyond 1GB even in low-end desktop machines. If you're just reading your e-mail, browsing the internet, writing a letter to get a refund for that other operating system that was preinstalled and you don't need, and listening to some music on a machine with 1GB of RAM, you can likely get by with 512MB or even 256MB of swap space. On the other hand if you are simulating a large repairable system with a 20-year useful life, studying the effect of four variates with two levels for each variate, and estimating system uptime hourly on the same machine, 2X's RAM is likely going to be necessary for your swap. You can always create more swap partitions in the future, but even 2GB isn't a large amount disk space to lose these days with 80GB, 120GB, 160GB, and 250GB hard drives being pretty common and inexpensive.
If you have more than one physical hard drive in your system, you can create multiple swap partitions. This can improve the performance of swapping by taking advantage of parallel disk access. For example, on a 1GB system with four drives, you might create four 512MB swap partitions, for a total of 1GB RAM and 2GB swap.
A Partition for /boot
The partition mounted on /boot contains the Linux kernel or kernels, along with files used during the bootstrap process. Having /boot mount on a seperate partition allows it to be unmounted after the Linux kernel is loaded and the files in /boot are no longer required for system operation. This prevents these important files from corruption, inadvertent deletion, etc.
On a multi-distro machine, all of the distributions can share the same partition for /boot. Creating subdirectories within /boot for each distro's kernel and related files keeps things tidy. For example, one CLFS user has the following structure in his /boot directory.
/boot/clfs ---> CLFS Kernels, kernel configuration files, and System maps /boot/gentoo ---> Gentoo Kernels, kernel configuration files, and System maps /boot/grub ---> files needed for the bootstrap process
A Partition for /home
Mounting /home on a partition seperate from the root partition prevents you from losing your important data in the event you need to or want to reinstall the system. This is true for a single-user home desktop or a server hosting shell accounts for the CLFS and CBLFS developers. How large you make this partition depends on how many users you expect to have and what types of files will be stored there. If you expect a large number of audio and video files to be stored in your user's home directories, then you would need to make this partition rather large.
A Partition for /usr
This should be the largest partition, because most of the binary files required by Linux, as well as any locally installed software, web pages, Squid proxy cache, Samba share services, some locally-installed software log files, etc. are stored here.
A Partition for /var
The /var directory is used for a great deal of runtime storage, including mail spools, logs, print jobs, process locks, etc. Having this directory mounted under / (root) may be a bit dangerous because a large amount of incoming e-mail, for example, may suddenly fill up the partition. Having /var on its own partition may avoid such problems.
Examples of Other CLFS Users' Partitioning
Some CLFS users' partitioning schemes are listed below for you to get an idea of how others perform this task.
Weibullguy's Partitioning
This is a desktop machine used by Weibullguy and only Weibullguy. It is used to perform simulations of repairable systems to estimate system availability, reliability, maintainability, and other statistics. Each simulation can encompass billions of calculations and typically require 25-40 hours to complete. There is 1GB of RAM and due to the use of the machine, there is an equal amount of swap. However, in only one situation has more than about 256MB been used.
The partition mounted at /multimedia contains music and video files, hence the large size. A separate partitions is mounted at /srv primarily because this is where the MySQL databases reside that are used to hold large amounts of data used in Weibullguy's study of system behavior. The root partition is fairly large to allow room to build and install packages while writing instructions for the CBLFS Wiki.
| Partition | Nominal Size | Mount Point |
|---|---|---|
| /dev/hda1 | 256MB | /boot |
| /dev/hda2 | 1GB | swap |
| /dev/hda5 | 24GB | / |
| /dev/hda6 | 10GB | /home |
| /dev/hda8 | 24GB | /multimedia |
| /dev/hda7 | 5GB | /srv |
| /dev/hda9 | 10GB | /usr/src |
Return to Main Page
