Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Feb 2010 00:28:30 -0300
From:      Fernan Aguero <fernan.aguero@gmail.com>
To:        Paul Schmehl <pschmehl_lists@tx.rr.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: discrepancies in disk usage between df and du
Message-ID:  <520894aa1002121928t6c470a59tf15a320b9ab9b6db@mail.gmail.com>
In-Reply-To: <0CA646C8F9505B3677DCFBA7@Macintosh-2.local>
References:  <520894aa1002121239s2148ed6dudeae8055fe337d02@mail.gmail.com>  <0CA646C8F9505B3677DCFBA7@Macintosh-2.local>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 12, 2010 at 8:53 PM, Paul Schmehl <pschmehl_lists@tx.rr.com> wr=
ote:
> You have a file locking problem. =A0du shows disk in use, but df shows di=
sk
> committed. =A0Use lsof to identify the file that has disk space reserved =
but
> no longer exists. =A0man (8) lsof

Thanks Paul for the suggestion. I've tried both lsof and fstat, and
can't really see anything wrong in the output ...

1. Can't install lsof from ports, apparently

=3D=3D=3D>   Registering installation for lsof-4.83C,4
/var: write failed, filesystem is full
cp: /var/db/pkg/lsof-4.83C,4/+MTREE_DIRS: No space left on device
*** Error code 1

I say 'apparently' because in spite of the error message, /var/db/pkg
gets written anyway:

omega# ls -l /var/db/pkg/lsof-4.83C,4/
total 6
-rw-r--r--  1 root  wheel    57 Feb 13 01:22 +COMMENT
-rw-r--r--  1 root  wheel  1435 Feb 13 01:22 +CONTENTS
-rw-r--r--  1 root  wheel   386 Feb 13 01:22 +DESC
-rw-r--r--  1 root  wheel     0 Feb 13 01:22 +MTREE_DIRS

And lsof is installed at /usr/local/sbin/lsof, as expected.

2. Let's see what lsof shows:

omega# lsof +D /var/
COMMAND    PID  USER   FD   TYPE             DEVICE SIZE/OFF    NODE NAME
devd       464  root    4u  unix 0xffffff0005d03b40      0t0
/var/run/devd.pipe
devd       464  root    5w  VREG               0,94        3   47122
/var/run/devd.pid
sendmail   804  root  cwd   VDIR               0,94      512 1295363
/var/spool/mqueue
sendmail   804  root    5w  VREG               0,94       78   47115
/var/run/sendmail.pid
sendmail   808 smmsp  cwd   VDIR               0,94      512 1295366
/var/spool/clientmqueue
sendmail   808 smmsp    4w  VREG               0,94        0 1295368
/var/spool/clientmqueue/sm-client.pid
cron       814  root  cwd   VDIR               0,94      512   23552 /var/c=
ron
cron       814  root    3w  VREG               0,94        3   47117
/var/run/cron.pid
csh       6741 paula  cwd   VDIR               0,94     4096  117760 /var/l=
og
syslogd  70526  root    3w  VREG               0,94        5   47111
/var/run/syslog.pid
syslogd  70526  root    4u  unix 0xffffff0024a00b40      0t0
/var/run/log
syslogd  70526  root    5u  unix 0xffffff0013ee9870      0t0
/var/run/logpriv
syslogd  70526  root   11w  VREG               0,94    51176  117901
/var/log/messages
syslogd  70526  root   12w  VREG               0,94       60  117771
/var/log/security
syslogd  70526  root   13w  VREG               0,94    86008  117780
/var/log/auth.log
syslogd  70526  root   14w  VREG               0,94     2036  117877
/var/log/maillog
syslogd  70526  root   15w  VREG               0,94       60  117767
/var/log/lpd-errs
syslogd  70526  root   16w  VREG               0,94       60  117773
/var/log/xferlog
syslogd  70526  root   17w  VREG               0,94    34783  117859
/var/log/cron
syslogd  70526  root   18w  VREG               0,94       93  117766
/var/log/debug.log
syslogd  70526  root   19w  VREG               0,94       60  117772
/var/log/slip.log
syslogd  70526  root   20w  VREG               0,94       60  117770
/var/log/ppp.log

3. fstat comes built-in,

omega# fstat -f /var/
USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
root     syslogd    70526    3 /var      47111 -rw-------       5  w
root     syslogd    70526   11 /var     117901 -rw-r--r--   51176  w
root     syslogd    70526   12 /var     117771 -rw-------      60  w
root     syslogd    70526   13 /var     117780 -rw-------   86008  w
root     syslogd    70526   14 /var     117877 -rw-r-----    2036  w
root     syslogd    70526   15 /var     117767 -rw-r--r--      60  w
root     syslogd    70526   16 /var     117773 -rw-------      60  w
root     syslogd    70526   17 /var     117859 -rw-------   34783  w
root     syslogd    70526   18 /var     117766 -rw-------      93  w
root     syslogd    70526   19 /var     117772 -rw-r-----      60  w
root     syslogd    70526   20 /var     117770 -rw-r-----      60  w
paula    csh         6741   wd /var     117760 drwxr-xr-x    4096  r
root     cron         814   wd /var      23552 drwxr-x---     512  r
root     cron         814    3 /var      47117 -rw-------       3  w
smmsp    sendmail     808   wd /var     1295366 drwxrwx---     512  r
smmsp    sendmail     808    4 /var     1295368 -rw-------       0  w
root     sendmail     804   wd /var     1295363 drwxr-xr-x     512  r
root     sendmail     804    5 /var      47115 -rw-------      78  w
root     devd         464    5 /var      47122 -rw-------       3  w

I can see nothing here ...

4. But still, disk is full ... or is it?

omega# df -h
Filesystem                Size    Used   Avail Capacity  Mounted on
/dev/mirror/gm0s1f         18G     18G   -1.5G   109%    /var

Thanks for any further advice,

--
fernan


> --On February 12, 2010 5:39:44 PM -0300 Fernan Aguero
> <fernan.aguero@gmail.com> wrote:
>
>> Hi,
>>
>> I have a box (7.2-STABLE, amd64) that is currently showing some disk
>> usage problems. It all started with apache generating huge logs from
>> one of the mod_perl applications that is undergoing testing. So the
>> /var partition was getting full.
>>
>> We removed all logs that were causing the problem, but even though du
>> shows some 700 Mb of usage, df shows that the disk is full (-1.5 Gb):
>>
>> [fernan@omega ~] sudo du -hc -d1 /var/
>> Password:
>> 2.0K =A0 =A0/var/.snap
>> 423M =A0 =A0/var/account
>> 6.0K =A0 =A0/var/at
>> 2.0K =A0 =A0/var/audit
>> =A018K =A0 =A0/var/backups
>> 4.0K =A0 =A0/var/crash
>> 6.0K =A0 =A0/var/cron
>> =A053M =A0 =A0/var/db
>> 2.0K =A0 =A0/var/empty
>> 2.0K =A0 =A0/var/heimdal
>> 219M =A0 =A0/var/log
>> =A014M =A0 =A0/var/mail
>> 4.0K =A0 =A0/var/msgs
>> =A048K =A0 =A0/var/named
>> 2.0K =A0 =A0/var/preserve
>> =A044K =A0 =A0/var/run
>> 2.0K =A0 =A0/var/rwho
>> =A016K =A0 =A0/var/spool
>> =A076K =A0 =A0/var/tmp
>> =A024K =A0 =A0/var/yp
>> 2.0K =A0 =A0/var/games
>> 710M =A0 =A0/var/
>> 710M =A0 =A0total
>>
>> [fernan@omega ~] df -h
>> Filesystem =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Size =A0 =A0Used =A0 Avail Cap=
acity =A0Mounted on
>> /dev/mirror/gm0s1f =A0 =A0 =A0 =A0 18G =A0 =A0 18G =A0 -1.5G =A0 109% =
=A0 =A0/var
>>
>> I've been googling around, and I understand why df and du might be
>> reporting disk usage differently. However, I can't solve this issue
>> and reclaim unused disk space ... applications (apache, mod_perl) are
>> prevented to write to /var and this is causing us problems.
>>
>> We've already tried rebooting the box, restarting the syslog,
>> newsyslog daemons, to no avail. df keeps showing >100% disk usage
>> (-1.5 Gb of remaining disk space) in all cases. We've even rebooted
>> the box with all apache instances turned off in rc.conf ... i.e.
>> without any but the most basic services running (sshd) ...
>>
>> This box is essentially a web server, no other services are being run.
>>
>> Any suggestions as to what to try next?
>>
>> Thanks in advance,
>
>
>
> Paul Schmehl, If it isn't already
> obvious, my opinions are my own
> and not those of my employer.
> ******************************************
> WARNING: Check the headers before replying
>
>



--=20
fernan



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