今天看服务器探针,吓了我一跳,发现硬盘空间剩余6.2G左右。
仔细想想没有往服务器上传什么大的文件,也不能被黑(不起眼的小网站服务器)。于是,就逐一的检查"/"下的所有文件占用磁盘空间的大小。
[root@localhost ~]# du -s /* 6160 /bin 19380 /boot 156 /dev 21700 /etc 2383236 /home 112372 /lib 16 /lost+found 4 /media 4 /mnt 4 /opt du: 无法访问"/proc/2187/task/2187/fd/4": 没有那个文件或目录 du: 无法访问"/proc/2187/task/2187/fdinfo/4": 没有那个文件或目录 du: 无法访问"/proc/2187/fd/4": 没有那个文件或目录 du: 无法访问"/proc/2187/fdinfo/4": 没有那个文件或目录 0 /proc 56 /root 9488 /sbin 4 /selinux 4 /srv 0 /sys 14760 /tmp 37310312 /usr 90452 /var
发现/usr占用了大约37.3G的磁盘空间,然后进入/usr检查。
[root@localhost ~]# du -s /usr/local/* 944 /usr/local/autoconf-2.13 472 /usr/local/bin 87568 /usr/local/eaccelerator_cache 4 /usr/local/etc 4 /usr/local/games 172 /usr/local/include 13824 /usr/local/ioncube 4100 /usr/local/lib 4 /usr/local/libexec 36 /usr/local/man 36436840 /usr/local/mysql 5108 /usr/local/nginx 53440 /usr/local/php 4 /usr/local/sbin 2620 /usr/local/share 4 /usr/local/src 900 /usr/local/zend
从返回的命令看出,占用最大的是/usr/local/mysql,继续检查。
[root@localhost ~]# du -s /usr/local/mysql/var/* 552 /usr/local/mysql/var/0t9 71196 /usr/local/mysql/var/feifeicms 1640 /usr/local/mysql/var/idc@002elianst@002ecom 320 /usr/local/mysql/var/localhost.localdomain.err 4 /usr/local/mysql/var/localhost.localdomain.pid 1032 /usr/local/mysql/var/mysql 28 /usr/local/mysql/var/mysql-bin.000001 1048 /usr/local/mysql/var/mysql-bin.000002 4 /usr/local/mysql/var/mysql-bin.000003 4 /usr/local/mysql/var/mysql-bin.000004 4 /usr/local/mysql/var/mysql-bin.000005 5092 /usr/local/mysql/var/mysql-bin.000006 3808 /usr/local/mysql/var/mysql-bin.000007 508 /usr/local/mysql/var/mysql-bin.000008 8 /usr/local/mysql/var/mysql-bin.000009 4 /usr/local/mysql/var/mysql-bin.000010 72 /usr/local/mysql/var/mysql-bin.000011 16 /usr/local/mysql/var/mysql-bin.000012 36 /usr/local/mysql/var/mysql-bin.000013 116 /usr/local/mysql/var/mysql-bin.000014 4 /usr/local/mysql/var/mysql-bin.000015 44 /usr/local/mysql/var/mysql-bin.000016 84 /usr/local/mysql/var/mysql-bin.000017 976 /usr/local/mysql/var/mysql-bin.000018 36 /usr/local/mysql/var/mysql-bin.000019 628 /usr/local/mysql/var/mysql-bin.000020 872 /usr/local/mysql/var/mysql-bin.000021 1428 /usr/local/mysql/var/mysql-bin.000022 4 /usr/local/mysql/var/mysql-bin.000023 16 /usr/local/mysql/var/mysql-bin.000024 44 /usr/local/mysql/var/mysql-bin.000025 28 /usr/local/mysql/var/mysql-bin.000026 76 /usr/local/mysql/var/mysql-bin.000027 12 /usr/local/mysql/var/mysql-bin.000028 104 /usr/local/mysql/var/mysql-bin.000029 40 /usr/local/mysql/var/mysql-bin.000030 76 /usr/local/mysql/var/mysql-bin.000031 ……
通过检查看到,好多mysql-bin.000XXX的文件,而且都还很大。经过询问度娘发现,此文件为mysql的日志文件,是可以删除的。因为这些日志文
件太大了,对我来说用处不大,索性就直接给关闭了。
[root@localhost ~]# vi /etc/my.cnf 在log-bin前面加上"#"
然后重启服务器,再次查看,就不会在产生日志文件了!
评论回复