Where in the unix filesystem is the conventional location to save non-user specific data, for example data shared via nfs or ftp, or backups?

I could obviously create and use any arbitrary folder (such as /home/shared, /data or /var/data), but I'm really wondering if there are any "best" or "common" practice guidelines. The Filesystem Hierarchy Standard doesn't specify a location for shared data.

For backups, I tend to use /var/backups, but as several cronjobs write to it should it really be left for their use?

link|improve this question
feedback

3 Answers

up vote 9 down vote accepted

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 date 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.

link|improve this answer
2  
Note that Debian (and Red Hat) started putting Apache's files in /var/www, before /srv/ was part of the FHS. – mattdm Dec 7 '10 at 15:44
A good explanation, thanks, although it seems the answer to the question is "there isn't really a standard that's actually followed". Perhaps there ought to be, perhaps it really doesn't matter. – misterben Dec 16 '10 at 22:56
Well you should always break the rules when you have good reason to. But I estimate this standard is followed meticulously in many large scale deployments. – Stefano Palazzo Dec 16 '10 at 23:18
feedback
  • 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:
alt text

Also have a look at this

link|improve this answer
1  
Whilst this is a useful representation of the FHS, it still doesn't suggest a standard location for a shared data store. – misterben Dec 7 '10 at 11:17
FSH states, that: /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Hmmm, so it seems to depend on what's the purpose of your share. – htorque Dec 7 '10 at 11:38
@htorque I'm leaning towards thinking somewhere under /var is most appropriate for a file share, as you suggested in your (now deleted) answer. – misterben Dec 7 '10 at 11:43
1  
I deleted my answer, because the FHS also states, that: Applications must generally not add directories to the top level of /var. Such directories should only be added if they have some system-wide implication, and in consultation with the FHS mailing list. - the FHS simply doesn't want you to share (writable) data! :P – htorque Dec 7 '10 at 11:48
Thanks, a useful overview, and like the other answer it really serves to document that there isn't a definitive answer, which is helpful in itself. – misterben Dec 16 '10 at 22:57
feedback

I dont think FHS defines any place for shared user data. It is upto users where they want to store there shared data. I usually use /usr/local/shared or /home/shared.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.