`
shinfocom
  • 浏览: 1185973 次
文章分类
社区版块
存档分类
最新评论

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

 
阅读更多
solarissparc
root

df-kb结果
/dev/vx/dsk/home121972201108651598873392%/home

du-ks查看/home分区情况为
10dep
27lost+found
395517oracle
288bigml.lsof
212309wei
4041696lan
346074xue
520xue.log
du相加的结果和df的结果不同?!


下面这篇文章给出答案

DocumentId:26928Synopsis:duanddfDifferences(originallypublished8/91)
Updatedate:2001-05-13Description:duanddfDifferences
------------------

Thisarticleexplainshowreportingdiskusageduandreportingfreediskspace
onfilesystemsdfmayshowdifferentnumbers.

du
--

Theduusercommandgivesthenumberofkilobytescontainedinallfilesand,
recursively,directorieswithineachspecifieddirectoryorfile(filename).
Iffilenameismissing,`.'(thecurrentdirectory)isused.Afilewhich
hasmultiplelinkstoitisonlycountedonce.

EXAMPLE:

system%du

5./jokes
33./squash
44./tech.papers/lpr.document
217./tech.papers/new.manager
401./tech.papers
144./memos
80./letters
388./window
93./messages
15./useful.news
1211.

Notethatthelastnumber,1211isthegrandtotal(inkilobytes)forthe
directory.

df
--

Thedfusercommanddisplaysthefollowinginformation:

amountofdiskspaceoccupiedbycurrentlymountedfilesystems
theamountofusedandavailablespace
howmuchofthefilesystem'stotalcapacityhasbeenused

Usedwithoutarguments,dfreportsonallmountedfilesystems.

EXAMPLE:

system%df

FilesystemkbytesusedavailcapacityMountedon
/dev/ip0a74454714198670%/
/dev/ip0g4227735291275893%/usr

Note:usedplusavailislessthantheamountofspaceinthefilesystem
(kilobytes)becausethesystemreservesafractionofthespaceinthefile
systemtoallowitsallocationroutinestoworkwell.Theamountreservedis
typicallyabout10%.(Thismaybeadjustedusingthetunefscommand.Referto
themanpagesontunefs(8)formoreinformation.)Whenallthespaceonafile
system,exceptforthisreserve,isinuse,onlythesuper-usercanallocate
newfilesanddatablockstoexistingfiles.This,however,maycausethefile
systemtobeoverallocated.Whenafilesystemisoverallocatedinthisway,
dfmayreportthatthefilesystemismorethan100%utilized.

Ifargumentstodfarediskpartitions(forexample,/dev/ip0asorpathnames),
dfproducesareportonthefilesystemcontainingthenamedfile.Thus,df
showstheamountofspaceonthefilesystemcontainingthecurrentdirectory.

ProblemDefinition
-----------------

Thissectiongivesthetechnicalexplanationofwhyduanddfsometimesreport
differenttotalsofdiskspaceusage.

Whenaprogramthatisrunninginthebackgroundwritestoafilewhilethe
processisrunning,thefiletowhichthisprocessiswritingisdeleted.
Runningdfanddushowsadiscrepancyintheamountofdiskspaceusage.The
dfcommandshowsahighervalue.

ExplanationSummary
------------------

Whenyouopenafile,yougetapointer.Subsequentwritestothisfile
referencesthisfilepointer.Thewritecalldoesnotchecktoseeifthefile
isthereornot.Itjustwritestothespecifiednumberofcharactersstarting
atapredeterminedlocation.Regardlessofwhetherthefileexistornot,disk
blocksareusedbythewriteoperation.

Thedfcommandreportsthenumberofdiskblocksusedwhiledugoesthroughthe
filestructureandandreportsthenumberofblocksusedbyeachdirectory.As
farasduisconcerned,thefileusedbytheprocessdoesnotexist,soitdoes
notreportblocksusedbythisphantomfile.Butdfkeepstrackofdiskblocks
used,anditreportstheblocksusedbythisphantomfile.
分享到:
评论

相关推荐

    Linux 基础 83-系统信息-03-df和du查看磁盘和目录空间占用.flv

    Linux 基础 83-系统信息-03-df和du查看磁盘和目录空间占用.flv

    磁盘满了,为啥du却显示还有很大空间

    • du:disk usage • df:disk free • lsof:list open files • echo "" > access.log

    linux-du-df.rar_linux du

    linux下,发现 du、df 硬盘空间不同,介绍了相关的解决方法

    linux查看文件或目录磁盘空间使用命令—–du

    但是与df命令不同的是du命令是对文件和目录磁盘使用的空间的查看,而不是某个分区。 语法 du 【选项】 【参数】 选项 -a或-all:显示目录中个别文件的大小。 -b或-bytes:显示目录或文件大小时,以byte为单位。 ...

    Linux磁盘空间被未知资源耗尽的解决方法

    这种情况下,通过df和du命令查找的磁盘空间,两者是无法匹配的,可能df显示磁盘100%,而du查找目录的磁盘容量占用却很小。 遇到这种情况,基本可以断定是某些大文件被某些程序占用了,并且这些大文件已经被删除了,...

    du命令 查看空间

    但是与df命令不同的是du命令是对文件和目录磁盘使用的空间的查看,而不是某个分区。 语法格式:du [参数] [文件] 常用参数: -a 显示目录中所有文件大小 -k 以KB为单位显示文件大小 -m 以MB为单位...

    Linux 命令每天必学(34)之du命令

    Linux du命令也是查看使用空间的,但是与df命令不同的是Linux du命令是对文件和目录磁盘使用的空间的查看,还是和df命令有一些区别的. du /bin和du -s /bin有什么区别呢? -s 就是summary, 显示该目录占用空间的...

    一天一个shell命令 linux好管家-磁盘-du命令详解

    du命令也是查看使用空间的,但是与df命令不同的是Linux du命令是对文件和目录磁盘使用的空间的查看,还是和df命令有一些区别的。 语法 du [选项][文件] 选项 -a或-all 显示目录中个别文件的大小。 -b或-bytes 显示...

    Linux中2个磁盘存储相关命令详解.doc

    Linux du命令也是查看使用空间的,但是与df命令不同的是Linux du命令是对文件和目录磁盘使用的空间的查看,还是和df命令有一些区别的。

    GalenDeng#linux#磁盘管理1

    磁盘管理 (2017.11.13)df:列出文件系统的整体磁盘使用量 (df命令参数功能:检查文件系统的磁盘空间占用情况)du:检查磁盘空间使用量 (Linux

    大数据基础-Linux基础详解课程31.基本命令-磁盘操作命令(df,du.free).mp4

    大数据基础-Linux基础详解课程

    linux常用命令大全

    ls:列出目录内容 cd:改变当前目录 pwd:显示当前工作目录的路径 mkdir:创建新目录 rm:删除文件或目录 cp:复制文件或目录 ...df:显示磁盘空间使用情况 du:显示目录空间使用情况 tar:压缩和解压文件

    linux系统获取硬盘使用信息

    1、df命令  Linux下可以用df命令获取硬盘的使用情况,通过man可以获取df命令的... du命令用来查询档案或目录的磁盘使用空间,通过man获取du命令的详细介绍。常用的命令参数如下: a:显示全部目录和其次目录下的每

    Linux 磁盘管理.doc

    Linux磁盘管理好坏直接关系到整个系统的性能问题。 Linux磁盘管理常用三个命令为df、du和fdisk。

    Linux应用技术:Linux系统命令.pptx

    df –h 以人们容易理解的方式显示磁盘空间占用情况 du命令 功能:显示当前目录以及其下各子目录的大小 du –a 详细显示当前目录以及其下各子目录的大小 du –s 显示当前目录和其下的各子目录的大小总和 查看系统信息...

    【大厂面试必备】Linux面试题和答案,以及详细解析!

    34、du 和 df 的定义,以及区别? 35、awk 详解。 36、当你需要给命令绑定一个宏或者按键的时候,应该怎么做呢? 37、如果一个 linux 新手想要知道当前系统支持的所有命令的列表,他需要怎么做? 38、如果你的...

    linux磁盘操作基本命令

    介绍了关于磁盘操作的基本命令, 如du, df, fdisk, mkfs等等

    聊聊 Linux 那些离奇的磁盘满问题

    文章目录一、被忽略的隐藏文件1、认识 swapfile2、处理建议二、未释放的已删除文件1、du 和 df 不一致2、处理建议三、挂载引发的悬案1、消失的空间2、处理建议2.1 解决方法2.2 测试验证2.3 给个建议 对于 Linux ...

    Linux中du-查看文件夹大小并按大小进行排序详解

    使用df 命令查看当前磁盘使用情况: jack@jiaobuchong:~$ df -lh Filesystem Size Used Avail Use% Mounted on /dev/sda3 18G 5.7G 11G 35% / udev 2.7G 4.0K 2.7G 1% /dev tmpfs 553M 916K 552M 1% /run none 5.0M...

    Linux全攻略之磁盘管理.doc

    Linux全攻略之磁盘管理 df du mke2fs fsck e2lable dump2fs tune2fs sync

Global site tag (gtag.js) - Google Analytics