|
AVideo 常见可清理位置如下。 先看哪里满:
df -h
du -h --max-depth=1 /var/www/html/AVideo | sort -h
du -h --max-depth=1 /var/www/html/AVideo/videos | sort -h
du -h --max-depth=1 /var/www/html/AVideo/cache 2>/dev/null | sort -h
du -h --max-depth=1 /tmp | sort -h
重点清这些:
# 1. AVideo 缓存
rm -rf /var/www/html/AVideo/cache/*
# 2. AVideo 临时目录
rm -rf /var/www/html/AVideo/videos/cache/*
rm -rf /var/www/html/AVideo/videos/tmp/*
rm -rf /var/www/html/AVideo/videos/temp/*
rm -rf /var/www/html/AVideo/videos/*.tmp
rm -rf /var/www/html/AVideo/videos/*.log
# 3. 系统临时文件
rm -rf /tmp/*
rm -rf /var/tmp/*
# 4. Apache 日志
truncate -s 0 /var/log/apache2/access.log
truncate -s 0 /var/log/apache2/error.log
# 5. AVideo 日志
find /var/www/html/AVideo -name "*.log" -type f -exec truncate -s 0 {} \;
然后重启:
systemctl restart apache2
systemctl restart mysql
再查:
df -h
如果还是很快满,查最大的文件:
find /var/www/html/AVideo -type f -size +100M -exec ls -lh {} \; | sort -k5 -h
find / -type f -size +500M -exec ls -lh {} \; 2>/dev/null | sort -k5 -h
你这个报错里有:
Error writing file /tmp/...
所以最可疑的是 /tmp 或 MySQL 临时文件空间不足。如果 /tmp 在根分区,10G 很快也可能被 MySQL 查询临时表吃掉。 可以先执行这一组最安全:
rm -rf /tmp/*
rm -rf /var/tmp/*
rm -rf /var/www/html/AVideo/cache/*
rm -rf /var/www/html/AVideo/videos/cache/*
systemctl restart apache2
systemctl restart mysql
df -h
另外,你之前 videos 目录有 60G 多,建议跑这个看真正占空间的目录:
du -h --max-depth=2 /var/www/html/AVideo/videos | sort -h
|