在 Debian 系统中,“缓存”通常可能指以下几类:
下面按场景说明如何“诊断” Debian 中的缓存。
du -sh /var/cache/apt/archives
ls -lh /var/cache/apt/archives
# 删除已卸载软件的缓存
apt-get clean
# 删除旧版本缓存
apt-get autoclean
apt-cache stats
free -h
关注:
buff/cacheavailablecat /proc/meminfo | grep -E 'Cached|Buffers|SReclaimable'
Linux 会自动回收 cache,一般不会导致 OOM。
若怀疑问题:
vmstat 1
观察 cache / si / so
sync
echo 3 > /proc/sys/vm/drop_caches
journalctl --disk-usage
journalctl --vacuum-size=100M
配置文件:
/etc/systemd/journald.conf
du -sh /var/cache/nginx
du -sh /var/cache/apt-cacher-ng
df -i
du -h /var/cache | sort -h | tail
free -h
df -h
du -sh /var/cache/*
apt-cache stats
journalctl --disk-usage
如果你能具体说明:
我可以给你更针对性的诊断步骤。