gpt4 book ai didi

linux - df 和 du 给出不同的结果

转载 作者:太空狗 更新时间:2023-10-29 11:08:22 26 4
gpt4 key购买 nike

当我使用 df -h 时,它会为 /appl 目录提供以下结果

/appl                   39G    32G   6.7G    83%    /appl

但是当我进入该目录 cd/appl 并运行 du -sh 时,它会给我以下结果:

 4.9G   .

如果/appl挂载点占用了32GB,为什么显示目录总计4.9G?

最佳答案

首先dfdu是两个完全不同的 linux 实用程序。

df = Disk free
du = Disk usage

df ( More info on df ) 将读取 meta datadisk partition包含指定的文件夹,在您的情况下是 app1并返回 disk partition information而不是实际目录的目录。

但是du ( More info on du ) 将遍历指定的目录树并计算目录下所有文件的总大小并返回 total space occupied by that directory .

接下来回答你的问题:
cd /applcd <mount_point>不可能。
检查分区在哪里 app1挂载使用 mount 命令。

The confusion you see is because there must be a folder called app1 under / directory and also a partition named app1.

一旦找到 mount point app1 分区的 cd到该目录,然后运行 ​​du -sh预期输出应为 32G花了一些时间之后。

备注:app1分区挂载点和/app1不一样。

关于linux - df 和 du 给出不同的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30772180/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com