/var/lib for holding served data, why

fhsfilesystemsunix

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

Best Answer

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.