Where in the filesystem should I store shared data?
This question does seem to have a clear answer in the Filesystem Hierarchy Standard, which specifies /srv
as "contain[ing] site-specific data which is served by this system
". (3.16.1)
This main purpose of specifying this is so that users may find the location of the data files for particular service, and so that services which require a single tree for readonly data, writable data and scripts
(my emphasis)
Note: 'Served by the system' doesn't necessarily refer to the Internet. It needn't even mean a network. It's applicable to even a shared system. Further, the words site and service should be understood in their pre-internet meanings. Your site can be "the physics department" or "the finances office".
It goes on to say:
On large systems it can be useful to structure /srv by administrative context, such as /srv/physics/www, /srv/compsci/cvs, etc. This setup will differ from host to host. Therefore, no program should rely on a specific subdirectory structure of /srv existing or data necessarily being stored in /srv. However /srv should always exist on FHS compliant systems and should be used as the default location for such data.
You should therefore further structure your data in directories such as /srv/nfs
, /srv/backup
and so on.
I should also mention that few people do this anymore. But there is no good reason why they don't. The standard is by no means out of date.
/var
is traditionally used for things like print-spools and log-files, but it's also used by the Apache web server (on Debian systems anyway - SUSE use /srv); There doesn't seem to be consensus on whether /var
is a proper directory for shared data. But if you decide to use it instead, you will have no regrets I'm sure.
Note also: Karthick's answer is by no means wrong. The FHS says /srv " should be used as the default location for such data", but the standard leaves some room for your own preference, depending on how you interpret the terms.
- Non-user specific data can be stored in /usr/local/var so that it doesn't end up on a newtwork share again.
- Anything not under ../local/.. is allowed to end up on a nfs share,so if you want to download data from a nfs share, and be sure they are stored locally on the machines harddrive.
- Then you should choose a path with .../local/.. in it.... the rest depends on the nature of the data,on the type of it.It could be /local/var or /local/tmp etc.
File system hierarchy:
Also have a look at this