In this article I am discussing the why and how of a disk-layout for UNIX-/Linux-systems.
NO SYSTEM RESOURCE SHOULD BE USED MORE THAN 70% EVER!
The data stored on computer systems are growing and they are more or less behaving like the ideal gas. This is the reason, why data can suffocate a system. When a system is running out of space, you end up with a message like “no space on device” and if this happens on the root partition, you have a problem.
So when designing the disk-layout the main idea that guides me is to prevent the root-partition from any data growth.
The nature of data
There is system-data which is very static and not subject to any mentionable growth. Directories like
are essential to run the operating system. I call them
system – critical – static
The operating system also requires a some space for data that grows. This is for instance
The system administrator should tightly monitor the partitions of an operating system installation, but what if he fails (for whatever reason) to do so?
When the operating system runs out of space on one of these three directories it will just stop logging or send a signal stop service when these three are on dedicated disk partitions. When the according directory is on the root partition, the operating system may stop its service entirely, thus causing you some real headache.
I call these three
system – volatile
Next we come to a problematic case: The /usr directory
The /usr directory actually should hold system programs that are not essential to booting the system. Hence this software can be linked dynamically to a so called shared library (on Windows environments this is called a dll).
The problem starts with distribution builders and software developers dumping all possible other software to the /usr directory though the directory never was intended to hold this additional data.
A few years ago, it was possible to assign 2GB for the /usr partition, then we needed 4gb and today I am already assigning 12GB ending up with a 51% use installing my system.
So I assign a dedicated disk-partition to
I am installing 3rd-party system related software which I compile myself on /usr/local. This is things like
- the Postgres database
- the open source version of Ingres
- the Berkeley DB
- tcl/tk, swig and related stuff
- nmon, tripwire, apache http server, foswiki, hebcal, ……. etc
There are things, I am torn about, because of their sheer size and the level of sophistication. These software packages are open source, but they meet practically all requirements for COTS-products. So I tend to install them in the /opt directory.
I call the the data that goes to /usr
system – non-critical
And the data in /usr/local
system related – non-critical
And the data that goes to /opt is
3rd party – COTS
There is something left and this is user data and production data. To run a database, you need to go into database design which is not an issue here but may become later. The data for a web server and of course the user data. All of them are volatile and not system related. Hence they go to individual partitions
/srv or /data
/db/oracle/…. see Oracle documentation about Oracle Flexible Architecture
I call this data
user – volatile
Hence I am ending up with a partitioning scheme like this:
/ between 80MB and 120MB /boot 1GB - it's dismaying /usr 12GB /usr/local 4GB - that's a lot /tmp 12GB /var 8GB - I have seen cases of Linux distributions which required more, because they dumped a lot of installation data (rpm or deb) there /var/log 4GB - That's more then enough /opt 12GB - I may need it for Oracle /home 24GB - well, this is unfortunate /data 256GB - Here I dump all my production related data, since I am not running a real production. In a real production environment I would act a bit more sophisticated. Here for instance I store my VM-images.