Example of re-mount VAR partition in Linux

Source: Internet
Author: User
Tags syslog

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.