Isilon:事件通知:var 磁碟分割即將達到容量限制,事件 ID:100010001
Summary: 本文討論在 Var 磁碟分割達到容量限制時,清理磁碟分割的方法。
Symptoms
事件
將發出以下事件通知之一:
The /var partition is near capacity (95% used) The /var partition is near capacity (85% used) The /var partition is near capacity (75% used)
詳細資訊
當 /var 磁碟分割達到 75%、85% 或 95% 容量時,系統會記錄事件並傳送警示。
Cause
/var 資料夾包含大量叢集功能的記錄、診斷檔案、組態資料和暫存檔案。隨著時間推移, /var 資料夾中可能會累積各種額外的檔案,導致其填滿。
這 /var/log/wtmp 檔案與變換檔案 /var/log/wtmp.0, /var/log/wtmp.1,例如,將大小增加到超過 10 MB。有時會增加到 150 MB。可使用 /var/log/wtmp file 是記錄登入和登出資料的二進位記錄檔。日誌管理員檔, /etc/newsyslog.conf, 不會像存檔其他日誌檔那樣歸檔,因此 /var/log/wtmp 可以增長並填充 /var 目錄。
Resolution
以下是 /var 磁碟分割的預設內容,以及更相關的子目錄的簡短說明。除非另有說明,否則不應更改或刪除 /var 及其子目錄中的內容和數據。
ps9500x3-2# cd /var ps9500x3-2# ls .snap at backups db ifs lib patch spool account audit cache empty journal log preserve tmp agentx authpf crash games journal-peer mail run unbound apache2 backup cron heimdal krb5kdc msgs rwho yp .snap Snapshots. Do not touch. account Account information. Do not touch. agentx Empty but preserved for Agent Extensibility (AgentX) Protocol apache2 Apache Files. Do not touch. at Variable data. Do not touch. audit Audit Files. Do not touch. authpf Authentication gateway. Do not touch. backup System configuration backup files. Do not touch backups Group configuration backups. Do not touch cache System cache. Do not touch. crash Crash files, older files can be deleted if needed cron Cron jobs, do not touch db Database files. Do not touch empty Do not touch. games Empty but preserved. heimdal Kerberos 5 protocol. Do not touch. ifs Do not touch unless directed by support journal System Journal database journal-peer System Journal-peer database krb5kdc Kerberos KDC (Key Distribution Center) lib Likewise database files. Do not touch log Various System log files, can be cleared but zero's out the system logs. mail Mail sub-system files. msgs Message logs patch System patch database. Do not touch preserve Do not touch run Do not touch rwho Do Not Touch spool System Spool files. Do not touch. tmp Healthcheck items and vi recover. Do not touch. unbound Do Not Touch yp Do Not Touch
需要注意的兩個目錄是 /var/crash 和 /var/logs,因為這些目錄可能會成長並佔用 /var 磁碟分割中的大部分磁碟空間。
如果不再需要 /var/crash 中的舊版當機檔案,可以將其移除。
如果記錄過大,可將 /var/logs 清零並重設。請記住,一旦重置日誌,就無法再對過去的問題進行故障排除和研究。
檢閱 /var 磁碟分割的 df 輸出。根據輸出,執行下列一或多項工作:
ps9500x3-2# df Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/mirror/root0 1957292 871082 929628 48% / devfs 1 1 0 100% /dev /dev/mirror/var0 978604 51394 848922 6% /var /dev/mirror/var-crash 2946284 10 2710572 0% /var/crash /dev/mirror/keystore 61228 46 56284 0% /keystore /dev/md0 61166 2158 54116 4% /tmp/ufp /dev/md1.uzip 435751 406426 -5535 101% /base OneFS 246327840 2362592 173903776 1% /ifs ps9500x3-2#
轉換記錄:
有關如何輪換日誌的詳細指示,請參閱知識文章 20315,Isilon:OneFS-如何輪換節點的系統記錄。轉換記錄的命令:
newsyslog -f
如果 /var 磁碟分割區回到正常的使用量等級,請檢閱最近寫入的記錄清單,以判斷特定記錄是否經常遭到轉換。轉換可以壓縮或移除大型記錄和舊記錄,以自動降低分割區使用量,以解決分割區容量問題。
檢查可用 inode 的百分比:
開啟與報告錯誤的節點的 SSH 連線,然後使用「root」帳戶登入。執行下列命令:
df -i |grep var |grep -v crash將顯示類似於以下內容的輸出:
Filesystem 1K-blocks Used Avail Capacity iused ifree %iused Mounted on /dev/mirror/var0 1013068 49160 882864 5% 1650 139276 100% /var如果 %iused 值 為 90% 或更高,請使用下面描述的方法之一減少 /var 分區中的文件數。
識別不屬於 /var 磁碟分割的檔案:
- 在產生警示的節點上執行下列命令,列出 在 /var 磁碟分割中大於 5 MB 的檔案:
find -x /var -type f -size +10000 -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
- 在輸出結果中尋找通常不屬於 /var 磁碟分割的檔案。例如 OneFS 安裝程式檔案、記錄收集或使用者建立的檔案。
- 移除檔案,或將其移動至 /ifs 目錄。
從 /var 分割區手動移除檔案:
識別額外檔案後,清理 /var 目錄所需的命令通常包括建立目錄 (mkdir)、複製 (cp)、移動 (mv) 和移除 (rm)。在繼續之前,使用者應熟悉這些基本的 UNIX/Linux 命令。
請務必先製作檔案備份複本,再將其刪除或從原始位置移動。
建立要移動或複製備份資料的目錄,其中 <dest> 是目的地目錄。應將所有要刪除的檔案備份複本先複製到此目錄。
# mkdir /ifs/data/Isilon_Support/<dest>
根據需要複製、移動或刪除檔案:
複製檔案或目錄:
# cp <file> /ifs/data/Isilon_Support/<dest>
以遞歸方式複製目錄。
# cp -R <directory> /ifs/data/Isilon_Support/<dest>
移動檔案或目錄:
# mv <file> /ifs/data/Isilon_Support/<dest> # mv <directory> /ifs/data/Isilon_Support/<dest>
若要移除/刪除檔案:
# rm <file>
判斷程序是否開啟了大型檔案。
使用 fstat 命令列出節點或目錄上打開的檔,或列出進程已打開的檔。開啟的檔案清單可協助您監控寫入大型檔案的程序。請參閱如何使用 fstat 命令列出節點上開啟的檔案,文章 21402,Isilon:如何使用 fstat 命令列出節點上開啟的檔案。
如果上述工作都不能解決問題,請前往下列解決方案:
限制復原檔案大小,並壓縮檔案
- 在叢集的任何節點上開啟 SSH 連線,然後使用「root」帳戶登入。
- 執行下列命令,以建立 /etc/newsyslog.conf 檔案的備份:
cp /etc/newsyslog.conf /ifs/newsyslog.conf cp /etc/newsyslog.conf /etc/newsyslog.bak
- 在文字編輯器中開啟 /ifs/newsyslog.conf 檔案。
- 找到下列這行:
/var/log/wtmp 644 3 * @01T05 B
- 將這一行變更為:
/var/log/wtmp 644 3 10000 @01T05 ZB這些變更會指示系統在 /var/log/wtmp 檔案達到 10 MB 時將其滾動更新,並使用 gzip 壓縮檔。
- 儲存並關閉 /ifs/newsyslog.conf 檔案。
- 執行下列命令,將更新的檔案複製到叢集上的所有節點:
isi_for_array 'cp /ifs/newsyslog.conf /etc/newsyslog.conf'
- 如有必要,記錄檔會在一小時和半小時內使用 cron 工作自動轉換 (/etc/crontab)
#minute hour mday month wday who command # # rotate log files every half-hour, if necessary 0,30 * * * * root newsyslog如果其他記錄經常輪替,或上述步驟無法解決問題,請聯絡 Dell 技術支援部門以取得協助。