Perfect partitioning
The question about the ‘right’ partitioning scheme pops up quite regularly on mailing-lists. While I do not claim perfection, I try to explain here why there are different opinions on partition sizes. If you disagree with me on what I write here, please tell me, and I will incorporate your thoughts.
First, relax! If you find out after a while that you made mistakes when partitioning, you can still change it. See Re: My partition is full! Do I need to reinstall? for details.
While there is no such thing as ‘perfect partitioning’, there are (at least) 2 styles proposed in different tutorials. These do not really contradict each other, although they seem to do so:
3 Partitions:
/, swap and /home should be enough for the initial install, especially for new users. They should altogether be not too big, so there is space on the harddisk to try other distributions without hurting the main-distro.
/home will survive the re-installs while learning about the system, and swapspace should make up for having not enough RAM.
4-5GB for root is surely enough for any modern distribution.
This ‘big-root-philosophy’ is based on the following facts:
- Diskspace is cheap, new disks are HUGE.
- The initial install will not be the last
- It is possible to learn about the possibilities without using them all.
- Space-requirements are often not foreseeable, especially when learning a new OS.
- X11, OOo, and Mozilla are reality. Most people will want to use them. At least try them. So we need space to ‘breathe’ and flexibility among /usr, /var and /opt
Later, when the system is running, one can do some research on the actual requirements using the commands
df -h
and
du -sh
7 Partitions:
/, /boot, /home, /usr, /var, /tmp and /opt
With every partition speciallizing, / can get smaller. This makes it less prone to HW-damage.
A separate /boot makes multi-booting among several Linux-Versions easier.
This has also been discussed in OpenBSD-FAQ which also explains that the system can be made more secure that way. It lists some reason in favor of many partitions, but also states that if you go too close to the minimum-sizes, you will regret it later :)
Pros and Cons
This page has been created to end all flamewars concerning partitioning. It shall be a place where the pros and cons about putting specific directories in their own partition can be stated.
This page needs your help in order to be balanced.
If a partition you think should be mentioned is missing, post to the Mailing-List. We can discuss it, and then I can add another section to this document. You can also add a comment at the bottom of the page.
The proposed size should be explained shortly with a ‘real world’ example. No hypothetical cases for the sizes. Only “I have filled up 12TB because…” and “I have a system running with as little as 20KBbecause…”
So here we go:
/ (root)
- Purpose: The contents of the root filesystem must be adequate to boot, restore, recover, and/or repair the system.
- Why it should have a partition of its own: Just because. Can’t do without it. By definition.
- I have filled up as much as 4GB on a Suse 9.0 installation with KDE, OOo, Mozilla and other goodies. The root partition is the only partition (except swap) on that system. Data is stored on theserver.
- I have installed a minimal Suse 9.1 for testing purposes. It took less than 500MB
/boot
- Purpose: This directory contains everything required for the boot process except […]. Thus /boot stores data that is used before the kernel begins executing user-mode programs.
- Why it should have a partition of its own:
- Why it should not:
- I have filled up as much as…
- I only need as little as…
Swap
- Purpose: Provides space for Virtual Memory when RAM gets scarce.
- Why it should have a partition of its own: A swap-partition is faster than a swap-file
- Why it should not: Swap-files are much more flexible. If your system hits swap so often that the performance penalty hurts, you should buy more RAM.
- I have filled up as much as…
- I only need as little as none at all. I have a partition on my machine with 512MB RAM, but is not used, even if I have KDE, Mozilla, XMMS and VMware running. Just started OOo as a bonus:
Still no use for swap.
/home
- Purpose: Store users’ files and configurations. (FHS is quite vague on /home, but for our purpose, let’s assume user-files are stored exactly here.)
- Why it should have a partition of its own: User data is independent of system-crashes/reinstalls/updates and can be accessed from more than one OS on the computer. It can be used as backup-area for config files that should survive an update/reinstall.
- Why it should not: Configuration files are often OS-specific. So on system with only one (or some few) user and more than one OS to boot (→ Home systems), it might be better to store the files in a partition that is mounted elsewhere. (I guess that is why Suse creates a directory called ‘Documents’ inside every users home)
- I have filled up as much as 80GB (Lots of music on the disk)
- I only need as little as none at all (because I mount those 80GB from the server)
/usr
- Purpose: /usr is the second major section of the filesystem. /usr is shareable, read-only data. According to old notes (sorry, lost the link), usr is short for Unix System Resources.
- Why it should have a partition of its own:
- Why it should not: Having /usr, /var and /opt on separate partitions in order to keep root small makes the system unflexible.
- I have filled up as much as…
- I only need as little as…
/var
- Purpose: /var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
- Why it should have a partition of its own: /var contains things like e-mails, spooled print-jobs, logfiles. These things can get out of control in many ways. If they start filling up the root-partition, you could lock yourself out of the system. (from this post) Usually, linux-filesystems reserve 5% of the space for root, but if the program that fills the disk runs as root, you are out of luck. Hmm, I (rhk) expected that reservation was made at the initial installation–will it really prevent other users from using that 5% after the installation? And, what if, in the initial installation, root uses 5% of the space?
- Why it should not: Having /usr, /var, /tmp and /opt on separate partitions in order to keep root small makes the system unflexible.
- I have filled up as much as…
- I only need as little as…
/tmp
- Purpose: /tmp contains transient and temporary files.
- Why it should have a partition of its own: See Bryan Smith's superpost on filesystems. In short: Essential file-systems like root should not change often. /tmp does change often. So it should be separate.
- Why it should not: Having /usr, /var, /tmp and /opt on separate partitions in order to keep root small makes the system unflexible.
- I have filled up as much as…
- I only need as little as…
/opt
- Purpose: /opt is reserved for the installation of add-on application software packages.
- Why it should have a partition of its own:
- Why it should not: Having /usr, /var and /opt on separate partitions in order to keep root small makes the system unflexible.
- I have filled up as much as…
- I only need as little as…
/path/in/question
- Purpose:
- Why it should have a partition of its own:
- Why it should not:
- I have filled up as much as…
- I only need as little as…
Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.
Linux® is a registered trademark of Linus Torvalds.
tutorials/advanced/various/perfect_partitioning.txt · Last modified: 2008/07/20 19:08
Welcome to LinuxBasics.org - The online community that helps people to get Linux installed and running.
During this tour, we will guide you through our website, which has many facets which wait to be explored
The biggest project we are running is our Linux course, based on the LBook.
The book is stored in wiki-format, which enables us to update and correct it as we go.
Discussion for the course is on our Forum
Our Forum is used for discussion of Linux and for questions and answers.
Search the mailing-list that was used prior to the Forum.
The questions and answers from the list are stored in the list's archives in order to help others with the same problems.
Every weekend, we meet to chat in IRC. These meetings are NOT mandatory, but are a nice chance to get to know each other better.
IRC is also a great tool to solve many problems, since it is very quick and easy to ask for more details if you need them.
The tutorials are one of the oldest sections on the LBo-website.
Here you find explanations on how to do specific tasks in Linux. Many of the tutorials were created after a certain problem
has been discussed (and usually solved :) on the mailing-list.
The tutorials are categorized in
In the links section, you find outbound links to other valuable resources.
One of our later additions to the site. We maintain a mirror of the Linux Documentation Project. This is our contribution to the "home of the HOWTOs"
Another later addition is the LBlog which focuses on how to do stuff on the Linux Desktop. It begins with the basics on installing Ubuntu.
Using the integrated site-search, you can search the tutorials, the LBook and all other wiki-pages
Simply type the search term into the box in the upper-right corner of our webpages
As a community, we depend on your feedback and collaboration. So, if you have something to share with others, please contact us. If you have a suggestion for a topic you would like to see covered here, please add it on the Wishlist.
There are many ways to contribute: You can answer questions on the Forum, you can write a complete tutorial or just a step-by-step documentation on how you completed a specific task using linux. Ask questions if the information on this site is not clear, tell us if we got something wrong, spell-check our writings, whatever.
We are looking forward to meeting you at LinuxBasics.org
Anita, Jisao, Sam and Stefan