“Linux cleanup” 这个词可能有几种含义,我先按最常见的三种场景给你排查思路,你可以对照自己的情况:
systemctl status systemd-tmpfiles-clean
systemctl list-timers | grep tmpfiles
配置文件位置:
/etc/tmpfiles.d/
/usr/lib/tmpfiles.d/
重点看 tmp.conf 里对 /tmp、/var/tmp 的清理规则。
# Debian/Ubuntu
cat /etc/apt/apt.conf.d/* | grep -i clean
apt-config dump | grep Clean
# RHEL/CentOS
cat /etc/yum.conf | grep clean
crontab -l
ls -l /etc/cron.daily/ /etc/cron.weekly/
cat /etc/cron.daily/tmpwatch 2>/dev/null
ausearch -m DELETE -ts recent
或
journalctl | grep -i cleanup
history | grep cleanup
ps aux | grep cleanup
lsof | grep deleted
grep -R "rm -rf" /etc /usr/local /opt 2>/dev/null
df -h
du -sh /* 2>/dev/null
# 包缓存
apt clean
yum clean all
# 旧内核
dpkg -l | grep linux-image
apt autoremove --purge
# 日志
journalctl --vacuum-time=7d
docker system df
docker system prune
我可以直接帮你定位是哪一层在做 cleanup。