Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Apr 2007 18:12:09 +0100
From:      Alex Zbyslaw <xfb52@dial.pipex.com>
To:        Noah <admin2@enabled.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: var Filesystem Full Help
Message-ID:  <46128AE9.8050807@dial.pipex.com>
In-Reply-To: <46128465.4040704@enabled.com>
References:  <46127E55.2040005@calarts.edu> <46128343.7050701@dial.pipex.com> <46128465.4040704@enabled.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Noah wrote:

> Alex Zbyslaw wrote:
>
>> Sean Murphy wrote:
>>
>>> I am getting these errors on my var filesystem but df -h shows there 
>>> is plenty of space available.
>>
>>
>> Check df -i as you may have run out of inodes rather than out of file 
>> space.
>
> lsof is your friend

First of all, please don't top-post.  Second of all, I'm not the 
original poster so sending the email "To:" me isn't that helpful.

Third of all, and most important, open files are irrelevant.  The OP was 
using df.  df counts free blocks in the file system.  Files which are 
open and then deleted do not free their blocks and do not show up as 
free blocks in df.  If the original command had been du, which traverses 
the file system to count usage and therefore can't count a file which 
has been deleted but is still open, then lsof might be useful.  In this 
case it is not.

A simple experiment to see this:

1) df /var

Filesystem   1K-blocks   Used   Avail Capacity  Mounted on
/dev/ad10s1e   5077038 116682 4554194     2%    /var

2) Create a big file

dd if=/dev/zero of=/var/tmp/HUGE bs=1m count=100

df /var

Filesystem   1K-blocks   Used   Avail Capacity  Mounted on
/dev/ad10s1e   5077038 219162 4451714     5%    /var

3) Hold the file open; delete it; repeat df

perl -e 'open(X, "/var/tmp/HUGE"); sleep 30;' &

rm /var/tmp/HUGE
remove /var/tmp/HUGE? y

df /var
Filesystem   1K-blocks   Used   Avail Capacity  Mounted on
/dev/ad10s1e   5077038 219162 4451714     5%    /var

4) Wait for open process to finish; repeat df

[1]    Done                          perl -e open(X, "/var/tmp/HUGE"); 
sleep 30;

df /var
Filesystem   1K-blocks   Used   Avail Capacity  Mounted on
/dev/ad10s1e   5077038 116682 4554194     2%    /var

The available disk space start at 4554194, drops to 4451714  when the 
file is created, and *remains like that* until the process holding the 
file open exits, thus freeing the last reference and allowing the blocks 
to be freed.

--Alex






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46128AE9.8050807>