[root@iZ23tkclljpZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 19G 33M 100% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 396M 404K 395M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user
[root@iZ23tkclljpZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 19G 51M 100% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 396M 408K 395M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user
[root@iZ23tkclljpZ ~]# ls
defaultPass
[root@iZ23tkclljpZ ~]# cd ..
[root@iZ23tkclljpZ /]# ls
alidata boot etc hs_err_pid1491.log initrd.img.old lib64 media nodejs proc root sbin sys TOMCAT_HOME var vmlinuz.old
bin dev home initrd.img lib lost+found mnt opt rabbitmq-signing-key-public.asc run srv tmp usr vmlinuz
[root@iZ23tkclljpZ /]# du -s -h ./*
11M ./alidata
9.6M ./bin
58M ./boot
4.0K ./dev
6.6M ./etc
8.0K ./home
0 ./hs_err_pid1491.log
0 ./initrd.img
0 ./initrd.img.old
441M ./lib
4.0K ./lib64
16K ./lost+found
4.0K ./media
4.0K ./mnt
2.3M ./nodejs
681M ./opt
du: cannot access ‘./proc/17287/task/17287/fd/4’: No such file or directory
du: cannot access ‘./proc/17287/task/17287/fdinfo/4’: No such file or directory
du: cannot access ‘./proc/17287/fd/4’: No such file or directory
du: cannot access ‘./proc/17287/fdinfo/4’: No such file or directory
0 ./proc
4.0K ./rabbitmq-signing-key-public.asc
90M ./root
408K ./run
9.0M ./sbin
8.0K ./srv
0 ./sys
4.2M ./tmp
0 ./TOMCAT_HOME
16G ./usr
1.8G ./var
0 ./vmlinuz
0 ./vmlinuz.old
[root@iZ23tkclljpZ /]# cd /var
[root@iZ23tkclljpZ var]# du -s -h ./*
1.9M ./backups
680M ./cache
980M ./lib
4.0K ./local
0 ./lock
31M ./log
4.0K ./mail
4.0K ./opt
0 ./run
36K ./spool
4.0K ./tmp
118M ./tomcat
12K ./www
[root@iZ23tkclljpZ var]# cd ..
[root@iZ23tkclljpZ /]# cd /usr/
[root@iZ23tkclljpZ usr]# du -s -h ./*
145M ./bin
4.0K ./games
20M ./include
885M ./lib
14G ./local
23M ./sbin
337M ./share
108M ./src
[root@iZ23tkclljpZ usr]# ls
bin games include lib local sbin share src
[root@iZ23tkclljpZ usr]# cd /local
-bash: cd: /local: No such file or directory
[root@iZ23tkclljpZ usr]# cd /lost+found/
[root@iZ23tkclljpZ lost+found]# ls
[root@iZ23tkclljpZ lost+found]# du -s -h ./*
du: cannot access ‘./*’: No such file or directory
[root@iZ23tkclljpZ lost+found]# ls
[root@iZ23tkclljpZ lost+found]# cd ..
[root@iZ23tkclljpZ /]# ls
alidata boot etc hs_err_pid1491.log initrd.img.old lib64 media nodejs proc root sbin sys TOMCAT_HOME var vmlinuz.old
bin dev home initrd.img lib lost+found mnt opt rabbitmq-signing-key-public.asc run srv tmp usr vmlinuz
[root@iZ23tkclljpZ /]# cd usr/
[root@iZ23tkclljpZ usr]# ls
bin games include lib local sbin share src
[root@iZ23tkclljpZ usr]# cd local
[root@iZ23tkclljpZ local]# ls
aegis bin etc games include lib man nginx sbin share src
[root@iZ23tkclljpZ local]# du -s -h ./*
169M ./aegis
4.0K ./bin
4.0K ./etc
4.0K ./games
4.0K ./include
24K ./lib
0 ./man
14G ./nginx
4.0K ./sbin
68K ./share
4.0K ./src
[root@iZ23tkclljpZ local]# ls
aegis bin etc games include lib man nginx sbin share src
[root@iZ23tkclljpZ local]# cd nginx/
[root@iZ23tkclljpZ nginx]# ls
assets client_body_temp conf fastcgi_temp fonts form html images js logs nginx proxy_temp scgi_temp twitter uwsgi_temp version
[root@iZ23tkclljpZ nginx]# du -s -h ./*
216K ./assets
4.0K ./client_body_temp
132K ./conf
4.0K ./fastcgi_temp
8.0K ./fonts
12K ./form
17M ./html
20M ./images
332K ./js
14G ./logs
4.8M ./nginx
124K ./proxy_temp
4.0K ./scgi_temp
24K ./twitter
4.0K ./uwsgi_temp
4.7M ./version
[root@iZ23tkclljpZ nginx]#
利用du -s -h ./* 命令逐级 缩小包围圈 找到占用磁盘高的文件。
锁定在nginx的日志文件。日志占了14g
先把日志暂停
nginx.conf 配置文件http 模块 增加access_log off;
http {
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 15;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
gzip_disable msie6;
#limit_zone crawler $binary_remote_addr 10m;
log_format '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
include /usr/local/nginx/conf/vhosts/*.conf;
access_log off ;#0426 删除日志
}
当然也可以对日志进行每天切割存储。