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.