Check disk space size and clear space

df -lh
View the size of the space occupied by the file system
 
du -h --max-depth=1 /
View the size of the disk space occupied by the one-level directory under the root directory
 
du -h --max-depth=1 /var
View the next level of the /var directory The size of the disk space occupied by the top-level directory
 
When a large file is found, if you do not want to delete the file for some reason, you can use the echo or cat or clear command to clear the file content:
echo > /var/log/big.log This command will Clear the contents of the big.log file in the /var/log directory without deleting the big.log file
cat > /var/log/big.log This command can be achieved with "echo > /var/log/big.log" The same effect, however, after the command is executed, you need to use "Ctrl + d" to end
clear > /var/log/big.log This command will clear the contents of the big.log file without deleting the file.
 
 
Use # df -i to view.
 
It is really because the inode is used up, and the disk can no longer write new content. This is because there are too many temporary small files. If the inode is used up, just delete it.
 
# find /var/spool/clientmqueue -type f -print -exec rm -f {} \;
in this command /var/spool/clientmqueue is the directory where the file to be deleted is located -type f This parameter limits find to only find ordinary files (That is, not a pipe file, not a block file, not a link file, not a directory, etc.) to prevent accidental deletion of system files.
 
Reason analysis: Some users in the system have opened cron, and the programs executed in cron have output content, and the output content will be sent to cron users in the form of emails, but sendmail is not started, so these files are generated;

Tencent Cloud's /var/ The growth rate of log/secure files and /usr/local/TsysAgent/bin/monlog.log is amazing and needs to be cleaned regularly. It is best to set a crontab to clean up

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326613194&siteId=291194637