Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2006 13:07:18 -0800
From:      Garrett Cooper <youshi10@u.washington.edu>
To:        freebsd-questions@freebsd.org
Subject:   Re: var out of space
Message-ID:  <4585B186.5090204@u.washington.edu>
In-Reply-To: <20061217203629.GA79172@ns.umpquanet.com>
References:  <20061217120040.9EF0316A607@hub.freebsd.org> <20061217203629.GA79172@ns.umpquanet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
James Long wrote:
>> Date: Sat, 16 Dec 2006 23:31:58 -0800
>> From: Bradley Giesbrecht <brad@pixilla.com>
>> Subject: var out of space
>> To: freebsd-questions@freebsd.org
>> Message-ID: <00190780-C6FE-42DB-9AD8-5D985625545F@pixilla.com>
>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>>
>> Hello,
>>
>>
>> I inherited a freebsd installation with a var slice/mount that is to  
>> small and filling up all the time.
>>
>> What type of info should I provide to allow someone to help me with a  
>> solution?
>>
>> I would very much prefer to not install another drive just for /var.
>>
>> /usr has plenty of space. Can I mount var off of /usr?
>>     
>
> Here is a slightly simpler solution than what Anders proposed that 
> may work for you.
>
> Find out which sub-directories of /var are the disk space consumers:
>
> du -d1 /var | sort -rn | head
>
> That will list the top ten.  This method assumes you have only one
> or two large directories, and that moving them would yield
> a substantial reduction in /var disk space usage.
>
> Let's assume that /var/log and /var/db are the top two directories.
>
> Shutdown to single-user mode.  Stop any daemons like syslog, sendmail,
> etc. that might write to /var/log or /var/db, since you will be working
> with those two directories.
>
> cd into /var and move the log sub-directory onto the /usr mount point,
> and then create a symlink to make /var/log redirect to the new location
> on /usr:
>
> cd /var
> mv log /usr/var-log
> ln -s /usr/var-log log
>
> Repeat for /var/db:
>
> mv db /usr/var-db
> ln -s /usr/var-db db
>
> Reboot.
>
> This procedure eliminates the need to mess with your disklabel or your 
> fstab.
>
> BTW, it looks like your / partition is a bit crowded, also. :)
>
>
> Jim
Depends on what your cluster size is too for the slice. I created a 3.9 
GB partition for /usr recently with 16kB clusters (not thinking), and 
installed ports-which ate up almost all the free space. After I started 
installing stuff I ran out of space.

Solution (in my case):
-Delete files (otherwise tunefs has no effect).
-Reboot into single-user mode.
-Run tunefs on slice setting the average filesize (-f flag) to something 
a lot lower.
-Boot into multiuser mode.

Voila! Problem fixed.

In your case though, you may want to just backup and redo the system if 
stuff fills up far too quickly, or look into circular buffer logging 
with syslog. I don't remember how to accomplish it but it has been done.
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4585B186.5090204>