免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: leolein
打印 上一主题 下一主题

df和du的区别以及磁盘空间使用问题 [复制链接]

论坛徽章:
0
21 [报告]
发表于 2005-04-13 12:37 |只看该作者

df和du的区别以及磁盘空间使用问题

When a file system is over allocated in this way,
df may report that the file system is more than 100% utilized

那有可能 df   磁盘占用已经超了100%的情况?但是其实是正常的。业务不会受到影响?

论坛徽章:
0
22 [报告]
发表于 2006-02-07 14:41 |只看该作者

有什么方法查可以 把某个目录下的目录或者文件 按 文件(目录)大小,降序排列

有什么方法查可以  把某个目录下的目录或者文件 按 文件(目录)大小,降序排列,取前10个

硬盘被占满了,却不知道都是什么东西?

论坛徽章:
0
23 [报告]
发表于 2008-01-23 11:20 |只看该作者

顶一顶

我也曾遇到过这样的问题,最重要的是这段话:
  1. This section gives the technical explanation of why du and df sometimes report
  2. different totals of disk space usage.

  3. When a program that is running in the background writes to a file while the
  4. process is running, the file to which this process is writing is deleted.
  5. Running df and du shows a discrepancy in the amount of disk space usage.  The
  6. df command shows a higher value.
复制代码

如果文件已经删除了,但是还有残留的进程引用它(具体不知道怎么表达好),则df看到的空间使用量并没有减去那些已经删除的文件。而创建并写入一个文件是,判断空间是否足够是依据df(本人认为),所以df 100%的时候就不能写入文件了。--但是创建文件是可以的,我做过测试。查看这些残留进程(姑且这么称呼,我也不知道那些进程叫什么)的方法是lsof

  1. # lsof /home | grep /home/oracle/osinfo | sort +8 | grep '^.*070920.*$'
  2. sadc    17821   root    3w   REG  253,1 326492112 926724 /home/oracle/osinfo/070920sar.data (deleted)
  3. sadc    17861   root    3u   REG  253,1 326492112 926724 /home/oracle/osinfo/070920sar.data (deleted)
  4. sadc    17981   root    3u   REG  253,1 326492112 926724 /home/oracle/osinfo/070920sar.data (deleted)
  5. top     17858   root    1w   REG  253,1 169919916 927111 /home/oracle/osinfo/070920top.data (deleted)
  6. top     17977   root    1w   REG  253,1 169919916 927111 /home/oracle/osinfo/070920top.data (deleted)
  7. 注意后面的deleted
复制代码


然后把这些进程都kill掉就可以释放空间了。
我遇到这些残留进程是因为僵死进程引起的,但是上面看到的那些进程并非僵死进程。
http://bbs.chinaunix.net/viewthr ... highlight=yuhe27913

论坛徽章:
0
24 [报告]
发表于 2008-01-24 05:22 |只看该作者
A better explanation:

The difference is that whenever an application has an
open file, but the file is already deleted, then it is counted in the df
output (because the space is certainly not free) but not in du (because
it is not being used by a file).
http://lists.debian.org/debian-isp/2002/05/msg00046.html

论坛徽章:
0
25 [报告]
发表于 2008-01-26 17:12 |只看该作者

回复 #23 yuhe27913 的帖子

恩 受用了...
  1. -bash-3.00$ du -sk /home/e
  2. 242104  /home/e
复制代码

  1. -bash-3.00$ df -k /home/e
  2. Filesystem            kbytes    used   avail capacity  Mounted on
  3. 192.168.2.5:/store/home
  4.                      2399169188 126412956 2150885488     6%    /home
复制代码



这个统一也是有问题的丫.....

[ 本帖最后由 star33375249 于 2008-1-26 17:15 编辑 ]

论坛徽章:
0
26 [报告]
发表于 2008-02-14 17:06 |只看该作者

论坛徽章:
0
27 [报告]
发表于 2009-09-26 09:26 |只看该作者
我看刚碰到这个问题,受教了,谢谢!

论坛徽章:
0
28 [报告]
发表于 2009-09-26 10:53 |只看该作者
再学习一次

论坛徽章:
0
29 [报告]
发表于 2009-09-26 12:40 |只看该作者
这个文档太精彩了

论坛徽章:
0
30 [报告]
发表于 2009-09-29 16:55 |只看该作者
新手学习中。。。。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP