Size of /var worries me

Jez Hancock jez.hancock at munk.nu
Wed Jan 7 02:29:18 PST 2004


On Wed, Jan 07, 2004 at 01:38:35AM -0800, Dino Vliet wrote:
> Hi there,
> 
> I've installed freebsd 4.9 and am currently busy with
> installing third party apps through the ports
> collection.
> What worries me however is the size of my /var
> directory.
You might consider symlinking /var to /usr/var perhaps - unless you have
any other spare space that you can allocate to the /var fs - 67MB is
quite small, especially if you intend to use any databases at any point
in time.

The best way to go about symlinking /var to somewhere else is to go into
single user mode at boot time (or kill all processes that use anything
under /var), move /var to /usr/var and then symlink /var to /usr/var.

This isn't really the best solution in terms of performance (although
you wouldn't notice on a low load system), but unless you have extra
free disk space you can allocate to /var or are prepared to reinstall -
allocating more space to /var in the installation - then the symlinking
option is viable.

> I also had to get rid of a pkg.db file in the
> /var/db/pkg directory because it took a lot of space.
As a note, the pkg.db file is quite important - port installations
register themselves in the /var/db/pkg/pkg.db database and this is used
to check on dependencies etc, a little bit like the windows registry is
used (only a little!).  Generally deleting files from under /var isn't
the best solution :P

> q1) Do I have to worry about my /var<directory
Yes, FreeBSD uses the /var filesystem to log things to (/var/log), to
keep check on the state of daemons (/var/state, /var/run), to lock files
(/var/lock) and numerous other things.  Not to mention that databases
are by default installed into /var/db/mysql for example in the case of
mysql.

Generally the /var filesystem is very important for the day-to-day
running of a FreeBSD system.

> q2) How can I get rid of files I don't need (like
> XFree86.0.log..)
As mentioned above it's generally not a good idea to delete files from
/var/ on an ad-hoc basis.  A better plan:

organize a logfile rotation policy so that old logfiles are rotated out
of /var/log into a backup location which has enough space.  See the
manpage on newsyslog for info on this.

configure daemons so that they only log what is absolutely necessary for
your needs.

-- 
Jez Hancock
 - System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - personal weblog
http://ipfwstats.sf.net/        - ipfw peruser traffic logging


More information about the freebsd-questions mailing list