<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LinuxByte &#187; 系统管理</title>
	<atom:link href="http://www.linuxbyte.org/category/%e7%b3%bb%e7%bb%9f%e7%ae%a1%e7%90%86/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxbyte.org</link>
	<description>一个Linux Blog</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:13:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ubuntu linux 下硬盘坏道的检测与修复</title>
		<link>http://www.linuxbyte.org/ubuntu-linux-xia-ying-pan-huai-dao-de-jian-ce-yu-xiu-fu.html</link>
		<comments>http://www.linuxbyte.org/ubuntu-linux-xia-ying-pan-huai-dao-de-jian-ce-yu-xiu-fu.html#comments</comments>
		<pubDate>Thu, 26 Jan 2012 08:10:29 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[badblocks]]></category>
		<category><![CDATA[坏道]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=784</guid>
		<description><![CDATA[最近从服务器上淘汰下一个1T 的硬盘，不过在服务器上工作的不是很好，所以得先检测一下硬盘是否有坏道。 ubuntu 自带的磁盘实用工具是个很直观的查看硬盘健康状况的工具。 不过如果你和... ]]></description>
			<content:encoded><![CDATA[<p>最近从服务器上淘汰下一个1T 的硬盘，不过在服务器上工作的不是很好，所以得先检测一下硬盘是否有坏道。<br />
ubuntu 自带的磁盘实用工具是个很直观的查看硬盘健康状况的工具。<br />
<a href="http://www.linuxbyte.org/uploads/2012/01/yp.jpg" rel="lightbox[784]"><img src="http://www.linuxbyte.org/uploads/2012/01/yp-160x120.jpg" alt="linux 坏道" title="linux 坏道" width="160" height="120" class="alignnone size-thumbnail wp-image-785" /></a><br />
<span id="more-784"></span></p>
<p>不过如果你和我一样更喜欢用命令行，那么请关注一下badblocks 命令。</p>
<p>检查前确定你已经卸载要检查的磁盘，如果没用请umount 之。<br />
对整个磁盘进行read-only检测：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> badblocks <span style="color: #660033;">-s</span>  <span style="color: #660033;">-v</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">32</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb</pre></div></div>

<p>因为需要对磁盘进行检测，所以速度非常缓慢，在检测过程中注意不要断电，不要对硬盘进行任何操作，不要移除硬盘，不要物理损伤，不要震动等。</p>
<p>检测过程是可以中途终止，也可以指定区块重新开始。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> badblock <span style="color: #660033;">-s</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">32</span>  <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sd<span style="color: #000000; font-weight: bold;">*</span>   <span style="color: #000000;">976762583</span> <span style="color: #000000;">125637824</span> （注意此处结束区块在前，起始区块在后）</pre></div></div>

<p><strong>badblocks 用法详细说明</strong><br />
语　法：<br />
　　badblocks [-svw][-b < 区块大小>][-o < 输出文件>][磁盘装置][磁盘区块数][启始区块]</p>
<p>参　数：<br />
　　-b< 区块大小> 指定磁盘的区块大小，单位为字节。<br />
　　-o< 输出文件> 将检查的结果写入指定的输出文件。<br />
　　-c< 检查区块数目> 每一次检测区块的数目。默认值是16。增加这个数目可以增加检测 块的效率可同时也会增加内存的耗费。<br />
　　-s 在检查时显示进度。<br />
　　-v 执行时显示详细的信息。<br />
　　-w 在检查时，执行写入测试。<br />
　　[磁盘装置] 指定要检查的磁盘装置。<br />
　　[磁盘区块数] 指定磁盘装置的区块总数。<br />
　　[启始区块] 指定要从哪个区块开始检查。</p>
<p><strong>修复坏道</strong><br />
如果只是逻辑坏道，你可以<br />
直接fsck</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">fsck <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb</pre></div></div>

<p>或者格式化</p>
<p>如果是物理坏道，那么兄弟你真的悲剧了。你需要<br />
a.备份硬盘数据<br />
b.删除所有硬盘分区<br />
c.根据坏块位置以及大小，估算出所占空间。然后重新分区隔离损坏部分。btw：坏道是会扩散的，所以尽可能隔离掉多些空间。</p>
<h2  class="related_post_title">其他大家爱看的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/fu-wu-qi-zhong-swap-de-hua-fen.html" title="服务器中swap 的划分">服务器中swap 的划分</a></li><li><a href="http://www.linuxbyte.org/install-magiclinux21-from-harddisk.html" title="硬盘安装Magic Linux 2.1">硬盘安装Magic Linux 2.1</a></li><li><a href="http://www.linuxbyte.org/lenny-debian-5.html" title="Debian Lenny版本号被定为5.0">Debian Lenny版本号被定为5.0</a></li><li><a href="http://www.linuxbyte.org/firefox-girl-wallpaper.html" title="Firefox Girl wallpaper">Firefox Girl wallpaper</a></li><li><a href="http://www.linuxbyte.org/yong-sdlmame-chang-wan-jie-ji-you-xi.html" title="用sdlmame 畅玩街机游戏">用sdlmame 畅玩街机游戏</a></li><li><a href="http://www.linuxbyte.org/trefoil-wallpaper.html" title="三叶草壁纸">三叶草壁纸</a></li><li><a href="http://www.linuxbyte.org/autoproxy-for-firefox-4.html" title="Autoproxy for Firefox 4">Autoproxy for Firefox 4</a></li><li><a href="http://www.linuxbyte.org/ssh-server-gong-yue-gai-bian-hou-ke-hu-duan-wu-fa-deng-lu-de-jie-jue-ban-fa.html" title="ssh server 公钥改变后客户端无法登录的解决办法">ssh server 公钥改变后客户端无法登录的解决办法</a></li><li><a href="http://www.linuxbyte.org/pahtch.html" title="找到一个图片批量处理工具">找到一个图片批量处理工具</a></li><li><a href="http://www.linuxbyte.org/wei-ni-de-linuxxia-an-zhuang-yuan-sheng-zfs.html" title="为你的Linux下安装原生 ZFS">为你的Linux下安装原生 ZFS</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2012<br />
Source: <a href="http://www.linuxbyte.org/ubuntu-linux-xia-ying-pan-huai-dao-de-jian-ce-yu-xiu-fu.html">ubuntu linux 下硬盘坏道的检测与修复</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/badblocks" rel="tag">badblocks</a>, <a href="http://www.linuxbyte.org/tag/%e5%9d%8f%e9%81%93" rel="tag">坏道</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/badblocks" title="badblocks" rel="tag">badblocks</a>, <a href="http://www.linuxbyte.org/tag/%e5%9d%8f%e9%81%93" title="坏道" rel="tag">坏道</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/ubuntu-linux-xia-ying-pan-huai-dao-de-jian-ce-yu-xiu-fu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何选择磁盘I/O调度器</title>
		<link>http://www.linuxbyte.org/ru-he-xuan-ze-ci-pan-iodiao-du-qi.html</link>
		<comments>http://www.linuxbyte.org/ru-he-xuan-ze-ci-pan-iodiao-du-qi.html#comments</comments>
		<pubDate>Thu, 11 Aug 2011 07:55:19 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[IO调度]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=742</guid>
		<description><![CDATA[转自：http://bbs.linuxtone.org/thread-2316-1-1.html I/O 调度算法再各个进程竞争磁盘I/O的时候担当了裁判的角色。他要求请求的次序和时机做最优化的处理，以求得尽可能最好的整体I/O性能。 下面列出4... ]]></description>
			<content:encoded><![CDATA[<p>转自：http://bbs.linuxtone.org/thread-2316-1-1.html<br />
I/O 调度算法再各个进程竞争磁盘I/O的时候担当了裁判的角色。他要求请求的次序和时机做最优化的处理，以求得尽可能最好的整体I/O性能。<br />
    下面列出4种调度算法：<br />
        CFQ (Completely Fair Queuing 完全公平的排队)(elevator=cfq)： 这是默认算法，对于通用服务器来说通常是最好的选择。它试图均匀地分布对I/O带宽的访问。<br />
        Deadline (elevator=deadline)： 这个算法试图把每次请求的延迟降至最低。该算法重排了请求的顺序来提高性能。<br />
        NOOP (elevator=noop): 这个算法实现了一个简单FIFO队列。他假定I/O请求由驱动程序或者设备做了优化或者重排了顺序(就像一个智能控制器完成的工作那样)。在有些SAN环境下，这个选择可能是最好选择。<br />
        Anticipatory (elevator=as): 这个算法推迟I/O请求，希望能对它们进行排序，获得最高的效率。对于桌面工作站来说，这个算法可能是一个不错的选择，但对服务器则很少会理想。<br />
<span id="more-742"></span><br />
Linux Change The I/O Scheduler For A Hard Disk</p>
<p>Q. How do I change the I/O scheduler for a particular hard disk without rebooting my Linux server system?</p>
<p>A. CFQ [cfq] (Completely Fair Queuing) is an I/O scheduler for the Linux kernel and default under many Linux distributions.</p>
<p>Noop scheduler (noop) is the simplest I/O scheduler for the Linux kernel based upon FIFO queue concept.</p>
<p>Anticipatory scheduler (anticipatory) is an algorithm for scheduling hard disk input/output as well as old scheduler which is replaced by CFQ</p>
<p>Deadline scheduler (deadline) &#8211; it attempt to guarantee a start service time for a request.<br />
Task: View Current Disk scheduler</p>
<p>Assuming that your disk name /dev/sda, type:<br />
<span style="color: blue;"># cat /sys/block/{DEVICE-NAME}/queue/scheduler</span><br />
<span style="color: blue;"># cat /sys/block/sda/queue/scheduler</span><br />
Sample output:</p>
<p>noop anticipatory deadline [cfq]</p>
<p>Task: Set I/O Scheduler For A Hard Disk</p>
<p>To set a specific scheduler, simply type the command as follows:<br />
<span style="color: blue;"># echo {SCHEDULER-NAME} &gt; /sys/block/{DEVICE-NAME}/queue/scheduler</span><br />
For example, set noop scheduler, enter:<br />
<span style="color: blue;"># echo noop &gt; /sys/block/hda/queue/scheduler</span></p>
<h2  class="related_post_title">其他大家爱看的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/df-hdpram.html" title="df/hdparm命令简介">df/hdparm命令简介</a></li><li><a href="http://www.linuxbyte.org/chkrootkit-minihowto.html" title="使用chkrootkit工具保护服务器">使用chkrootkit工具保护服务器</a></li><li><a href="http://www.linuxbyte.org/mianfei-wangpan-dropbox.html" title="免费网盘Dropbox">免费网盘Dropbox</a></li><li><a href="http://www.linuxbyte.org/rang-wordpress-zi-dong-sheng-ji-shi-wu-xu-tian-jia-ftp.html" title="让Wordpress 自动升级时无需添加FTP">让Wordpress 自动升级时无需添加FTP</a></li><li><a href="http://www.linuxbyte.org/opensuse-11_0-beta-2.html" title="OpenSUSE 11.0 Beta 2放出">OpenSUSE 11.0 Beta 2放出</a></li><li><a href="http://www.linuxbyte.org/ubuntu-810-anzhuang-peizhi.html" title="ubuntu 8.10 安装配置小记">ubuntu 8.10 安装配置小记</a></li><li><a href="http://www.linuxbyte.org/ri-li-ming-ling-cal.html" title="日历命令 cal">日历命令 cal</a></li><li><a href="http://www.linuxbyte.org/magic-linux-21-rc3.html" title="Magic Linux 2.1 rc3 发布">Magic Linux 2.1 rc3 发布</a></li><li><a href="http://www.linuxbyte.org/fedora-10-cambridge.html" title="Fedora 10代号“Cambridge”">Fedora 10代号“Cambridge”</a></li><li><a href="http://www.linuxbyte.org/install-pdnsd-under-magiclinux-for-dns-cache.html" title="在magic linux 下安装pdnsd加快域名解析">在magic linux 下安装pdnsd加快域名解析</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/ru-he-xuan-ze-ci-pan-iodiao-du-qi.html">如何选择磁盘I/O调度器</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/io" rel="tag">IO</a>, <a href="http://www.linuxbyte.org/tag/io%e8%b0%83%e5%ba%a6" rel="tag">IO调度</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/io" title="IO" rel="tag">IO</a>, <a href="http://www.linuxbyte.org/tag/io%e8%b0%83%e5%ba%a6" title="IO调度" rel="tag">IO调度</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/ru-he-xuan-ze-ci-pan-iodiao-du-qi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 用PPA安装2.6.38内核</title>
		<link>http://www.linuxbyte.org/ubuntu-10-04-yong-ppa-an-zhuang-2-6-38-nei-he.html</link>
		<comments>http://www.linuxbyte.org/ubuntu-10-04-yong-ppa-an-zhuang-2-6-38-nei-he.html#comments</comments>
		<pubDate>Tue, 22 Mar 2011 13:26:47 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[PPA]]></category>
		<category><![CDATA[内核]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=667</guid>
		<description><![CDATA[几天前2.6.38 内核正式发布，为了体验那几段传说中的代码决定装上2.6.38试试，关于2.6.38 的传说请看之前的文章《期待 2.6.38 内核》 添加PPA 源 sudo add-apt-repository ppa:happyaron/kernel 安装 sudo apt-fast u... ]]></description>
			<content:encoded><![CDATA[<p>几天前2.6.38 内核正式发布，为了体验那几段传说中的代码决定装上2.6.38试试，关于2.6.38 的传说请看之前的文章《<a href="http://www.linuxbyte.org/qi-dai-2-6-38-nei-he.html">期待 2.6.38 内核</a>》</p>
<p>添加PPA 源</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> add-apt-repository ppa:happyaron<span style="color: #000000; font-weight: bold;">/</span>kernel</pre></div></div>

<p><span id="more-667"></span><br />
安装</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-fast update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-fast <span style="color: #c20cb9; font-weight: bold;">install</span>  linux-image-2.6.38-<span style="color: #000000;">7</span>-generic linux-headers-2.6.38-<span style="color: #000000;">7</span>-generic</pre></div></div>

<p>关于 apt-fast 看之前文章《<a href="http://www.linuxbyte.org/ppa-an-zhuang-apt-fast.html">ppa 安装 apt-fast</a>》</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/ppa-an-zhuang-openshot-1-3-0.html" title="PPA 安装 OpenShot 1.3.0">PPA 安装 OpenShot 1.3.0</a></li><li><a href="http://www.linuxbyte.org/ppa-an-zhuang-apt-fast.html" title="ppa 安装 apt-fast">ppa 安装 apt-fast</a></li><li><a href="http://www.linuxbyte.org/qi-dai-2-6-38-nei-he.html" title="期待 2.6.38 内核">期待 2.6.38 内核</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/ubuntu-10-04-yong-ppa-an-zhuang-2-6-38-nei-he.html">Ubuntu 10.04 用PPA安装2.6.38内核</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/ppa" rel="tag">PPA</a>, <a href="http://www.linuxbyte.org/tag/%e5%86%85%e6%a0%b8" rel="tag">内核</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/ppa" title="PPA" rel="tag">PPA</a>, <a href="http://www.linuxbyte.org/tag/%e5%86%85%e6%a0%b8" title="内核" rel="tag">内核</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/ubuntu-10-04-yong-ppa-an-zhuang-2-6-38-nei-he.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>购买VPS 后的一些操作</title>
		<link>http://www.linuxbyte.org/gou-mai-vps-hou-de-yi-xie-cao-zuo.html</link>
		<comments>http://www.linuxbyte.org/gou-mai-vps-hou-de-yi-xie-cao-zuo.html#comments</comments>
		<pubDate>Sat, 19 Mar 2011 12:09:20 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[Linuxbyte 之路]]></category>
		<category><![CDATA[系统管理]]></category>
		<category><![CDATA[Linode]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=661</guid>
		<description><![CDATA[购买了Linode 的VPS，安装了自己比较习惯的centos，下面是一些安装完基系统后的设置操作。 添加普通用户： adduser username passwd username 添加vi 到vim 的alias 在.bashrc 中加入“ alias vi=&#8217;vim&#8217; ”... ]]></description>
			<content:encoded><![CDATA[<p>购买了<a href="http://www.linode.com/?r=558aa1aed383ae43555fab01b4c51359f6035a97">Linode </a>的VPS，安装了自己比较习惯的centos，下面是一些安装完基系统后的设置操作。</p>
<p>添加普通用户：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">adduser username
<span style="color: #c20cb9; font-weight: bold;">passwd</span> username</pre></div></div>

<p><span id="more-661"></span><br />
添加vi 到vim 的alias<br />
在.bashrc 中加入“ alias vi=&#8217;vim&#8217; ”。</p>
<p>关闭不必要的服务</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">chkconfig <span style="color: #660033;">--level</span> 0123456 mcstrans off
chkconfig <span style="color: #660033;">--level</span> 0123456 lvm2-monitor off
chkconfig <span style="color: #660033;">--level</span> 0123456 netfs off
chkconfig <span style="color: #660033;">--level</span> 0123456 rawdevices off</pre></div></div>

<p>设置sshd<br />
编辑 /etc/ssh/sshd_config 修改如下几行</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Port 12800 #修改默认端口
X11Forwarding no #关闭X11转发
UseDNS no #关闭反向解析
PermitRootLogin no #禁止root 直接登录</pre></div></div>

<p>Centos 的内核<br />
paravirt内核和iptabes 有冲突会报如下错误，多一个作孽的security 表，你可以无视之也可以换用stable 内核。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Setting chains to policy ACCEPT: security raw nat mangle fi[FAILED]</pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/bei-fen-vps-shu-ju-dao-dropbox.html" title="备份VPS数据到Dropbox">备份VPS数据到Dropbox</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/gou-mai-vps-hou-de-yi-xie-cao-zuo.html">购买VPS 后的一些操作</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/linode" rel="tag">Linode</a>, <a href="http://www.linuxbyte.org/tag/vps" rel="tag">vps</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/linode" title="Linode" rel="tag">Linode</a>, <a href="http://www.linuxbyte.org/tag/vps" title="vps" rel="tag">vps</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/gou-mai-vps-hou-de-yi-xie-cao-zuo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于squid的一些记录</title>
		<link>http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html</link>
		<comments>http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html#comments</comments>
		<pubDate>Tue, 01 Mar 2011 06:07:26 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[系统管理]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=624</guid>
		<description><![CDATA[max_filedesc 问题 CentOS 5 中自带 Squid 是打过REDHAT的fd补丁的，所以可以直接用max_filedesc 参数加大squid 的最大文件打开数，不过在启动squid之前要运行下 ulimit -HSn xxxxx 关于这个问题更多的可阅读下... ]]></description>
			<content:encoded><![CDATA[<p><strong>max_filedesc 问题</strong><br />
CentOS 5 中自带 Squid 是打过REDHAT的fd补丁的，所以可以直接用max_filedesc 参数加大squid 的最大文件打开数，不过在启动squid之前要运行下</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-HSn</span> xxxxx</pre></div></div>

<p><span id="more-624"></span><br />
关于这个问题更多的可阅读下面文章：<br />
<a href="http://www.linuxbyte.org/squid-max_filedesc.html">http://www.linuxbyte.org/squid-max_filedesc.html</a></p>
<p><strong>maximum_object_size_in_memory 的大小</strong></p>
<p>查看Cache information for squid:中下面这段</p>
<p>Storage Swap size: 7549104 KB<br />
Storage Mem size: 418804 KB<br />
Mean Object Size: 160.46 KB</p>
<p>Mean Object Size是平均内容大小，一般要把maximum_object_size_in_memory设置成离它最近的128的倍数。在这个例子中maximum_object_size_in_memory 的值应该是256kB。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html" title="网吧Linux 网关设置记录补充">网吧Linux 网关设置记录补充</a></li><li><a href="http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html" title="refresh_pattern 学习范例">refresh_pattern 学习范例</a></li><li><a href="http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html" title="Squid 透明代理优化">Squid 透明代理优化</a></li><li><a href="http://www.linuxbyte.org/squid-xian-zhi-yong-hu-bing-fa-lian-jie-shu-2.html" title="Squid 限制用户并发连接数">Squid 限制用户并发连接数</a></li><li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路">升级squid 2.6 到2.7 的冤枉路</a></li><li><a href="http://www.linuxbyte.org/squid-unofficial-support-for-rhelcentos.html" title="Squid unofficial support for RHEL/CentOS">Squid unofficial support for RHEL/CentOS</a></li><li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速）">网吧每IP 限速补充（squid 限速）</a></li><li><a href="http://www.linuxbyte.org/ubuntu-904-an-zhuang-pei-zhi-you-hua-quan-ji-lu.html" title="ubuntu 9.04 安装配置优化全记录">ubuntu 9.04 安装配置优化全记录</a></li><li><a href="http://www.linuxbyte.org/qzone-squid-iptables.html" title="新版qzone 无法被squid 缓存">新版qzone 无法被squid 缓存</a></li><li><a href="http://www.linuxbyte.org/squid-havp-clamav.html" title="squid+havp+clamav搭建防毒代理">squid+havp+clamav搭建防毒代理</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html">关于squid的一些记录</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e4%bc%98%e5%8c%96" rel="tag">优化</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/squid" title="squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e4%bc%98%e5%8c%96" title="优化" rel="tag">优化</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>子网计算工具&#8211;netmask</title>
		<link>http://www.linuxbyte.org/zi-wang-ji-suan-gong-ju-netmask.html</link>
		<comments>http://www.linuxbyte.org/zi-wang-ji-suan-gong-ju-netmask.html#comments</comments>
		<pubDate>Mon, 21 Feb 2011 13:00:54 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[netmask]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=622</guid>
		<description><![CDATA[netmask 命令是一个方便的子网掩码计算工具，可以计算IP段的掩码，也能根据掩码给你IP段和IP个数。 举例： netmask 58.252.160.0:58.252.164.255 58.252.160.0/22 58.252.164.0/24 netmask 58.252.160.0/22 -r 58.252.160.0-58.2... ]]></description>
			<content:encoded><![CDATA[<p>netmask 命令是一个方便的子网掩码计算工具，可以计算IP段的掩码，也能根据掩码给你IP段和IP个数。</p>
<p>举例：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">netmask 58.252.160.0:58.252.164.255 
   58.252.160.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">22</span>
   58.252.164.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span></pre></div></div>

<p><span id="more-622"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> netmask 58.252.160.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">22</span> <span style="color: #660033;">-r</span>
   58.252.160.0-58.252.163.255  <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1024</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>另外它支持以八进制，十六进制，二进制格式输出。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"> netmask 58.252.160.0:58.252.164.255 -b
00111010 11111100 10100000 00000000 / 11111111 11111111 11111100 00000000
00111010 11111100 10100100 00000000 / 11111111 11111111 11111111 00000000</pre></div></div>

<p>更多使用细节请执行man netmask 吧 ^-^</p>
<h2  class="related_post_title">其他大家爱看的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/debian-gnulinux-50-fa-bu.html" title="Debian GNU/Linux 5.0 发布 ">Debian GNU/Linux 5.0 发布 </a></li><li><a href="http://www.linuxbyte.org/sedsi-wei-dao-tu.html" title="sed思维导图">sed思维导图</a></li><li><a href="http://www.linuxbyte.org/my-ubuntu-8_0_4-tips.html" title="安装ubuntu 8.04 后的一些设置">安装ubuntu 8.04 后的一些设置</a></li><li><a href="http://www.linuxbyte.org/debian-gnulinux-4-r3.html" title="Debian GNU/Linux 4.0 updated">Debian GNU/Linux 4.0 updated</a></li><li><a href="http://www.linuxbyte.org/kernel_arguments.html" title="Linux内核引导参数简介">Linux内核引导参数简介</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-10-alpha-1-fa-bu.html" title="Ubuntu 10.10 Alpha 1 发布">Ubuntu 10.10 Alpha 1 发布</a></li><li><a href="http://www.linuxbyte.org/firefox-de-shu-biao-shou-shi-cha-jian-firegestures.html" title="Firefox 的鼠标手势插件FireGestures">Firefox 的鼠标手势插件FireGestures</a></li><li><a href="http://www.linuxbyte.org/fedora-10-anzhuang-peizhi.html" title="fedora 10 安装配置笔记">fedora 10 安装配置笔记</a></li><li><a href="http://www.linuxbyte.org/open-source-times-no1.html" title=" ChinaUnix《开源时代》电子杂志第一期（9月刊）下载"> ChinaUnix《开源时代》电子杂志第一期（9月刊）下载</a></li><li><a href="http://www.linuxbyte.org/gnu-gpl-v2-zh.html" title="GNU GENERAL PUBLIC LICENSE Version 2">GNU GENERAL PUBLIC LICENSE Version 2</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/zi-wang-ji-suan-gong-ju-netmask.html">子网计算工具&#8211;netmask</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/netmask" rel="tag">netmask</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/netmask" title="netmask" rel="tag">netmask</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/zi-wang-ji-suan-gong-ju-netmask.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ubuntu 更新源签名错误 &#8211;BADSIG 40976EAF437D05B5</title>
		<link>http://www.linuxbyte.org/ubuntu-geng-xin-yuan-qian-ming-cuo-wu-badsig-40976eaf437d05b5.html</link>
		<comments>http://www.linuxbyte.org/ubuntu-geng-xin-yuan-qian-ming-cuo-wu-badsig-40976eaf437d05b5.html#comments</comments>
		<pubDate>Sat, 19 Feb 2011 03:47:08 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[40976EAF437D05B5]]></category>
		<category><![CDATA[BADSIG]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[签名错误]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=618</guid>
		<description><![CDATA[错误提示： GPG 错误：http://mirrors.163.com maverick-updates Release: 下列签名无效： BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key &#60;ftpmaster @ubuntu.com&#62; &#60;/ftpmaster&#62; 修复方法 gpg --keyserver keyserver.u... ]]></description>
			<content:encoded><![CDATA[<p>错误提示：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">GPG 错误：http://mirrors.163.com maverick-updates Release: 下列签名无效： BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ftpmaster</span> @ubuntu.com<span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ftpmaster<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><span id="more-618"></span><br />
修复方法</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">--keyserver</span> keyserver.ubuntu.com <span style="color: #660033;">--recv</span> 40976EAF437D05B5
gpg <span style="color: #660033;">--export</span> <span style="color: #660033;">--armor</span> 40976EAF437D05B5 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-key</span> add -</pre></div></div>

<p>上面的方法不行可以试试下面这个</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #660033;">-o</span> Acquire::http::No-Cache=True <span style="color: #660033;">-o</span> Acquire::<span style="color: #007800;">BrokenProxy</span>=<span style="color: #c20cb9; font-weight: bold;">true</span> update</pre></div></div>

<p>终极大法</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> clean
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>apt
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> lists lists.old
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> lists<span style="color: #000000; font-weight: bold;">/</span>partial
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> clean
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update</pre></div></div>

<p>以上方法来自：</p>
<p>http://forum.ubuntu.org.</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/sheng-ji-dao-ubuntu-11-10.html" title="升级到Ubuntu 11.10">升级到Ubuntu 11.10</a></li><li><a href="http://www.linuxbyte.org/ubuntu-11-04-zheng-shi-ban-xia-zai.html" title="ubuntu 11.04 正式版下载">ubuntu 11.04 正式版下载</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-2-fa-bu.html" title="Ubuntu 10.04.2 发布">Ubuntu 10.04.2 发布</a></li><li><a href="http://www.linuxbyte.org/wei-ni-de-linuxxia-an-zhuang-yuan-sheng-zfs.html" title="为你的Linux下安装原生 ZFS">为你的Linux下安装原生 ZFS</a></li><li><a href="http://www.linuxbyte.org/ubuntu-kao-lv-yong-lightdm-qu-dai-gdm.html" title="Ubuntu 考虑用 LightDM 取代 GDM ">Ubuntu 考虑用 LightDM 取代 GDM </a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-10-alpha-1-fa-bu.html" title="Ubuntu 10.10 Alpha 1 发布">Ubuntu 10.10 Alpha 1 发布</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-rc-fa-bu.html" title="Ubuntu 10.04 RC 发布">Ubuntu 10.04 RC 发布</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-xin-bi-zhi.html" title="Ubuntu 10.04 新壁纸">Ubuntu 10.04 新壁纸</a></li><li><a href="http://www.linuxbyte.org/ubuntu-9-10-ting-zhi-xi-tong-fu-wu.html" title="ubuntu 9.10 停止系统服务">ubuntu 9.10 停止系统服务</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-beta-1-fabu.html" title="Ubuntu 10.04 Beta 1 发布">Ubuntu 10.04 Beta 1 发布</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/ubuntu-geng-xin-yuan-qian-ming-cuo-wu-badsig-40976eaf437d05b5.html">Ubuntu 更新源签名错误 &#8211;BADSIG 40976EAF437D05B5</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/40976eaf437d05b5" rel="tag">40976EAF437D05B5</a>, <a href="http://www.linuxbyte.org/tag/badsig" rel="tag">BADSIG</a>, <a href="http://www.linuxbyte.org/tag/ubuntu" rel="tag">Ubuntu</a>, <a href="http://www.linuxbyte.org/tag/%e7%ad%be%e5%90%8d%e9%94%99%e8%af%af" rel="tag">签名错误</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/40976eaf437d05b5" title="40976EAF437D05B5" rel="tag">40976EAF437D05B5</a>, <a href="http://www.linuxbyte.org/tag/badsig" title="BADSIG" rel="tag">BADSIG</a>, <a href="http://www.linuxbyte.org/tag/ubuntu" title="Ubuntu" rel="tag">Ubuntu</a>, <a href="http://www.linuxbyte.org/tag/%e7%ad%be%e5%90%8d%e9%94%99%e8%af%af" title="签名错误" rel="tag">签名错误</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/ubuntu-geng-xin-yuan-qian-ming-cuo-wu-badsig-40976eaf437d05b5.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>History 命令经典用法15例</title>
		<link>http://www.linuxbyte.org/history-ming-ling-jing-dian-yong-fa-15li.html</link>
		<comments>http://www.linuxbyte.org/history-ming-ling-jing-dian-yong-fa-15li.html#comments</comments>
		<pubDate>Wed, 16 Feb 2011 05:01:49 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[精品文档]]></category>
		<category><![CDATA[系统管理]]></category>
		<category><![CDATA[History]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=607</guid>
		<description><![CDATA[如果你经常使用 Linux 命令行，那么使用 history（历史）命令可以有效地提升你的效率。本文将通过实例的方式向你介绍 history 命令的 15 个用法。 使用 HISTTIMEFORMAT 显示时间戳 当你从命令行执行 ... ]]></description>
			<content:encoded><![CDATA[<p>如果你经常使用 Linux 命令行，那么使用 history（历史）命令可以有效地提升你的效率。本文将通过实例的方式向你介绍 history 命令的 15 个用法。</p>
<p><strong>使用 HISTTIMEFORMAT 显示时间戳</strong></p>
<p>当你从命令行执行 history 命令后，通常只会显示已执行命令的序号和命令本身。如果你想要查看命令历史的时间戳，那么可以执行：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># export HISTTIMEFORMAT='%F %T '</span>
<span style="color: #666666; font-style: italic;"># history | more</span>
<span style="color: #000000;">1</span>  <span style="color: #000000;">2008</span>-08-05 <span style="color: #000000;">19</span>:02:<span style="color: #000000;">39</span> service network restart
<span style="color: #000000;">2</span>  <span style="color: #000000;">2008</span>-08-05 <span style="color: #000000;">19</span>:02:<span style="color: #000000;">39</span> <span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000;">3</span>  <span style="color: #000000;">2008</span>-08-05 <span style="color: #000000;">19</span>:02:<span style="color: #000000;">39</span> <span style="color: #c20cb9; font-weight: bold;">id</span>
<span style="color: #000000;">4</span>  <span style="color: #000000;">2008</span>-08-05 <span style="color: #000000;">19</span>:02:<span style="color: #000000;">39</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>redhat-release</pre></div></div>

<p><span id="more-607"></span><br />
<strong>注意</strong>：这个功能只能用在当 HISTTIMEFORMAT 这个环境变量被设置之后，之后的那些新执行的 bash 命令才会被打上正确的时间戳。在此之前的所有命令，都将会显示成设置 HISTTIMEFORMAT 变量的时间。[感谢 NightOwl 读者补充]</p>
<p><strong>使用 Ctrl+R 搜索历史</strong></p>
<p>Ctrl+R 是我经常使用的一个快捷键。此快捷键让你对命令历史进行搜索，对于想要重复执行某个命令的时候非常有用。当找到命令后，通常再按回车键就可以执行该命令。如果想对找到的命令进行调整后再执行，则可以按一下左或右方向键。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># [Press Ctrl+R from the command prompt, which will display the reverse-i-search prompt]</span>
<span style="color: #7a0874; font-weight: bold;">&#40;</span>reverse-i-search<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">red</span>‘: <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>redhat-release
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Note: Press enter when you see your <span style="color: #7a0874; font-weight: bold;">command</span>, <span style="color: #c20cb9; font-weight: bold;">which</span> will execute the <span style="color: #7a0874; font-weight: bold;">command</span> from the <span style="color: #7a0874; font-weight: bold;">history</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># cat /etc/redhat-release</span>
Fedora release <span style="color: #000000;">9</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Sulphur<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p><strong>快速重复执行上一条命令</strong></p>
<p>有 4 种方法可以重复执行上一条命令：</p>
<ol>
<li>使用上方向键，并回车执行。</li>
<li>按 !! 并回车执行。</li>
<li>输入 !-1 并回车执行。</li>
<li>按 Ctrl+P 并回车执行。</li>
</ol>
<p><strong>从命令历史中执行一个指定的命令</strong></p>
<p>在下面的例子中，如果你想重复执行第 4 条命令，那么可以执行 !4：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># history | more</span>
<span style="color: #000000;">1</span>  service network restart
<span style="color: #000000;">2</span>  <span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000;">3</span>  <span style="color: #c20cb9; font-weight: bold;">id</span>
<span style="color: #000000;">4</span>  <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>redhat-release
<span style="color: #666666; font-style: italic;"># !4</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>redhat-release
Fedora release <span style="color: #000000;">9</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Sulphur<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p><strong>通过指定关键字来执行以前的命令</strong></p>
<p>在下面的例子，输入 !ps 并回车，将执行以 ps 打头的命令：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># !ps</span>
<span style="color: #c20cb9; font-weight: bold;">ps</span> aux <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> yp
root     <span style="color: #000000;">16947</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">0.1</span>  <span style="color: #000000;">36516</span>  <span style="color: #000000;">1264</span> ?        Sl   <span style="color: #000000;">13</span>:<span style="color: #000000;">10</span>   <span style="color: #000000;">0</span>:00 ypbind
root     <span style="color: #000000;">17503</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">0.0</span>   <span style="color: #000000;">4124</span>   <span style="color: #000000;">740</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>    S+   <span style="color: #000000;">19</span>:<span style="color: #000000;">19</span>   <span style="color: #000000;">0</span>:00 <span style="color: #c20cb9; font-weight: bold;">grep</span> yp</pre></div></div>

<p><strong>使用 HISTSIZE 控制历史命令记录的总行数</strong></p>
<p>将下面两行内容追加到 .bash_profile 文件并重新登录 bash shell，命令历史的记录数将变成 450 条：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi ~/.bash_profile</span>
<span style="color: #007800;">HISTSIZE</span>=<span style="color: #000000;">450</span>
<span style="color: #007800;">HISTFILESIZE</span>=<span style="color: #000000;">450</span></pre></div></div>

<p><strong>使用 HISTFILE 更改历史文件名称</strong></p>
<p>默认情况下，命令历史存储在 ~/.bash<em>history 文件中。添加下列内容到 .bash</em>profile 文件并重新登录 bash shell，将使用 .commandline_warrior 来存储命令历史：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi ~/.bash_profile</span>
<span style="color: #007800;">HISTFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.commandline_warrior</pre></div></div>

<p><strong>使用 HISTCONTROL 从命令历史中剔除连续重复的条目</strong></p>
<p>在下面的例子中，pwd 命令被连续执行了三次。执行 history 后你会看到三条重复的条目。要剔除这些重复的条目，你可以将 HISTCONTROL 设置为 ignoredups：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># history | tail -4</span>
<span style="color: #000000;">44</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000;">45</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000;">46</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Note that there are three <span style="color: #7a0874; font-weight: bold;">pwd</span> commands <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #7a0874; font-weight: bold;">history</span>, after executing <span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">times</span> <span style="color: #c20cb9; font-weight: bold;">as</span> shown above<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000;">47</span>  <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-4</span>
<span style="color: #666666; font-style: italic;"># export HISTCONTROL=ignoredups</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># history | tail -3</span>
<span style="color: #000000;">56</span>  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTCONTROL</span>=ignoredups
<span style="color: #000000;">57</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Note that there is only one <span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #000000; font-weight: bold;">in</span> the <span style="color: #7a0874; font-weight: bold;">history</span>, even after executing <span style="color: #7a0874; font-weight: bold;">pwd</span> <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">times</span> <span style="color: #c20cb9; font-weight: bold;">as</span> shown above<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000;">58</span>  <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-4</span></pre></div></div>

<p><strong>使用 HISTCONTROL 清除整个命令历史中的重复条目</strong></p>
<p>上例中的 ignoredups 只能剔除连续的重复条目。要清除整个命令历史中的重复条目，可以将 HISTCONTROL 设置成 erasedups：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># export HISTCONTROL=erasedups</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># service httpd stop</span>
<span style="color: #666666; font-style: italic;"># history | tail -3</span>
<span style="color: #000000;">38</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000;">39</span>  service httpd stop
<span style="color: #000000;">40</span>  <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-3</span>
<span style="color: #666666; font-style: italic;"># ls -ltr</span>
<span style="color: #666666; font-style: italic;"># service httpd stop</span>
<span style="color: #666666; font-style: italic;"># history | tail -6</span>
<span style="color: #000000;">35</span>  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTCONTROL</span>=erasedups
<span style="color: #000000;">36</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000;">37</span>  <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-3</span>
<span style="color: #000000;">38</span>  <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-ltr</span>
<span style="color: #000000;">39</span>  service httpd stop
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Note that the previous service httpd stop after <span style="color: #7a0874; font-weight: bold;">pwd</span> got erased<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000;">40</span>  <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-6</span></pre></div></div>

<p><strong>使用 HISTCONTROL 强制 history 不记住特定的命令</strong></p>
<p>将 HISTCONTROL 设置为 ignorespace，并在不想被记住的命令前面输入一个空格：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># export HISTCONTROL=ignorespace</span>
<span style="color: #666666; font-style: italic;"># ls -ltr</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;">#  service httpd stop [Note that there is a space at the beginning of service, to ignore this command from history]</span>
<span style="color: #666666; font-style: italic;"># history | tail -3</span>
<span style="color: #000000;">67</span>  <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-ltr</span>
<span style="color: #000000;">68</span>  <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000;">69</span>  <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-3</span></pre></div></div>

<p><strong>使用 -c 选项清除所有的命令历史</strong></p>
<p>如果你想清除所有的命令历史，可以执行：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># history -c</span></pre></div></div>

<p><strong>命令替换</strong></p>
<p>在下面的例子里，!!:$ 将为当前的命令获得上一条命令的参数：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ls anaconda-ks.cfg</span>
anaconda-ks.cfg
<span style="color: #666666; font-style: italic;"># vi !!:$</span>
<span style="color: #c20cb9; font-weight: bold;">vi</span> anaconda-ks.cfg</pre></div></div>

<p><strong>补充</strong>：使用 !$ 可以达到同样的效果，而且更简单。[感谢 wanzigunzi 读者补充]</p>
<p>下例中，!^ 从上一条命令获得第一项参数：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cp anaconda-ks.cfg anaconda-ks.cfg.bak</span>
anaconda-ks.cfg
<span style="color: #666666; font-style: italic;"># vi -5 !^</span>
<span style="color: #c20cb9; font-weight: bold;">vi</span> anaconda-ks.cfg</pre></div></div>

<p><strong>为特定的命令替换指定的参数</strong></p>
<p>在下面的例子，!cp:2 从命令历史中搜索以 cp 开头的命令，并获取它的第二项参数：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cp ~/longname.txt /really/a/very/long/path/long-filename.txt</span>
<span style="color: #666666; font-style: italic;"># ls -l !cp:2</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>really<span style="color: #000000; font-weight: bold;">/</span>a<span style="color: #000000; font-weight: bold;">/</span>very<span style="color: #000000; font-weight: bold;">/</span>long<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>long-filename.txt</pre></div></div>

<p>下例里，!cp:$ 获取 cp 命令的最后一项参数：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ls -l !cp:$</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>really<span style="color: #000000; font-weight: bold;">/</span>a<span style="color: #000000; font-weight: bold;">/</span>very<span style="color: #000000; font-weight: bold;">/</span>long<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>long-filename.txt</pre></div></div>

<p><strong>使用 HISTSIZE 禁用 history</strong></p>
<p>如果你想禁用 history，可以将 HISTSIZE 设置为 0：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># export HISTSIZE=0</span>
<span style="color: #666666; font-style: italic;"># history</span>
<span style="color: #666666; font-style: italic;"># [Note that history did not display anything]</span></pre></div></div>

<p><strong>使用 HISTIGNORE 忽略历史中的特定命令</strong></p>
<p>下面的例子，将忽略 pwd、ls、ls -ltr 等命令：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># export HISTIGNORE=”pwd:ls:ls -ltr:”</span>
<span style="color: #666666; font-style: italic;"># pwd</span>
<span style="color: #666666; font-style: italic;"># ls</span>
<span style="color: #666666; font-style: italic;"># ls -ltr</span>
<span style="color: #666666; font-style: italic;"># service httpd stop</span>
<span style="color: #666666; font-style: italic;"># history | tail -3</span>
<span style="color: #000000;">79</span>  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTIGNORE</span>=”<span style="color: #7a0874; font-weight: bold;">pwd</span>:<span style="color: #c20cb9; font-weight: bold;">ls</span>:<span style="color: #c20cb9; font-weight: bold;">ls</span> -ltr:”
<span style="color: #000000;">80</span>  service httpd stop
<span style="color: #000000;">81</span>  <span style="color: #7a0874; font-weight: bold;">history</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Note that <span style="color: #7a0874; font-weight: bold;">history</span> did not record <span style="color: #7a0874; font-weight: bold;">pwd</span>, <span style="color: #c20cb9; font-weight: bold;">ls</span> and <span style="color: #c20cb9; font-weight: bold;">ls</span> -ltr<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>原文地址：</p>
<p>http://www.javaeye.com/topic/835928</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/unixshellbian-cheng-di-san-ban.html" title="Unix.Shell编程(第三版)">Unix.Shell编程(第三版)</a></li><li><a href="http://www.linuxbyte.org/yong-shc-jiami-shell.html" title="用shc 加密shell">用shc 加密shell</a></li><li><a href="http://www.linuxbyte.org/shel-fang-zhi-wu-cao-zuo.html" title="用 !$ 防止误操作">用 !$ 防止误操作</a></li><li><a href="http://www.linuxbyte.org/fun-unix-shell.html" title="一些奇怪的unix指令名字的由来">一些奇怪的unix指令名字的由来</a></li><li><a href="http://www.linuxbyte.org/fun-bash-shell.html" title="几个有用的bash shell组合">几个有用的bash shell组合</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/history-ming-ling-jing-dian-yong-fa-15li.html">History 命令经典用法15例</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/history" rel="tag">History</a>, <a href="http://www.linuxbyte.org/tag/shell" rel="tag">shell</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/history" title="History" rel="tag">History</a>, <a href="http://www.linuxbyte.org/tag/shell" title="shell" rel="tag">shell</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/history-ming-ling-jing-dian-yong-fa-15li.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu 10.04 安装 VirtualBox 小记</title>
		<link>http://www.linuxbyte.org/ubuntu-10-04-an-zhuang-virtualbox-xiao-ji.html</link>
		<comments>http://www.linuxbyte.org/ubuntu-10-04-an-zhuang-virtualbox-xiao-ji.html#comments</comments>
		<pubDate>Tue, 08 Feb 2011 08:37:59 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[vbox]]></category>
		<category><![CDATA[virtualbox]]></category>
		<category><![CDATA[虚拟机]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=594</guid>
		<description><![CDATA[最爱linux 命令的简洁强大，几条命令轻松安装VirtualBox。 添加VirtualBox的安装源： sudo su - echo &#34;deb http://download.virtualbox.org/virtualbox/debian lucid contrib&#34; &#62;&#62; /etc/apt/sources.list 添加数字签名: wge... ]]></description>
			<content:encoded><![CDATA[<p>最爱linux 命令的简洁强大，几条命令轻松安装VirtualBox。</p>
<p>添加VirtualBox的安装源：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span>  <span style="color: #c20cb9; font-weight: bold;">su</span> -
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;deb http://download.virtualbox.org/virtualbox/debian lucid contrib&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list</pre></div></div>

<p>添加数字签名:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-q</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>oracle_vbox.asc <span style="color: #660033;">-O-</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">apt-key</span> add -</pre></div></div>

<p><span id="more-594"></span><br />
安装vbox 和 dkms:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update 
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> virtualbox-<span style="color: #000000;">4.0</span> dkms</pre></div></div>

<p>各系统版本安装源参看下面:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian maverick contrib <span style="color: #666666; font-style: italic;">#Ubuntu 10.10</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian lucid contrib <span style="color: #666666; font-style: italic;">#Ubuntu 10.04</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian karmic contrib <span style="color: #666666; font-style: italic;">#Ubuntu 9.10</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian jaunty contrib <span style="color: #666666; font-style: italic;">#Ubuntu 9.04</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian intrepid contrib <span style="color: #666666; font-style: italic;">#Ubuntu 8.10</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian hardy contrib  <span style="color: #666666; font-style: italic;">#Ubuntu 8.04</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian squeeze contrib <span style="color: #666666; font-style: italic;">#Debian 6.0 </span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian lenny contrib <span style="color: #666666; font-style: italic;">#Debian 5.0</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian etch contrib <span style="color: #666666; font-style: italic;">#Debian 4.0</span></pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/sun-snags-open-source-virtualization-company-innotek.html" title=" Sun收购开源虚拟软件VirtualBox的开发商Innotek"> Sun收购开源虚拟软件VirtualBox的开发商Innotek</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/ubuntu-10-04-an-zhuang-virtualbox-xiao-ji.html">ubuntu 10.04 安装 VirtualBox 小记</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/vbox" rel="tag">vbox</a>, <a href="http://www.linuxbyte.org/tag/virtualbox" rel="tag">virtualbox</a>, <a href="http://www.linuxbyte.org/tag/%e8%99%9a%e6%8b%9f%e6%9c%ba" rel="tag">虚拟机</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/vbox" title="vbox" rel="tag">vbox</a>, <a href="http://www.linuxbyte.org/tag/virtualbox" title="virtualbox" rel="tag">virtualbox</a>, <a href="http://www.linuxbyte.org/tag/%e8%99%9a%e6%8b%9f%e6%9c%ba" title="虚拟机" rel="tag">虚拟机</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/ubuntu-10-04-an-zhuang-virtualbox-xiao-ji.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为你的Linux下安装原生 ZFS</title>
		<link>http://www.linuxbyte.org/wei-ni-de-linuxxia-an-zhuang-yuan-sheng-zfs.html</link>
		<comments>http://www.linuxbyte.org/wei-ni-de-linuxxia-an-zhuang-yuan-sheng-zfs.html#comments</comments>
		<pubDate>Mon, 24 Jan 2011 14:32:25 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[zfs]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=583</guid>
		<description><![CDATA[本文指导你为你的Linux系统安装原生ZFS,系统测试环境为Ubuntu 10.10 Linux 2.6.35-24-generic #42-Ubuntu SMP x86_64 内核，Ubuntu 10.04 应该也能顺利安装。 确保您已经安装下面的几个包 build-essential gawk zlib1g-dev u... ]]></description>
			<content:encoded><![CDATA[<p>本文指导你为你的Linux系统安装原生ZFS,系统测试环境为Ubuntu 10.10 Linux 2.6.35-24-generic #42-Ubuntu SMP x86_64  内核，Ubuntu 10.04 应该也能顺利安装。</p>
<p>确保您已经安装下面的几个包</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">build-essential
gawk
zlib1g-dev
uuid-dev</pre></div></div>

<p>如果没有安装运行下面命令安装：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential <span style="color: #c20cb9; font-weight: bold;">gawk</span> zlib1g-dev uuid-dev</pre></div></div>

<p><span id="more-583"></span><br />
现在开始安装SPL和ZFS 所需软件包可从 http://zfsonlinux.org/ 下载得到。<br />
下载SPL和ZFS：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #666666; font-style: italic;">#Download the latest release, e.g.:</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>behlendorf<span style="color: #000000; font-weight: bold;">/</span>spl<span style="color: #000000; font-weight: bold;">/</span>spl-0.5.2.tar.gz
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>behlendorf<span style="color: #000000; font-weight: bold;">/</span>zfs<span style="color: #000000; font-weight: bold;">/</span>zfs-0.5.2.tar.gz</pre></div></div>

<p>安装SPL ：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> spl-0.5.2.tar.gz
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #7a0874; font-weight: bold;">cd</span> spl-0.5.2<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>安装ZFS:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> zfs-0.5.2.tar.gz
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #7a0874; font-weight: bold;">cd</span> zfs-0.5.2<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>安装成功后挂载splat 和 zfs.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> modprobe splat
<span style="color: #c20cb9; font-weight: bold;">sudo</span> splat <span style="color: #660033;">-a</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> modprobe zfs
<span style="color: #c20cb9; font-weight: bold;">lsmod</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> zfs</pre></div></div>

<p>如果你遇到如下错误提示:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">zfs: error while loading shared libraries: libspl.so.0: cannot open shared object file: No such file or directory</pre></div></div>

<p>请执行下面命令指定libspl.so.0所在位置:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #007800;">$LD_LIBRARY_PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib</pre></div></div>

<p>本文并非原创为《<a href="http://www.howtoforge.com/native-zfs-on-ubuntu">Native ZFS On Ubuntu</a>》的译文</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/sheng-ji-dao-ubuntu-11-10.html" title="升级到Ubuntu 11.10">升级到Ubuntu 11.10</a></li><li><a href="http://www.linuxbyte.org/ubuntu-11-04-zheng-shi-ban-xia-zai.html" title="ubuntu 11.04 正式版下载">ubuntu 11.04 正式版下载</a></li><li><a href="http://www.linuxbyte.org/ubuntu-geng-xin-yuan-qian-ming-cuo-wu-badsig-40976eaf437d05b5.html" title="Ubuntu 更新源签名错误 &#8211;BADSIG 40976EAF437D05B5 ">Ubuntu 更新源签名错误 &#8211;BADSIG 40976EAF437D05B5 </a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-2-fa-bu.html" title="Ubuntu 10.04.2 发布">Ubuntu 10.04.2 发布</a></li><li><a href="http://www.linuxbyte.org/ubuntu-kao-lv-yong-lightdm-qu-dai-gdm.html" title="Ubuntu 考虑用 LightDM 取代 GDM ">Ubuntu 考虑用 LightDM 取代 GDM </a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-10-alpha-1-fa-bu.html" title="Ubuntu 10.10 Alpha 1 发布">Ubuntu 10.10 Alpha 1 发布</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-rc-fa-bu.html" title="Ubuntu 10.04 RC 发布">Ubuntu 10.04 RC 发布</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-xin-bi-zhi.html" title="Ubuntu 10.04 新壁纸">Ubuntu 10.04 新壁纸</a></li><li><a href="http://www.linuxbyte.org/ubuntu-9-10-ting-zhi-xi-tong-fu-wu.html" title="ubuntu 9.10 停止系统服务">ubuntu 9.10 停止系统服务</a></li><li><a href="http://www.linuxbyte.org/ubuntu-10-04-beta-1-fabu.html" title="Ubuntu 10.04 Beta 1 发布">Ubuntu 10.04 Beta 1 发布</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/wei-ni-de-linuxxia-an-zhuang-yuan-sheng-zfs.html">为你的Linux下安装原生 ZFS</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/ubuntu" rel="tag">Ubuntu</a>, <a href="http://www.linuxbyte.org/tag/zfs" rel="tag">zfs</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/ubuntu" title="Ubuntu" rel="tag">Ubuntu</a>, <a href="http://www.linuxbyte.org/tag/zfs" title="zfs" rel="tag">zfs</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/wei-ni-de-linuxxia-an-zhuang-yuan-sheng-zfs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

