df
queries the file system for total blocks used, see man 3 statvfs. Fast and an accurate accounting of the volume, but no detail on which files.
du
loops through files and adds up their sizes. Slower, but can print per file sizes.
A discrepancy may mean deleted files are still open by some program. Most commonly such large files are logs or databases, but could be anything.
This is often followed by rsyslog
or syslog-ng
filling up /var
with error messages when the syslog server is down for maintenance.
Root cause would be your remote logging configuration.
Short term, properly rotate log files, such as by running logrotate
ad-hoc. Note that typical config in /etc/logrotate.d/*syslog sends rsyslog a HUP signal to reopen new log files.
Consider increasing the size of /var to handle actual size of log files.
Revise logging configuration to do something appropriate when remote is down and when disk space is low. rsyslog may be configured with queues that use a finite amount of space and discard messages on queue full. rsyslog config example from SLES knowledge base, will need to be customized for your logging setup:
# cat /etc/rsyslog.d/ora_audit.conf
if ( $syslogfacility-text == 'local1' ) and ( $syslogseverity == 4 /* warning */ ) then {
$WorkDirectory /var/spool/rsyslog # where to place spool files
$ActionQueueFileName RemoteQueue # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1G # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList # run asynchronously
$ActionResumeRetryCount -1 # infinite retries if host is down
$ActionQueueTimeoutEnqueue 0 # causes that the message will be discarded immediately if the queue is full
*.* @@aaa.bbb.ccc.ddd:514 # IP of remote syslog server:port 514
stop
}
# Above setup discards any messages, if queue size limit is reached (in this setup 1 GB) immediately !