Где я могу разместить файловый ресурс во FreeBSD?

377
bradarnett

Я хочу настроить общий файловый ресурс на моей коробке FreeBSD. Я планирую сделать его доступным через несколько служб (nfs / samba / etc), но мне интересно, есть ли какое-то конкретное место, которое является «правильным» местом для создания такого каталога.

Я знаю, что технически я могу просто создать какой-нибудь каталог в / share или где угодно и поместить его туда, но меня интересует, что именно предлагает строгий стандарт (если он есть).

1

3 ответа на вопрос

1
TOOGAM

I believe the best answer will be under /srv.

The best place to check is your operating system's manual page named "hier" (which are the first letters from the word "hierarchy", referring to the filesystem layout/hierarchy). Run "man hier". Or look online; since you mentioned FreeBSD, I can provide you with this convenient hyperlink to the online version of FreeBSD's manual page for "hier".

I quickly scanned that and didn't notice any directories that seemed to specifically match what you describe. So, for this particular purpose, that man page doesn't provide the answer. However, checking that first is a good practice. This way, if you do start to use an operating system which does have a customization relevant to a task that you are doing, you may end up following documentation that works most consistent with other software (like other parts of the operating system) that use the same design.

So, since this particular operating system's "hier" page doesn't provide anything more specific, the next place to check is some sort of standardized location that isn't very specific to your operating system. The best standard for that is FHS. FHS 2.3 documentation of /srv notes the purpose of that directory is:

site-specific data which is served by this system

It has examples of:

structuring data under /srv is by protocol, eg. ftp, rsync, www, and cvs

So I would suggest either /srv/smb/ (unless you prefer /srv/cifs/). However, as noted in the FHS documentation, the subdirectories under /srv/ "will differ from host to host", so that is simply a suggested example layout and you are welcome to customize it (while still being "compliant" to the standard).

1
Amiramix

I am serving my content from within jails, e.g. one jail for git repositories, another jail for NFS/SFTP shares, yet another for WWW or IMAP emails, etc. So for me it makes sense to have those shares within file systems of those jails, e.g. /j/nas/sftpuser/disk1, /j/git/gituser/repos, /j/mda/mail, /j/web/www. That way they can be accessed and served through daemons running in those jails.

They are ZFS datasets and their logical location is different, according to inheritance rules. For example SFTP and WWW shares are under a parent dataset with atime turned off but compression turned on.

0
Frank Thomas

There isn't a specific place. Here is the FreeBSD documentation on that point. The Directory structure standard concerns itself with programs, configuration files, and structures for core OS operations, but has almost nothing to say about Data.

The best fit is a subdir of var like /var/shares as it does usually store data, but at the same time, var is really mostly used to store data for system applications, and is supposed to be transient, not archival. Sometimes people do weird things with mount points in var, like mounting ram disks, or another temporary storage technique.

Хотя мой ответ предусматривает другой вариант, я хотел бы обратиться к этому. До того, как файловая структура LSB была преобразована в FHS, общей рекомендацией было использование каталога в / var для данных, которые могут быть обновлены. Принятие FHS не было повсеместно немедленным (и до сих пор широко остается частичным / неполным), поэтому даже после того, как / srv / стал рекомендоваться и использоваться некоторыми платформами, другие операционные системы продолжали использовать / var. Например, [здесь] (http://serverfault.com/questions/124127/linux-fhs-srv-vs-var-where-do-i-put-stuff) указывает на то, что Fedora / RHEL использует / var после некоторых других б / srv TOOGAM 8 лет назад 0