Full clean-up server disk space

Descriptions of the symptoms:

[root @ VM_58_118_centos ~] # cd / the Data      // Do tab shortcut keys under no space 
/ DA-bash: CAN not the Create the TEMP File  for here- the Document: there is no space left on device
[VM_58_118_centos the root @ ~] # the crontab - E
 /tmp/crontab.siEqwL: no space on the device

Check disk space usage:

[root@VM_58_118_centos Uploads]# df -h
File system capacity has been available for use with % mount point
 / dev / Vdal        . 7 0.8 g   . 7 .7G      0   100 % / 
devtmpfs         . 3 .9 g      0   . 3 .9 g     0 % / dev
tmpfs           3.9G   24K  3.9G    1% /dev/shm
tmpfs           3.9G   13M  3.9G    1% /run
tmpfs           3.9G     0  3.9G    0% /sys/fs/cgroup
/dev/vdb1       985G  594G  341G   64% /data
tmpfs           783M     0  783M    0% /run/user/0

Space bleaching Release Notes:

/ Dev / vda1 is the system disk,
/ Data directory hanging in the / dev / vdb1, recommended that the user logs, programs, data files are placed in / data directory, easy to clean space, clean up the files in the / data directory, it will only affect the / dev / vdb1 space
Cleanup / dev, / dev / shm, / run, / sys / fs / cgroup, files outside the directory / data, it is quite clear up space / dev / vda1, such as / opt

Release / dev / vda1 space:

[root@VM_58_118_centos syhuo.net]# cd /
[root@VM_58_118_centos /]# ll
The total amount of 80 
DR -XR-XR-X.   . 19 the root the root   4096 12 is dated . 11  15 : 16 ./ 
DR . -XR-XR-X   . 19 the root the root   4096 12 is dated . 11  15 : 16 ../
-rw-r--r--    1 root root     0 11月 26 2015 .autorelabel
lrwxrwxrwx    1 root root     7 3月  11 2016 bin -> usr/bin/
dr-xr-xr-x.   4 root root  4096 3月  25 2016 boot/
drwxr-xr-x   20 root root  4096 12月 11 15:16 data/
drwxr-xr-x   18 root root  2920 10月 29 11:31 dev/
drwxr-xr-x. 108 root root 12288 12月 11 11:21 etc/
drwxr-xr-x.   8 root root  4096 12月  5 23:14 home/
lrwxrwxrwx    1 root root     7 3月  11 2016 lib -> usr/lib/
lrwxrwxrwx    1 root root     9 3月  11 2016 lib64 -> usr/lib64/
drwx------.   2 root root 16384 11月 25 2015 lost+found/
drwxr-xr-x.   2 root root  4096 8月  12 2015 media/
drwxr-xr-x.   2 root root  4096 8月  12 2015 mnt/
drwxr-xr-x.   7 root root  4096 11月 29 10:20 opt/
dr-xr-xr-x  208 root root     0 10月 29 11:31 proc/
dr-xr-x---.  12 root root  4096 12月 11 11:42 root/
drwxr-xr-x   27 root root   960 12月  3 21:12 run/
lrwxrwxrwx    1 root root     8 3月  11 2016 sbin -> usr/sbin/
drwxr-xr-x.   2 root root  4096 8月  12 2015 srv/
dr-xr-xr-x   13 root root     0 10月 29 11:31 sys/
drwxrwxrwx.  12 root root  4096 12月 11 15:04 tmp/
drwxr-xr-x.  14 root root  4096 9月  23 2016 usr/
drwxr-xr-x.  22 root root  4096 10月 29 11:31 var/

[root@VM_58_118_centos /]# du -smh * | sort -n
[root@VM_58_118_centos /]# cd /opt
[root@VM_58_118_centos opt]# du -smh * | sort -n
4.0K    rh
11M    kibana
11M    remi
267M    logstash
1.2G    dbback

[root@VM_58_118_centos opt]# cd dbback
[root@VM_58_118_centos opt]# ll -h *
[root@VM_58_118_centos opt] -F * .sql.tgz RM #
[@ VM_58_118_centos the root opt ] DF # -H
file system capacity has been available for use with% loading point /dev/vda1 7.8G 5.9G 1.5G 80% / devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 24K 3.9G 1% /dev/shm tmpfs 3.9G 13M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vdb1 985G 594G 341G 64% /data tmpfs 783M 0 783M 0% /run/user/0
To / opt, for example, the same way to clean / usr, / var directory
Release / dev / vdb1 space:
[root@VM_58_118_centos opt]# cd /data/
[root@VM_58_118_centos data]# du -smh * | sort -n
[root@VM_58_118_centos data]# cd /data/httpd/logs/
[root@VM_58_118_centos data]# ll -h
[root@VM_58_118_centos logs]# rm -f /data/scripts/logs/*.log
[root@VM_58_118_centos logs]# rm -f /data/httpd/logs/*access*
[root@VM_58_118_centos logs]# cat /dev/null > /data/logstash.log
[root@VM_58_118_centos logs]# /data/www/syhuo.net/Uploads/app/apk 转存
[root@VM_58_118_centos logs]# /data/www/syhuo.net/Uploads/ota 转存

关闭apache访问日志
[root@VM_58_118_centos data]# cat /etc/httpd/conf/extra/httpd-vhosts.conf |grep CustomLog
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/syhuo.net-access-%y%m%d.log 86400" common env=!IMAGE
    #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/api.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/api.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/chart.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/myadmin.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/api.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/api.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/myadmin.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
        #CustomLog "| /usr/sbin/rotatelogs /data/httpd/logs/myadmin.syhuo.net-access-%Y%m%d.log 86400" common env=!IMAGE
[root@VM_58_118_centos logs]# systemctl restart httpd


Empty mysql error log file
[@ VM_58_118_centos the root Data] CAT # /etc/my.cnf|grep error log-
log-error = / Data / mysql / logs / mysqld.log
[@ VM_58_118_centos the root logs] CAT # / dev / null > /data/mysql/logs/mysqld.log

Close mysql log-bin log
[@ VM_58_118_centos the root Data] CAT # -n2 /etc/my.cnf|grep log-bin
. 46- # 50M the max_allowed_packet =
47-
48: Close # bin-log
49: # = log-bin / Data / MySQL / logs / log-bin.log
50- # expire_logs_days. 7 =
51- # = binlog_format Statement
[@ VM_58_118_centos the root logs] # systemctl the restart mysqld
 

to sum up:

Liu Chao   10 : 31 : 18 
file generated as much as possible to put / the Data directory, easy clean-up release space

Chao   10 : 31 is : 48 
off various logs, log files or regular cleaning apache, nginx, mysql etc.

Guess you like

Origin www.cnblogs.com/hnhycnlc888/p/12022978.html