Chinaunix

标题: 怎么du 和 df -h 显示的使用目录文件大小不一样? [打印本页]

作者: winrar    时间: 2011-07-08 09:50
标题: 怎么du 和 df -h 显示的使用目录文件大小不一样?
大家帮我看看,u1目录显示用了31G, 怎么用du 显示了12G[


root@WT-ERP u1]# du -sh u1
12G     .
[root@WT-ERP u1]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              29G  7.5G   20G  28% /
/dev/sda11            284G  102G  169G  38% /backup
/dev/sda1             289M   18M  257M   7% /boot
/dev/sda5             241G  104G  125G  46% /data
none                  7.9G     0  7.9G   0% /dev/shm
/dev/sda10            7.7G   55M  7.3G   1% /repout
/dev/sda9             9.7G   55M  9.1G   1% /tmp
/dev/sda7              39G   36G  1.2G  97% /u1
/dev/sda6              39G   31G  6.2G  84% /u2
/dev/sda8             9.7G  8.4G  768M  92% /var
作者: ubuntuone    时间: 2011-07-08 10:32
这个是不一样的啊
作者: taojie2000    时间: 2011-07-08 10:38
回复 1# winrar

老话题了  

看懂下面这个

This section gives the technical explanation of why du and df sometimes report
different totals of disk space usage.

When a program that is running in the background writes to a file while the
process is running, the file to which this process is writing is deleted.
Running df and du shows a discrepancy in the amount of disk space usage.  The
df command shows a higher value.
作者: nagaregawa    时间: 2011-07-08 10:39
lsof | grep deleted 看一下就知道了
作者: Mr__zhang    时间: 2011-07-08 11:31
本节提供的技术解释为什么du和df有时报告
不同的总计磁盘空间使用情况。

当是在后台运行一个程序,写入文件,而
进程正在运行,这个过程是写入文件被删除。
运行df和du显示了一个在磁盘空间使用情况量的差异。 “
df命令显示了较高的价值。
作者: mxiaohua1768    时间: 2011-07-08 12:54
回复 3# taojie2000


    英文盲,看不懂!~




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2