We sometimes find that the Var partition uses Du and DF to see that the usage is inconsistent, typically because some files are deleted, but the file is also occupied by the program, causing the space to not be released. Sometimes, you know which program is occupied, directly after restarting the program, you can release directly, sometimes you need to uninstall the Var partition to completely release the space.
See what programs are consuming the VAR partition
The code is as follows |
Copy Code |
# lsof |grep/var AUDITD 1182 Root 5w REG 252,1 3288401 2885177/var/log/audit/audit.log RSYSLOGD 1198 Root 1w REG 252,1 1507 2885223/var/log/messages RSYSLOGD 1198 root 2w REG 252,1 105277 2885155/var/log/cron RSYSLOGD 1198 root 4w REG 252,1 4310 2885224/var/log/secure .... |
The first column lists which program is occupying the file
Common procedures include the following: Pcscd, Crond, Syslog, AUDITD
Uninstall the Var partition script as follows:
The code is as follows |
Copy Code |
#!/bin/bash serverlist= "PCSCD crond syslog auditd" disk=$ (df-h|grep "/var" |awk ' {print $} ') For server in $ServerList Todo Service $server Stop Done Umount/var For server in $ServerList Todo Service $server Start Done Mount $disk/var
|