5

Acording to the FHS, the directories /lib and /usr/lib are both for libraries (libraries used in /sbin and user libraries, respectively).

But what about the /var/lib folder? Following the same logic this folder should have something like "variable libraries" (that sounds strange) but it actually holds data generated and maintained by running programs, or as defined by the wikipedia article:

State information. Persistent data modified by programs as they run, e.g., databases, packaging system metadata, etc.

From a fresh view, it makes more sense to put database data and served files under /srv instead of /var/lib

1
  • 2
    We didn't write the standard. Well, most of us anyway. Oct 18, 2012 at 17:08

2 Answers 2

5

This is explained in the commit to the new 3.0 version:

http://bzr.linuxfoundation.org/loggerhead/lsb/devel/fhs-spec/revision/26

Specifically, /srv/ is for served, file-system structured data, /var/lib/ is for locally-consumed data. Apache will serve out of /srv as it's filesystem hierarchical. MySQL serves out of /var/lib since only mysqld accesses it and it is not filesystem hierarchical.

1
1

As sysadmin1138 has already mentioned, FHS 3.0 explains this in its /srv section, which I'll cite:

https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s17.html

If the directory and file structure of the data is not exposed to consumers, it should go in /var/lib.

That sentence has been added due to this FHS bug. There, Tollef Fog Heen writes:

I think the crucial difference here is whether the sysadmin is ordinarily exposed to and has to care about the directory structure.

The helpful part here is that in /srv the sysadmin ”has to care about the directory structure“.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .