Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resizing /var

Status
Not open for further replies.

Roberti

Technical User
Mar 2, 2001
96
0
0
NL
How can i resize /var without loosing the data on that partition. It is 255 MB now and i think i need about 500 MB.
I have enough free space on the /usr partition. Can I do this with a symlink?

Roberti
 
Roberti,

You could do it with a symlink, but why do you feel that you need more space in /var? Most of that data is logs, and can probably be compressed or backed up and removed.

Wishdiak
A+, Network+, MCSA 2003 certified
 
Wishdiak,

Thanks for the reply. I need more space because it's at 108% capacity and I can't seem to find what is using up all the space. I had two pretty large log files (httpd-access.log and xferlog) but i've cleaned them up. It is now at 107% capacity.
Do you know where a lot of data could be stored? The server runs Apache2 and Proftpd.

Roberti
 
Well..I'd suggest you try.
Code:
du -h /var | less

HTH.
 
When I do that I come at a total of 25 MB, while "df /var" keeps reporting that 255 MB is in use. Any other ideas exept a reboot?

Roberti
 
You are not interpreting the OP of du -h correctly I hope.
Try this function:
Code:
findlargefiles ()
{
    ${1:="/"};
    ${2:="300000"};
    szstr="+$2c";
    echo "DEBUG: $szstr";
    for all in `find $1 -type f -size $szstr`;
    do
        ls -l $all | awk ' {print $5,$(NF)}';
    done
}

Used like this:
Code:
findlargefiles /var 200000 2>/dev/null
DEBUG: +200000c
730645 /var/db/pkg/linux_base-7.1_5/+CONTENTS
247941 /var/db/pkg/python-2.3_1/+CONTENTS
1036567 /var/db/locate.database
524288 /var/yp/domainname/services.byname

Tested -w- bash on freebsd 4.9.
HTH
 
I found a moment to reboot the server and al is well now.
'df /var' now reports it's at 1% capacity, and all errors have gone.
 
That's bizarre as anything.
What version of freebsd?
 
Yes it's very strange. I have a few more freebsd servers here and I've never had this problem. The freebsd version is 4.10.

Roberti
 

It's not bizarre at all. The data in a file won't dissapear until no file handles keep it open. Which ever daemon was logging to those files would still use the space in the file system. A system restart of the daemon would have worked.

Remeber: A reboot is never a good solution.

Cheers
 
Yes, but I removed about 30MB of files and after the reboot I had about 220MB of free space.

Roberti
 
Hmm. If you unlinked the affected files and recreated them you would have had some interesting results. In any case I tested it in house using stat(), fclose(), and unlink() in various combination and found that stdio (read FILE *), oriented reads using stat() against dynamic writes are inaccurate on open files and that after an unlink() and/or fopen() results are pretty predictable.

As far as restarting the daemon process..yeah, it's
supposed to work,_exit() is supposed to close all file handles,descriptors, but only by that process.

Freebsd doesn't really come out user friendly with utils
like fuser, that I know about. Otherwise you could could
have killed/restarted every process grabbing /var and
skipped the reboot. As is: Good Call. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top