歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux磁盤空間短時間被未知資源大量占用情況處理

Linux磁盤空間短時間被未知資源大量占用情況處理

日期:2017/2/28 15:53:01   编辑:Linux教程
今天在進行Zabbix查看時,發現Zabbix Server機器上的硬盤在短時間內瘋狂增長了40G左右,如下圖:


在Zabbix Server中查看磁盤情況發現,根目錄下的空間比之前增長了很多:[root@zabbix ~]# df -ha


因為不知道具體的占用空間的文件路徑所在,所以只能用命令一個目錄一個目錄地進行查看,最終通過du -sh命令查到/var/log/httpd目錄占用空間異常:

[root@zabbix log]# du -sh httpd
45G httpd
[root@zabbix log]# cd httpd
[root@zabbix httpd]# ll
total 46988080
-rw-r--r-- 1 root root 47057993 Apr 16 09:56 access_log
-rw-r--r-- 1 root root 226646121 Apr 15 04:02 access_log.1
-rw-r--r-- 1 root root 413726 Apr 6 18:10 access_log.2
-rw-r--r-- 1 root root 47794017962 Apr 16 09:51 error_log
-rw-r--r-- 1 root root 593962 Apr 15 04:02 error_log.1
-rw-r--r-- 1 root root 31425 Apr 8 04:02 error_log.2

看到這時,才想起,之前為了測試zabbix與weathermap的結合測試,裝了weathermap,因為其主要是與cacti結合使用的,所以一直報錯,可能是因為這個原因吧,無論如何,先處理了它,將其目錄刪除,然後又手動刪除了/var/log/httpd內的文件:rm -rf /var/log/httpd/*

刪除了/var/log/httpd內的文件後,用df -ha看到的結果卻和之前仍然一樣,磁盤空間未被釋放。應該是未在硬盤上正式刪除,因為httpd和mysqld服務沒有stop,所以這兩個進程,應該還在用這些文件嘛,用 lsof -n | grep deleted命令查看,果然!!!如下圖:


無奈,刪都刪了,重啟一下這幾個服務好了:

[root@zabbix httpd]# /etc/init.d/mysqld restart

[root@zabbix httpd]# /etc/init.d/httpd restart

[root@zabbix httpd]# /etc/init.d/httpd

服務重啟後,再查看,一切正常。

更多關於ZABBIX 的詳細信息,或者下載地址請點這裡

Copyright © Linux教程網 All Rights Reserved