Linux system how to re-mount var partition

  

Linux system, sometimes need to re-mount var partition to free up space, and the theoretical explanation many people do not understand, the following small series through an example to introduce you to Linux Remount the var partition method so that everyone can understand.

sometimes you find such a situation, var partition using the du and df seen occupancy is inconsistent, under normal circumstances, due to delete some files, but the file also led to occupy space program Not released. Sometimes, if you know which program is occupied, you can directly release the program directly after restarting the program; sometimes, you need to re-install the var partition to completely release the space.

See which programs are using var partitions

# 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

The common programs are as follows: pcscd, crond, syslog, auditd

The uninstall var partition script is as follows:

#! /bin/bash

ServerList=“pcscd crond syslog auditd”

Disk=$(df -h| Grep “/var” | Awk ‘{print $1}& rsquo;)

for server in $ServerList

do

service $server stop

done

umount /var

for server in $ServerList

do

service $server start

done

mount $disk /var

The above is the introduction of Linux re-mounting var partitions. Through this example, you can learn how to mount var partitions on Linux systems.

Copyright © Windows knowledge All Rights Reserved