最近在看學校 Server 的 Log 檔時,發現 Proxy Server 使用的 Cache 空間已經快要滿了!
/dev/sda2 20G 19G 451M 98% /cache1
/dev/sdb1 20G 19G 451M 98% /cache2
/dev/sda3 20G 19G 451M 98% /cache3
/dev/sdb2 20G 19G 450M 98% /cache4
/dev/sda2 => 98% Used. Warning. Disk Filling up.
/dev/sdb1 => 98% Used. Warning. Disk Filling up.
/dev/sda3 => 98% Used. Warning. Disk Filling up.
/dev/sdb2 => 98% Used. Warning. Disk Filling up.
[@more@]檢查一下設定檔,發現設定檔裡面並沒有設定磁碟空間使用的上限,所以加入了下面的設定,並且把 Proxy Server 重新啟動
cache_swap_low 90
cache_swap_high 95
這二行的意思是,當磁碟使用量達 95% 時,比較舊的快取資料將會被刪除,當刪除到剩下磁碟使用量達 90% 時,就停止持續刪除的動作。
但發現總空間使用容量還是一樣,並沒有減少,所以就決定把所有的 Cache 目錄下的檔案全部刪除,重新建立目錄
停止 Proxy Server
# service squid stop
刪除目錄
# rm -rf /cache{1..4}/*
重新建立 Proxy Server 目錄
# /usr/sbin/squid -z
啟動 Proxy Server
# service squid start
重新啟動 Proxy Server 後,Cache 空間的使用量就有變小了!
# df -h | grep /cache
/dev/sda2 20G 172M 19G 1% /cache1
/dev/sdb1 20G 172M 19G 1% /cache2
/dev/sda3 20G 172M 19G 1% /cache3
/dev/sdb2 20G 172M 19G 1% /cache4