[20201104]磁碟空間消耗在哪裡.txt
[20201104]磁碟空間消耗在哪裡.txt
--//昨天檢查我發現根檔案系統的空間在慢慢消耗,但是不知道消耗在哪裡?
# df -m / ;sleep 5;df -m /
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
201587 98607 92743 52% /
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
201587 98667 92683 52% /
--//單位可是M,可以發現92743-92683 = 60M,可以發現5秒的時間已經消耗60M,這是相對很大的"量".
--//實際上開始我執行的是df 顯示的單位是g,但是我再重複執行時發現Available從92g -> 91g,這才仔細檢查,引起重視。
# du -sm /var/log
1302 /var/log
--//說明/var/log並沒有使用太多磁碟空間。
--//這次有了昨天連結:http://blog.itpub.net/267265/viewspace-2731783/=>[20201103]lsof顯示link=0的檔案.txt
# lsof +L1 | grep "/tmp/q"
dg4msql 4090 oracle 7ur REG 252,0 0 0 1640857 /tmp/qec0vT4Z (deleted)
dg4msql 20893 oracle 7u REG 252,0 65051921 0 1640926 /tmp/qeGp3ORj (deleted)
dg4msql 25609 oracle 7u REG 252,0 1821887369 0 1638432 /tmp/qeeKJCl2 (deleted)
dg4msql 36262 oracle 7u REG 252,0 73348604 0 1638441 /tmp/qeSquXKK (deleted)
dg4msql 89244 oracle 7u REG 252,0 1848225807 0 1638436 /tmp/qemsv7vr (deleted)
dg4msql 92746 oracle 7ur REG 252,0 0 0 1639715 /tmp/qehco6je (deleted)
dg4msql 93770 oracle 7u REG 252,0 17731541 0 1638442 /tmp/qeQRtgir (deleted)
dg4msql 101216 oracle 7ur REG 252,0 72496082944 0 1638443 /tmp/qe73QgZA (deleted)
dg4msql 130059 oracle 7u REG 252,0 65042418 0 1640597 /tmp/qeIt3oBP (deleted)
--// /tmp/qe73QgZA 已經佔了 72496082944/1024/1024/1024 = 67.52G,很明顯感覺問題在這裡,我估計tmpwatch給刪除了這些檔案。但是
--//我有遇到奇怪的現象,檔案大小不變,我再次執行發現
# tail -c 100 /proc/101216/fd/7 | md5sum
7e6711da3d27a4f5a0db45645fda0bbd -
# tail -c 100 /proc/101216/fd/7 | md5sum
7e6711da3d27a4f5a0db45645fda0bbd -
--//可以發現md5校驗資訊沒有變化,也就是這些檔案不會變化,也就是定位不對。
--//那麼磁碟空間消耗在哪裡呢?在測試環境測試看看。
1.環境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SCOTT@book> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
30 15381 24625 DEDICATED 24626 26 168 alter system kill session '30,15381' immediate;
SCOTT@book> @ pp
TRACEFILE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc
2.測試:
SCOTT@book> @ 10046on 12
Session altered.
SCOTT@book> select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
$ ls -l /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc
-rw-r----- 1 oracle oinstall 21846 2020-11-04 09:05:46 /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc
$ rm /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc
/bin/rm: remove regular file `/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc'? y
# lsof +L1 |egrep "COMMAND|/u01/app"
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
oracle 24626 oracle 8w REG 104,6 21846 0 370409544 /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc (deleted)
--//大小21846能對上。
SCOTT@book> select count(*) from dept;
COUNT(*)
----------
4
# lsof +L1 |egrep "COMMAND|/u01/app"
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
oracle 24626 oracle 8w REG 104,6 23440 0 370409544 /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_24626.trc (deleted)
--//很明顯大小發生了變化。那麼這些磁碟空間到底消耗在哪裡呢?
3.返回問題現場:
# df -m /
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
201587 99586 91764 53% /
--//不到10分鐘 92743-91764 = 979m,多麼可怕的數量。該如何定位呢?
# lsof +L1 | grep "/tmp/q"
dg4msql 4090 oracle 7ur REG 252,0 0 0 1640857 /tmp/qec0vT4Z (deleted)
dg4msql 20893 oracle 7u REG 252,0 65051921 0 1640926 /tmp/qeGp3ORj (deleted)
dg4msql 25609 oracle 7u REG 252,0 1821887369 0 1638432 /tmp/qeeKJCl2 (deleted)
dg4msql 36262 oracle 7u REG 252,0 73348604 0 1638441 /tmp/qeSquXKK (deleted)
dg4msql 89244 oracle 7u REG 252,0 1848225807 0 1638436 /tmp/qemsv7vr (deleted)
dg4msql 92746 oracle 7ur REG 252,0 0 0 1639715 /tmp/qehco6je (deleted)
dg4msql 93770 oracle 7u REG 252,0 17731541 0 1638442 /tmp/qeQRtgir (deleted)
dg4msql 101216 oracle 7ur REG 252,0 72496082944 0 1638443 /tmp/qe73QgZA (deleted)
dg4msql 130059 oracle 7u REG 252,0 65042418 0 1640597 /tmp/qeIt3oBP (deleted)
--//仔細觀察發現:
# du -sm /opt
18531 /opt
# du -sm /opt
18536 /opt
--//寫的是/opt目錄。最終發現主要寫/opt/oracle.ExaWatcher/archive目錄。
# ls -l /opt/oracle.ExaWatcher/archive
total 2612
drwxr----- 2 root root 339968 2020-11-04 09:40:35 Diskinfo.ExaWatcher
drwxr----- 2 root root 4096 2018-05-09 10:55:51 ExtractedResults
drwxr----- 2 root root 339968 2020-11-04 09:40:35 IBCardInfo.ExaWatcher
drwxr----- 2 root root 315392 2020-11-04 09:40:35 IBprocs.ExaWatcher
drwxr----- 2 root root 311296 2020-11-04 09:40:35 Iostat.ExaWatcher
drwxr----- 2 root root 233472 2020-11-04 09:40:35 LGWR.ExaWatcher
drwxr----- 2 root root 65536 2020-11-04 09:42:14 Lsof.ExaWatcher
drwxr----- 2 root root 4096 2020-11-04 06:38:44 MegaRaidFW.ExaWatcher
drwxr----- 2 root root 303104 2020-11-04 09:40:35 Meminfo.ExaWatcher
drwxr----- 2 root root 311296 2020-11-04 09:40:35 Mpstat.ExaWatcher
drwxr----- 2 root root 65536 2020-11-04 09:41:45 Netstat.ExaWatcher
drwxr----- 2 root root 57344 2020-11-04 09:40:35 Ps.ExaWatcher
drwxr----- 2 root root 65536 2020-11-04 09:40:35 RDSinfo.ExaWatcher
drwxr----- 2 root root 69632 2020-11-04 09:40:35 Slabinfo.ExaWatcher
drwxr----- 2 root root 69632 2020-11-04 09:40:34 Top.ExaWatcher
drwxr----- 2 root root 61440 2020-11-04 09:40:38 Vmstat.ExaWatcher
# ps -ef | grep ExaWatche[r]
root 15882 1 0 2014 ? 00:00:00 /bin/bash ./ExaWatcher.sh --fromconf
root 16879 15882 0 2014 ? 8-06:09:44 /usr/bin/perl /opt/oracle.ExaWatcher/ExecutorExaWatcher.pl /opt/oracle.ExaWatcher/ExaWatcher.execonf
root 17356 16879 0 2014 ? 00:00:00 sh -c /opt/oracle.ExaWatcher/ExaWatcherCleanup.sh 1400199952 1715732732 3600 /opt/oracle.ExaWatcher/archive/ 3145728 2>>/dev/null
root 17357 17356 0 2014 ? 17:58:05 /bin/bash /opt/oracle.ExaWatcher/ExaWatcherCleanup.sh 1400199952 1715732732 3600 /opt/oracle.ExaWatcher/archive/ 3145728
root 44434 16879 0 08:47 ? 00:00:00 sh -c /usr/bin/mpstat -P ALL 5 720 2>/dev/null >> /opt/oracle.ExaWatcher/archive/Mpstat.ExaWatcher/2020_11_04_08_47_28_MpstatExaWatcher_dm01dbadm01.xxxxxxxx.com.dat
root 57416 16879 0 09:44 ? 00:00:00 sh -c /usr/sbin/lsof +c0 -w +L -b -R -i 2>/dev/null >> /opt/oracle.ExaWatcher/archive/Lsof.ExaWatcher/2020_11_04_09_33_51_LsofExaWatcher_dm01dbadm01.xxxxxxxx.com.dat
root 61135 16879 0 09:46 ? 00:00:00 sh -c /bin/netstat -n -p -l 2>/dev/null >> /opt/oracle.ExaWatcher/archive/Netstat.ExaWatcher/2020_11_04_09_41_45_NetstatExaWatcher_dm01dbadm01.xxxxxxxx.com.dat
root 61139 16879 0 09:46 ? 00:00:00 sh -c /usr/bin/vmstat 5 2 >> /opt/oracle.ExaWatcher/archive/Vmstat.ExaWatcher/2020_11_04_09_33_42_VmstatExaWatcher_dm01dbadm01.xxxxxxxx.com.dat
root 114134 16879 0 09:23 ? 00:00:00 sh -c /usr/bin/top -b -d 5 -n 720 2>/dev/null >> /opt/oracle.ExaWatcher/archive/Top.ExaWatcher/2020_11_04_09_23_44_TopExaWatcher_dm01dbadm01.xxxxxxxx.com.dat
root 117607 16879 0 09:25 ? 00:00:00 sh -c /usr/bin/iostat -t -x 5 720 2>/dev/null >> /opt/oracle.ExaWatcher/archive/Iostat.ExaWatcher/2020_11_04_09_25_45_IostatExaWatcher_dm01dbadm01.xxxxxxxx.com.dat
--//很明顯oracle exadata後臺在不斷收集主機資訊,消耗大量磁碟空間。
--//它也會定時排程sh -c /opt/oracle.ExaWatcher/ExaWatcherCleanup.sh清除資訊。
# df -m /
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/VGExaDb-LVDbSys1
201587 97870 93480 52% /
--//可以發現現在磁碟空間又回來了。
--//現在終於可以定位問題了,實際上dg4msql程式生產的臨時檔案放在/tmp目錄,而tmpwatch排程刪除了這些檔案,而對應的檔案控制程式碼
--//並沒有釋放.開始以為問題在這裡,實際情況不是。
--//exadata機器會不斷記錄機器一些資訊用於事後分析導致消耗大量磁碟空間。實際上我覺得可能跟最近連線接數量暴漲存在關係,原來
--//連線數45XX而現在漲到74XX,這樣每次寫入的資訊就大很多。
--//至於dg4msql產生的臨時檔案如何清除,方法很多。估計也可以執行
# >| /proc/130059/fd/7
--//安全起見,我還是不亂動了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2732010/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20230201]磁碟空間爆滿.txt
- [20211029]udump磁碟空間暴漲.txt
- [20201104]dstat使用迷惑.txt
- 磁碟空間不足
- 如何檢查Mac磁碟空間,mac磁碟空間其他怎麼清理Mac
- [20190505]ts 命令在哪裡.txt
- win10 如何修改磁碟空間 win10修改磁碟空間方法Win10
- Oracle 擴充磁碟空間Oracle
- [20201104]關於稀疏檔案(sparse files).txt
- ubuntu 擴充套件磁碟空間Ubuntu套件
- docker磁碟空間清理辦法Docker
- windows10磁碟空間不足怎麼清理_win10磁碟空間清理的方法WindowsWin10
- WSL 回收未使用的磁碟空間
- 伺服器磁碟空間滿了伺服器
- ORACLE ASM磁碟組空間溢位OracleASM
- lsof |grep deleted 釋放磁碟空間delete
- 沒有磁碟空間 No space left on devicedev
- linux檢視剩餘磁碟空間Linux
- 檢視temp表空間的消耗明細情況
- ORACLE ASM的SSD磁碟空間回收分析OracleASM
- linux檢視mysql佔用磁碟空間LinuxMySql
- Linux 磁碟掛載和swap空間管理Linux
- PHP 獲取伺服器磁碟空間PHP伺服器
- 檢視佔用磁碟空間的程式
- windows10磁碟清理在哪裡找_win10系統如何清理磁碟WindowsWin10
- MySQL 可以壓縮或回收磁碟空間嗎MySql
- 檢視磁碟使用空間和檔案大小
- Linux檢查Docker映象,容器的磁碟空間LinuxDocker
- 學習下Linux 如何檢視磁碟空間Linux
- Linux磁碟空間佔滿問題快速排雷Linux
- 空間都去哪裡了?(中)
- [20181021]臨時表lob段建立在哪裡.txt
- yaml檔案中在哪加名稱空間?YAML
- 如何解決Linux磁碟空間過大或不足?Linux
- linux建立新分割槽擴充套件磁碟空間Linux套件
- Mac技巧14:如何在Mac上清理磁碟空間?Mac
- 磁碟空間分析工具Disk Graph,讓您清楚瞭解磁碟都有什麼
- [20230206]整理awr佔用空間3.txt