var Filesystem Full Help
Alex Zbyslaw
xfb52 at dial.pipex.com
Tue Apr 3 17:12:13 UTC 2007
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
More information about the freebsd-questions
mailing list