当前位置: 技术问答>linux和unix
df du 显示大小不一致
来源: 互联网 发布时间:2017-02-16
本文导语: 随便来个人回答下 用df查看我的系统 显示 /dev/sda6 3.9G 1.4G 2.4G 36% /var /dev/sda3 9.7G 9.7G 0 100% /usr 而用du查看 [root@localhost usr]# du -skh /usr 3.6G /usr 这是那里...
随便来个人回答下 用df查看我的系统 显示
/dev/sda6 3.9G 1.4G 2.4G 36% /var
/dev/sda3 9.7G 9.7G 0 100% /usr
而用du查看
[root@localhost usr]# du -skh /usr
3.6G /usr
这是那里不对? 菜鸟
/dev/sda3 没有其它的挂载点了 我的usr空间那里去了 怎么查看
谢谢
/dev/sda6 3.9G 1.4G 2.4G 36% /var
/dev/sda3 9.7G 9.7G 0 100% /usr
而用du查看
[root@localhost usr]# du -skh /usr
3.6G /usr
这是那里不对? 菜鸟
/dev/sda3 没有其它的挂载点了 我的usr空间那里去了 怎么查看
谢谢
|
重启下系统估计结果就不一样了,注意df和du的区别
给楼主复制一段:
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.
Explanation Summary
----------- -------
When you open a file, you get a pointer. Subsequent writes to this file
references this file pointer. The write call does not check to see if the file
is there or not. It just writes to the specified number of characters starting
at a predetermined location. Regardless of whether the file exist or not, disk
blocks are used by the write operation.
The df command reports the number of disk blocks used, while du goes through the
file structure and reports the number of blocks used by each directory. As
far as du is concerned, the file used by the process does not exist, so it does
not report blocks used by this phantom file. But df keeps track of disk blocks
used, and it reports the blocks used by this phantom file.
给楼主复制一段:
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.
Explanation Summary
----------- -------
When you open a file, you get a pointer. Subsequent writes to this file
references this file pointer. The write call does not check to see if the file
is there or not. It just writes to the specified number of characters starting
at a predetermined location. Regardless of whether the file exist or not, disk
blocks are used by the write operation.
The df command reports the number of disk blocks used, while du goes through the
file structure and reports the number of blocks used by each directory. As
far as du is concerned, the file used by the process does not exist, so it does
not report blocks used by this phantom file. But df keeps track of disk blocks
used, and it reports the blocks used by this phantom file.