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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值