/var or /usr for data?

Maxim Khitrov mkhitrov at gmail.com
Wed Aug 22 14:47:11 PDT 2007


On 8/22/07, Brad Waite <freebsd at wcubed.net> wrote:
> It would appear that the "proper" allocation of filesystems on FreeBSD is
> to put all data in /usr.  I'm used to this and have been doing it for
> years.
>
> However, there's a few issues that keep coming up.  A lot of the ports use
> /var for data dirs.  MySQL, Qmail, dspam are a few that I've had issues
> with.
>
> Is there a canonical place to put data files on a modern FreeBSD server?
> Figuring out the sizes for each partition is an exercise in frustration
> when I don't know how big /var or /usr are going to grow.
>
> For now, I've changed the default config files for MySQL and dspam to use
> /usr/local for data dirs, but is this the "right" thing to do?
>
> I used to put everything on /, but that created problems when I couldn't
> fsck the single large partition and I had to boot from CD to fix things.
> That's an issue when the server's not in the same state.
>
> A Solaris associate of mine is of the opinion that /usr should be able to
> be mounted RO for security purposes.  If /var was the default for all
> add-ons and data, I could see that, but that wouldn't work the ways things
> are now.

I put all the server-related data such as databases, mail, websites,
subversion/mercurial repositories under /srv. It's part of the FHS,
but I don't think many people use it. You should not be using /usr for
this. I think of /usr as the place where software gets installed to
(and from), but there shouldn't be your own data under it with the
exception of configuration files. If I had to use something other than
/srv I would go for /var, but in my opinion that's also messy.
Especially so if you have /var/tmp on the same partition.

As far as partition sizes go, I tend to follow a rather simple model.
I give 1GB to /, even though that's usually an overkill, 2xRAM for
swap, 1-4GB for /var depending on what I plan to use the machine for,
5-20GB for /usr (20 is mostly for workstations where you plan to run
an X server with many other apps), and the rest either for /srv or
/home. For a server I use /srv, for a workstation I use /home.

- Max


More information about the freebsd-questions mailing list