[fhs-discuss] tighten the use and intention of the "/var" hierarchy

Tollef Fog Heen tfheen at err.no
Sun May 15 02:23:20 PDT 2011


]] Christoph Anton Mitterer 

| Defining the intended usage of /var is rather difficult, but IMHO a few
| things are typical for data that goes in there:
| a) the data is either NOT extremely important (e.g. logs[0], or
| dynamically generated content, lock and pid-files[1]) _OR_

I consider logs pretty important, and lock/pid files will go to /run.

| b) the data is there (in /var) only temporarily (e.g. emails or other
| stuff in a spooling directory or cached data which should however go to
| some other place finally[2]) _OR

/var/mail isn't particularly temporarily.

| c) the data is only used internally within programs and not exposed (at
| least not directly) to the user (this is e.g. that case with package
| management databases, lock files, other "state data" and/or cached data
| (e.g. fail2ban could store it's currently banned addresses there) )... of
| course, such [internal] data might be actually very important, just take
| the package management databases as an example.
| 
| All other kinds of data (I hope I've caught every thing above) should not
| go to /var, but other places (in many cases this would be /srv or /run).
| 
| Especially it's IMHO wrong, that many databases (e.g. postgresql, mysql)
| are often configured to put there data files in /var/lib.
| This kind of data neither fits (a) (cause it IS very important), nor (b)
| (the database itself does not surprisingly go away) and although the user
| does not directly operate on the database files,... he directly operates on
| the data (e.g. via SQL queries),... so it's also not (c).
| So IMHO, database should go e.g. to "/srv/postgresql", or "srv/mysql".

I think this is a terrible idea.  /srv is the domain of the sysadmin, so
you'd then end up with no reasonable default configuration.  It's also
not clear to me what problem you'd be solving by moving database data
out of /var.

| Another example is, that web-content is often put into "/var/www".
| This is IMHO wrong for e.g. plain HTML files, directly edited/created by a
| user.

/var/www should just go away.  It was a mistake.

| BUT it would be indeed the right place, if the content placed there is
| (fully) dynamically generated from a database. 

No, then it should go to /var/cache/$something.

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are


More information about the fhs-discuss mailing list