discrepancies in disk usage between df and du

2010-02-12 Thread Fernan Aguero
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):

[fer...@omega ~] sudo du -hc -d1 /var/
Password:
2.0K/var/.snap
423M/var/account
6.0K/var/at
2.0K/var/audit
 18K/var/backups
4.0K/var/crash
6.0K/var/cron
 53M/var/db
2.0K/var/empty
2.0K/var/heimdal
219M/var/log
 14M/var/mail
4.0K/var/msgs
 48K/var/named
2.0K/var/preserve
 44K/var/run
2.0K/var/rwho
 16K/var/spool
 76K/var/tmp
 24K/var/yp
2.0K/var/games
710M/var/
710Mtotal

[fer...@omega ~] df -h
FilesystemSizeUsed   Avail Capacity  Mounted on
/dev/mirror/gm0s1f 18G 18G   -1.5G   109%/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,

-- 
fernan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: discrepancies in disk usage between df and du

2010-02-12 Thread Paul Schmehl
You have a file locking problem.  du shows disk in use, but df shows disk 
committed.  Use lsof to identify the file that has disk space reserved but 
no longer exists.  man (8) lsof


--On February 12, 2010 5:39:44 PM -0300 Fernan Aguero 
fernan.agu...@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):

[fer...@omega ~] sudo du -hc -d1 /var/
Password:
2.0K/var/.snap
423M/var/account
6.0K/var/at
2.0K/var/audit
 18K/var/backups
4.0K/var/crash
6.0K/var/cron
 53M/var/db
2.0K/var/empty
2.0K/var/heimdal
219M/var/log
 14M/var/mail
4.0K/var/msgs
 48K/var/named
2.0K/var/preserve
 44K/var/run
2.0K/var/rwho
 16K/var/spool
 76K/var/tmp
 24K/var/yp
2.0K/var/games
710M/var/
710Mtotal

[fer...@omega ~] df -h
FilesystemSizeUsed   Avail Capacity  Mounted on
/dev/mirror/gm0s1f 18G 18G   -1.5G   109%/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

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: discrepancies in disk usage between df and du

2010-02-12 Thread Fernan Aguero
On Fri, Feb 12, 2010 at 8:53 PM, Paul Schmehl pschmehl_li...@tx.rr.com wrote:
 You have a file locking problem.  du shows disk in use, but df shows disk
 committed.  Use lsof to identify the file that has disk space reserved but
 no longer exists.  man (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

===   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  wheel57 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/
COMMANDPID  USER   FD   TYPE DEVICE SIZE/OFFNODE NAME
devd   464  root4u  unix 0xff0005d03b40  0t0
/var/run/devd.pipe
devd   464  root5w  VREG   0,943   47122
/var/run/devd.pid
sendmail   804  root  cwd   VDIR   0,94  512 1295363
/var/spool/mqueue
sendmail   804  root5w  VREG   0,94   78   47115
/var/run/sendmail.pid
sendmail   808 smmsp  cwd   VDIR   0,94  512 1295366
/var/spool/clientmqueue
sendmail   808 smmsp4w  VREG   0,940 1295368
/var/spool/clientmqueue/sm-client.pid
cron   814  root  cwd   VDIR   0,94  512   23552 /var/cron
cron   814  root3w  VREG   0,943   47117
/var/run/cron.pid
csh   6741 paula  cwd   VDIR   0,94 4096  117760 /var/log
syslogd  70526  root3w  VREG   0,945   47111
/var/run/syslog.pid
syslogd  70526  root4u  unix 0xff0024a00b40  0t0
/var/run/log
syslogd  70526  root5u  unix 0xff0013ee9870  0t0
/var/run/logpriv
syslogd  70526  root   11w  VREG   0,9451176  117901
/var/log/messages
syslogd  70526  root   12w  VREG   0,94   60  117771
/var/log/security
syslogd  70526  root   13w  VREG   0,9486008  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,9434783  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 syslogd705263 /var  47111 -rw---   5  w
root syslogd70526   11 /var 117901 -rw-r--r--   51176  w
root syslogd70526   12 /var 117771 -rw---  60  w
root syslogd70526   13 /var 117780 -rw---   86008  w
root syslogd70526   14 /var 117877 -rw-r-2036  w
root syslogd70526   15 /var 117767 -rw-r--r--  60  w
root syslogd70526   16 /var 117773 -rw---  60  w
root syslogd70526   17 /var 117859 -rw---   34783  w
root syslogd70526   18 /var 117766 -rw---  93  w
root syslogd70526   19 /var 117772 -rw-r-  60  w
root syslogd70526   20 /var 117770 -rw-r-  60  w
paulacsh 6741   wd /var 117760 drwxr-xr-x4096  r
root cron 814   wd /var  23552 drwxr-x--- 512  r
root cron 8143 /var  47117 -rw---   3  w
smmspsendmail 808   wd /var 1295366 drwxrwx--- 512  r
smmspsendmail 8084 /var 1295368 -rw---   0  w
root sendmail 804   wd /var 1295363 drwxr-xr-x 512  r
root sendmail 8045 /var  47115 -rw---  78  w
root devd 4645 /var  47122 -rw---   3  w

I can see nothing here ...

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

omega# df -h
FilesystemSizeUsed   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.agu...@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