<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></title> 
<link>http://www.bizeway.net/index.php</link> 
<description><![CDATA[网务通 - 网务公司发展之路]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></copyright>
<item>
<link>http://www.bizeway.net/read.php?</link>
<title><![CDATA[跟着ArthurXF学FreeBSD32——df和du命令详解]]></title> 
<author>ArthurXF &lt;arthurxf@gmail.com&gt;</author>
<category><![CDATA[FreeBSD]]></category>
<pubDate>Mon, 12 Nov 2007 04:40:28 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?</guid> 
<description>
<![CDATA[ 
	df命令详细用法<br/><br/>a：显示全部的档案系统和各分割区的磁盘使用情形 <br/>i：显示i -nodes的使用量 <br/>k：大小用k来表示 (默认值) <br/>t：显示某一个档案系统的所有分割区磁盘使用量 <br/>x：显示不是某一个档案系统的所有分割区磁盘使用量 <br/>T：显示每个分割区所属的档案系统名称 <br/>常用命令：df -hi<br/><br/><strong>操作详解</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">指令 df 可以显示目前所有档案系统的最大可用空间及使用情形，请看下列这个例子：<br/><br/># df -h<br/>Filesystem &nbsp; &nbsp; &nbsp; Size &nbsp; &nbsp; &nbsp;Used &nbsp; &nbsp; Avail Capacity &nbsp; &nbsp;Mounted on<br/>/dev/ad0s1a &nbsp; &nbsp; &nbsp;1.9G &nbsp; &nbsp; &nbsp;389M &nbsp; &nbsp; &nbsp;1.4G &nbsp; &nbsp; &nbsp;21% &nbsp; &nbsp; &nbsp;/<br/>devfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.0K &nbsp; &nbsp; &nbsp;1.0K &nbsp; &nbsp; &nbsp; &nbsp;0B &nbsp; &nbsp; 100% &nbsp; &nbsp; &nbsp;/dev<br/>/dev/ad0s1d &nbsp; &nbsp; &nbsp;989M &nbsp; &nbsp; &nbsp; 54K &nbsp; &nbsp; &nbsp;910M &nbsp; &nbsp; &nbsp; 0% &nbsp; &nbsp; &nbsp;/tmp<br/>/dev/ad0s1f &nbsp; &nbsp; &nbsp;4.8G &nbsp; &nbsp; &nbsp;3.8G &nbsp; &nbsp; &nbsp;657M &nbsp; &nbsp; &nbsp;86% &nbsp; &nbsp; &nbsp;/usr<br/>/dev/ad0s1e &nbsp; &nbsp; &nbsp;1.9G &nbsp; &nbsp; &nbsp;149M &nbsp; &nbsp; &nbsp;1.6G &nbsp; &nbsp; &nbsp; 8% &nbsp; &nbsp; &nbsp;/var<br/>/dev/ad0s1g &nbsp; &nbsp; &nbsp; 26G &nbsp; &nbsp; &nbsp;890K &nbsp; &nbsp; &nbsp; 24G &nbsp; &nbsp; &nbsp; 0% &nbsp; &nbsp; &nbsp;/volume2<br/>/dev/da0s1d &nbsp; &nbsp; &nbsp;325G &nbsp; &nbsp; &nbsp;261G &nbsp; &nbsp; &nbsp; 38G &nbsp; &nbsp; &nbsp;87% &nbsp; &nbsp; &nbsp;/volume1<br/><br/>我们加了参数 -h 表示使用「Human-readable」的输出，也就是在档案系统大小使用 GB、MB 等易读的格式。<br/><br/>上面的指令输出的第一个字段及最后一个字段分别是档案系统及其挂入点。我们可以看到 /dev/ad0s1a 这个分割区被挂在根目录下。我们在上一小节提到过 ad 所代表的是 IDE 的硬盘，而 s1 表示第一个主要扇区。我另外有一个 SCSI 硬盘，它的代号是 da，它的容量很大，主要用来存放数据。devfs 是一个特别的档案系统，该档案系统并非真的磁盘，而是 FreeBSD 用来管理系统硬件装置的虚拟档案系统。<br/><br/>接下来的四个字段 Size、Used、Avail、及 Capacity 分别是该分割区的容量、已使用的大小、剩下的大小、及使用的百分比。当硬盘容量已满时，您可能会看到已使用的百分比超过 100%，因为 FreeBSD 会留一些空间给 root，让 root 在档案系统满时，还是可以写东西到该档案系统中，以进行管理。<br/><br/>另外，我们还可以使用参数 -i 来查看目前档案系统 inode 的使用情形。有的时候虽然档案系统还有空间，但若没有足够的 inode 来存放档案的信息，一样会不能增加新的档案。<br/><br/># df -ih<br/>Filesystem &nbsp; &nbsp; &nbsp; Size &nbsp; &nbsp; &nbsp;Used &nbsp; &nbsp; Avail Capacity iused &nbsp; &nbsp; &nbsp;ifree %iused &nbsp; &nbsp;Mounted on<br/>/dev/ad0s1a &nbsp; &nbsp; &nbsp;1.9G &nbsp; &nbsp; &nbsp;389M &nbsp; &nbsp; &nbsp;1.4G &nbsp; &nbsp; &nbsp;21% &nbsp; &nbsp; 20495 &nbsp; &nbsp; 262127 &nbsp; &nbsp; &nbsp;7% &nbsp; &nbsp; /<br/>devfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.0K &nbsp; &nbsp; &nbsp;1.0K &nbsp; &nbsp; &nbsp; &nbsp;0B &nbsp; &nbsp; 100% &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;100% &nbsp; &nbsp; /dev<br/>/dev/ad0s1d &nbsp; &nbsp; &nbsp;989M &nbsp; &nbsp; &nbsp; 62K &nbsp; &nbsp; &nbsp;910M &nbsp; &nbsp; &nbsp; 0% &nbsp; &nbsp; &nbsp; &nbsp;24 &nbsp; &nbsp; 141286 &nbsp; &nbsp; &nbsp;0% &nbsp; &nbsp; /tmp<br/>/dev/ad0s1f &nbsp; &nbsp; &nbsp;4.8G &nbsp; &nbsp; &nbsp;3.8G &nbsp; &nbsp; &nbsp;657M &nbsp; &nbsp; &nbsp;86% &nbsp; &nbsp;311439 &nbsp; &nbsp; 348015 &nbsp; &nbsp; 47% &nbsp; &nbsp; /usr<br/>/dev/ad0s1e &nbsp; &nbsp; &nbsp;1.9G &nbsp; &nbsp; &nbsp;149M &nbsp; &nbsp; &nbsp;1.6G &nbsp; &nbsp; &nbsp; 8% &nbsp; &nbsp; &nbsp;1758 &nbsp; &nbsp; 280864 &nbsp; &nbsp; &nbsp;1% &nbsp; &nbsp; /var<br/>/dev/ad0s1g &nbsp; &nbsp; &nbsp; 26G &nbsp; &nbsp; &nbsp;890K &nbsp; &nbsp; &nbsp; 24G &nbsp; &nbsp; &nbsp; 0% &nbsp; &nbsp; &nbsp; &nbsp;12 &nbsp; &nbsp;3532786 &nbsp; &nbsp; &nbsp;0% &nbsp; &nbsp; /volume2<br/>/dev/da0s1d &nbsp; &nbsp; &nbsp;325G &nbsp; &nbsp; &nbsp;261G &nbsp; &nbsp; &nbsp; 38G &nbsp; &nbsp; &nbsp;87% &nbsp; &nbsp;707277 43311409 &nbsp; &nbsp; &nbsp;2% &nbsp; &nbsp; /volume1<br/>我们可以看到根目录的已经用掉的 inode 数量为 20495，还有 262127 的可用 inode。<br/><br/>小提示 <br/>还记得什么是 inode 吗？所谓的 inode 是用来存放档案及目录的基本信息 (metadata)，包含时间、档名、使用者及群组等。在分割扇区时，系统会先做出一堆 inode 以供以后使用，inode 的数量关系着系统中可以建立的档案及目录总数。如果要存的档案大部分都很小，则同样大小的硬盘中会有较多的档案，也就是说需要较多的 inode 来挂档案及目录。</div></div><br/><br/>du：查询档案或目录的磁盘使用空间 <br/><br/>a：显示全部目录和其次目录下的每个档案所占的磁盘空间 <br/>b：大小用bytes来表示 (默认值为k bytes) <br/>c：最后再加上总计 (默认值) <br/>s：只显示各档案大小的总合 <br/>x：只计算同属同一个档案系统的档案 <br/>L：计算所有的档案大小 <br/>常用命令：du -a<br/><br/><strong>操作详解</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">指令 du 能以指定的目录下的子目录为单位，显示每个目录内所有档案所占用的磁盘空间大小。例如：<br/><br/># du -h /etc<br/>104K /etc/defaults<br/>6.0K /etc/X11<br/>8.0K /etc/bluetooth<br/>4.0K /etc/gnats<br/> 52K /etc/isdn<br/>388K /etc/mail<br/> 68K /etc/mtree<br/>2.0K /etc/ntp<br/> 38K /etc/pam.d<br/> 44K /etc/periodic/daily<br/>6.0K /etc/periodic/monthly<br/> 42K /etc/periodic/security<br/> 16K /etc/periodic/weekly<br/>110K /etc/periodic<br/>6.0K /etc/ppp<br/>318K /etc/rc.d<br/>2.0K /etc/skel<br/>130K /etc/ssh<br/> 10K /etc/ssl<br/>1.7M /etc<br/>我们目样使用 -h 参数来显示 human-readable 的格式。在应用时，我们可以使用 du 这个指令来查看哪个目录占用最多的空间。不过，du 的输出结果通常很长，我们可以加上 -s 参数来省略指定目录下的子目录，而只显示该目录的总合即可：<br/><br/># du -sh /etc<br/>1.7M &nbsp; &nbsp; &nbsp; /etc<br/>在查看目录的使用情形时，我们可以将输出结果导到 sort 指令进行排序，以了解哪个档案用了最多的空间：<br/><br/># du /etc &#124; sort -nr &#124; more<br/>1746 /etc<br/>388 /etc/mail<br/>318 /etc/rc.d<br/>130 /etc/ssh<br/>110 /etc/periodic<br/>104 /etc/defaults<br/>68 /etc/mtree<br/>52 /etc/isdn<br/>44 /etc/periodic/daily<br/>42 /etc/periodic/security<br/>38 /etc/pam.d<br/>16 /etc/periodic/weekly<br/>10 /etc/ssl<br/>8 /etc/bluetooth<br/>6 /etc/ppp<br/>6 /etc/periodic/monthly<br/>6 /etc/X11<br/>4 /etc/gnats<br/>2 /etc/skel<br/>2 /etc/ntp<br/>sort 的参数 -nr 表示要以数字排序法进行反向排序，因为我们要对目录大小做排序，所以不可以使用 human-readable 的大小输出，不然目录大小中会有 K、M 等字样，会造成排序不正确。</div></div><br/><br/><br/>现在ArthurXF本人正在搞PHP等技术培训，如果想学习的人可以跟我联系。另外培训的招生简章在这个网址，想了解的可以去看看。加我QQ：29011218交流也可。<br/><a href="http://www.bizeway.net/read.php/285.htm" target="_blank">PHP培训招生简章</a><br/>Tags - <a href="tag.php?tag=df" rel="tag">df</a> , <a href="tag.php?tag=du" rel="tag">du</a>
]]>
</description>
</item><item>
<link>http://www.bizeway.net/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] 跟着ArthurXF学FreeBSD32——df和du命令详解]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>