【已处理完】Centos 6.5版本,df -h出来的容量与du -sh的容量不对应是怎么会事呢?
问题如题,df -h 出来的容量与du -sh 查看的容量信息不一样,是那里出了问题了吗?
下面分别是du -sh *与df -h出来的结果
[root@mail /]# du -sh * 6.2M bin 22M boot 172K dev 29M etc 165G home 130M lib 26M lib64 16K lost+found 4.0K media 4.0K mnt 4.0K opt du: 无法访问"proc/9139/task/9139/fd/4": 没有那个文件或目录 du: 无法访问"proc/9139/task/9139/fdinfo/4": 没有那个文件或目录 du: 无法访问"proc/9139/fd/4": 没有那个文件或目录 du: 无法访问"proc/9139/fdinfo/4": 没有那个文件或目录 0 proc 0 result.txt 201M root 15M sbin 4.0K selinux 4.0K srv 0 sys 40K tmp 6.3G usr 349M var [root@mail /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50G 44G 3.4G 93% / tmpfs 2.4G 0 2.4G 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot /dev/mapper/VolGroup-lv_home 586G 165G 392G 30% /home [root@mail /]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@mail /]#
以上是相关查询命令的输出,下面是硬盘fdisk -l的输出信息
[root@mail /]# fdisk -l Disk /dev/sda: 536.9 GB, 536870912000 bytes 255 heads, 63 sectors/track, 65270 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00014e84 Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 65271 523774976 8e Linux LVM Disk /dev/sdb: 161.1 GB, 161061273600 bytes 255 heads, 63 sectors/track, 19581 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes 255 heads, 63 sectors/track, 6527 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/VolGroup-lv_swap: 5217 MB, 5217714176 bytes 255 heads, 63 sectors/track, 634 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/VolGroup-lv_home: 638.5 GB, 638494703616 bytes 255 heads, 63 sectors/track, 77625 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@mail /]#
之前也使用 badblocks 进行扫描了下,坏的块为0。
实在是找不出来相关的原因了,遂发出来希望路过的大神指点一下。
在此步骤之前也曾怀疑是否是因为有删除文件而没有释放出来而导致的,然后删除了一些文件,容量间也会直接减少,也有进行重启过服务器,小弟菜鸟。在发贴期间仍也会不停的自已进行寻找答案。
谢谢!
----------------------------------------------------处理步骤--------------------------------------------------------------------------------
以下跟上排查的步骤:
先使用
#lsof |grep deleted
这个命令看下有没有什么进程正在写。
[root@mail /]# lsof |grep deleted
dovecot 1256 root 110u REG 253,0 0 3148313 /usr/local/u-mail/data/dovecot/run/dovecot/login-master-notify05d38466580f94c5 (deleted)
dovecot 1256 root 127u REG 253,0 0 3148357 /usr/local/u-mail/data/dovecot/run/dovecot/login-master-notifyd14e8b6fc98a9e9f (deleted)
dovecot 1256 root 130u REG 253,0 0 3148662 /usr/local/u-mail/data/dovecot/run/dovecot/login-master-notify7400f77e8b2eb8b1 (deleted)
mysqld 1652 umail_mysql 3w REG 253,0 38989980588 1310730 /tmp/umail_mysql.log (deleted)
imap-logi 5024 nobody 4u REG 253,0 0 3148662 /usr/local/u-mail/data/dovecot/run/dovecot/login-master-notify7400f77e8b2eb8b1 (deleted)
httpd 11983 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 15024 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 20518 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 21333 root 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 21950 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 23138 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 27809 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
imap 31025 umail 13u REG 253,2 27458 9712981 /home/mailbox/fslzz.com.cn/0/zhudg/dovecot-uidlist (deleted)
httpd 31924 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 31925 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
httpd 31926 umail_apache 10u REG 253,0 0 1310725 /tmp/ZCUDSP6pa7 (deleted)
[root@mail /]#
看到其中有个进程有异常大小也比较大。根据ID查相关的进程,然后得知这个文件是mysql的general_log这个日志文件开启所导致的。
找到:/usr/local/u-mail/config/mysql/my.cnf 这个配置文件,将里面的
这两行注释掉。
并且重启umail_mysqld的服务,然后再使用df -h查看一下进程。
看到进程及容量已经被处理掉了。恢复正常。不易