На одном виртуальном сервере со временем стало «пропадать» дисковое пространство. Команда df показывала что используется около 1.1G, а du что всего 541M
[root@vps var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/ploop14221p1 9.4G 7.9G 1.1G 89% /
none 600M 4.0K 600M 1% /dev
none 600M 0 600M 0% /dev/shm |
[root@vps var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/ploop14221p1 9.4G 7.9G 1.1G 89% /
none 600M 4.0K 600M 1% /dev
none 600M 0 600M 0% /dev/shm
[root@vps var]# du -h --max-depth=1
4.0K ./games
108K ./run
4.0K ./cvs
4.0K ./preserve
84K ./spool
317M ./log
4.0K ./local
64M ./cache
8.0K ./empty
4.0K ./opt
32K ./named
39M ./lib
8.0K ./lock
4.0K ./yp
4.0K ./nis
12K ./db
4.0K ./tmp
124M ./www
541M . |
[root@vps var]# du -h --max-depth=1
4.0K ./games
108K ./run
4.0K ./cvs
4.0K ./preserve
84K ./spool
317M ./log
4.0K ./local
64M ./cache
8.0K ./empty
4.0K ./opt
32K ./named
39M ./lib
8.0K ./lock
4.0K ./yp
4.0K ./nis
12K ./db
4.0K ./tmp
124M ./www
541M .
Оказалось что не корректно был настроен сервис logrotate.d. При ротации лог файлов не перезапускался nginx. Выявить эту ошибку помогла команда lsof которая показывает файлы используются
root@vps nginx]# /usr/sbin/lsof |grep /var |grep deleted |awk '{print $7,$2,$4,$9}' | sort -n | tail
2642906319 24342 4w (deleted)/var/log/nginx/error.log-20150201
2642906319 24343 2w (deleted)/var/log/nginx/error.log-20150201
2642906319 24343 4w (deleted)/var/log/nginx/error.log-20150201
2642906718 24344 2w (deleted)/var/log/nginx/error.log-20150201
2642906718 24344 4w (deleted)/var/log/nginx/error.log-20150201
3732656305 24339 5w (deleted)/var/log/nginx/access.log-20150201
3732656305 24341 5w (deleted)/var/log/nginx/access.log-20150201
3732656305 24342 5w (deleted)/var/log/nginx/access.log-20150201
3732656305 24343 5w (deleted)/var/log/nginx/access.log-20150201
3732656514 24344 5w (deleted)/var/log/nginx/access.log-20150201 |
root@vps nginx]# /usr/sbin/lsof |grep /var |grep deleted |awk '{print $7,$2,$4,$9}' | sort -n | tail
2642906319 24342 4w (deleted)/var/log/nginx/error.log-20150201
2642906319 24343 2w (deleted)/var/log/nginx/error.log-20150201
2642906319 24343 4w (deleted)/var/log/nginx/error.log-20150201
2642906718 24344 2w (deleted)/var/log/nginx/error.log-20150201
2642906718 24344 4w (deleted)/var/log/nginx/error.log-20150201
3732656305 24339 5w (deleted)/var/log/nginx/access.log-20150201
3732656305 24341 5w (deleted)/var/log/nginx/access.log-20150201
3732656305 24342 5w (deleted)/var/log/nginx/access.log-20150201
3732656305 24343 5w (deleted)/var/log/nginx/access.log-20150201
3732656514 24344 5w (deleted)/var/log/nginx/access.log-20150201