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?
Best Answer
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)(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:
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.