<?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>易水博客 &#187; linux</title>
	<atom:link href="http://easwy.com/blog/archives/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://easwy.com/blog</link>
	<description>关注Linux, Scala, Java, 开源软件和嵌入式系统</description>
	<lastBuildDate>Fri, 10 Sep 2010 09:08:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux使用笔记：Linux下动态链接库配置</title>
		<link>http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/</link>
		<comments>http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 06:16:52 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[嵌入系统]]></category>
		<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1020</guid>
		<description><![CDATA[ 当Easwy尝试telent一个远端设备(ssh也遇到同样的错误)时，遇到下面的提示：

/usr/local/bin/cli: error while loading shared libraries: libAbc.so: cannot open shared object file: No such file or directory 
...

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/enable-ip-forward-on-linux/' rel='bookmark' title='Permanent Link: Linux使用笔记: 在Linux中使能IP转发'>Linux使用笔记: 在Linux中使能IP转发</a></li>
<li><a href='http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题'>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</a></li>
<li><a href='http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/' rel='bookmark' title='Permanent Link: Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)'>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    当<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>尝试telent一个远端设备时，遇到下面的提示(ssh也遇到同样的错误)：
  </p>
<pre class="programlisting">
/usr/local/bin/cli: error while loading shared libraries: libAbc.so: cannot open shared object file: No such file or directory </pre>
<p>
    在这个设备里，由<span class="command"><strong>xinetd</strong></span>来启动<span class="command"><strong>in.telnetd</strong></span>，而<span class="command"><strong>in.telnetd</strong></span>则调用<span class="command"><strong>/usr/local/bin/cli</strong></span>来做为登录程序。看上述提示，应该是<span class="command"><strong>in.telnetd</strong></span>在启动<span class="command"><strong>/usr/local/bin/cli</strong></span>时找不到动态链接库。
  </p>
<p>
    首先用<span class="command"><strong>ldd</strong></span>命令查看一下<span class="command"><strong>/usr/local/bin/cli</strong></span>所使用的动态链接库：
  </p>
<pre class="programlisting">
$ ldd /usr/local/bin/cli
linux-vdso32.so.1 =  (0x00100000)
libAbc.so =&gt; /usr/local/lib/libAbc.so (0x0fdfc000)
libreadline.so.5 =&gt; /lib/libreadline.so.5 (0x0f376000)
libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x0f337000)
libstdc++.so.6 =&gt; /lib/libstdc++.so.6 (0x0f24e000)
libm.so.6 =&gt; /lib/libm.so.6 (0x0f17a000)
libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0x0f14a000)
/lib/ld.so.1 (0x48000000)
libtinfo.so.5 =&gt; /lib/libtinfo.so.5 (0x0efaa000)&gt; </pre>
<p>
    从上面的命令输出可以看到，<span class="command"><strong>cli</strong></span>程序的确会调用libAbc.so这个库，不过上面的输出中，这个库已经被找到了，它对应着文件/usr/local/lib/libAbc.so。考虑到在shell中已经设置了<span class="emphasis"><em>LD_LIBRARY_PATH</em></span>环境变量，在此环境变量中增加了<span class="emphasis"><em>/usr/local/lib</em></span>目录，那么是不是xinetd在启动in.telnetd时没有传递此环境变量呢？
  </p>
<p>
    于是修改<span class="emphasis"><em>/etc/xinetd.d/telnet</em></span>，在里面增加一行：
  </p>
<pre class="programlisting">
env = LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib </pre>
<p>
    再次telnet，还是显示上述错误。似乎是in.telnetd在启动cli时没有传递上述环境变量。
  </p>
<p>
    幸好还有一个方法来指定动态链接库的位置。
  </p>
<p>
    <a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>在目录<span class="emphasis"><em>/etc/ld.so.conf.d</em></span>中新增加一个文件<span class="emphasis"><em>cli.conf</em></span>，内容是：
  </p>
<pre class="programlisting">
$  cat cli.conf
/usr/local/lib </pre>
<p>
    然后再以root身份执行一下<span class="command"><strong>ldconfig</strong></span>命令。现在再telnet或ssh，就不会出现上述错误提示了。
  </p>
<p>
    <span class="command"><strong>/usr/ldconfig</strong></span>命令会读取命令行参数、<span class="emphasis"><em>/etc/ld.so.conf</em></span>配置文件以及/lib和/usr/lib目录，为动态链接器<span class="command"><strong>ld.so</strong></span>和<span class="command"><strong>ld-linux.so</strong></span>生成所需的链接和缓存信息。也就是说，如果不修改任何配置，只有位于/lib和/usr/lib目录的库才能被动态链接器使用。<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>上面的修改新增了<span class="emphasis"><em>/usr/local/lib</em></span>目录，并且使用<span class="command"><strong>/sbin/ldconfig</strong></span>命令重新生成了缓存，使动态链接器可以引用上述目录的库。这样就解决了此问题。
  </p>
<p>
    因此，在你也遇到类似的错误时，如果有root权限，就可以用这种方法来解决；如果没有root权限，那就只能设置一下<span class="command"><strong>LD_LIBRARY_PATH</strong></span>环境变量了。
  </p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/" target="_top">http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/enable-ip-forward-on-linux/' rel='bookmark' title='Permanent Link: Linux使用笔记: 在Linux中使能IP转发'>Linux使用笔记: 在Linux中使能IP转发</a></li>
<li><a href='http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题'>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</a></li>
<li><a href='http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/' rel='bookmark' title='Permanent Link: Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)'>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux下常用程序的代理服务器(proxy)配置</title>
		<link>http://easwy.com/blog/archives/proxy-setting-on-linux-console/</link>
		<comments>http://easwy.com/blog/archives/proxy-setting-on-linux-console/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 04:26:17 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1001</guid>
		<description><![CDATA[Linux下有很多程序都只有命令行接口，对于这类程序，它们通过代理服务器(proxy)访问网络的方式也不尽相同。在本文中Easwy总结了一些常用Linux程序配置代理服务器的方法。 

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/use_http_proxy_for_git/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用代理服务器访问git版本库'>Linux使用笔记: 使用代理服务器访问git版本库</a></li>
<li><a href='http://easwy.com/blog/archives/use-rxvt-in-cygwin/' rel='bookmark' title='Permanent Link: 使用rxvt做为cygwin终端'>使用rxvt做为cygwin终端</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    Linux下有很多程序都只有命令行接口，对于这类程序，它们通过代理服务器(proxy)访问网络的方式也不尽相同。在本文中<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>总结了一些常用Linux程序配置代理服务器的方法。
  </p>
<p><span class="bold"><strong>[ 通用代理服务器配置 ]</strong></span></p>
<p>
    对于大多数Linux控制台程序，例如<a class="ulink" href="http://easwy.com/blog/archives/tag/debian/" target="_top">Debian</a>或Ubuntu中的<span class="command"><strong>apt-get</strong></span>和<span class="command"><strong>aptitude</strong></span>命令、<a class="ulink" href="http://easwy.com/blog/archives/use_http_proxy_for_git/" target="_top">git命令</a>、wget命令，这些程序都使用<span class="emphasis"><em>http_proxy</em></span>和<span class="emphasis"><em>ftp_proxy</em></span>环境变量来获取代理服务的配置。
  </p>
<p>
    方法是在你的~/.bashrc里加上类似下面的话：
  </p>
<pre class="programlisting">
export http_proxy=http://username:password@proxyserver:port/
export ftp_proxy=http://username:password@proxyserver:port/ </pre>
<p>
    如果你的代理服务器需要用户名和密码才能访问，需要填写上面的username和passwd部分，否则的话，省略这两部分。
  </p>
<p>
    例如，假设你的代理服务器为<span class="emphasis"><em>192.168.1.1</em></span>，端口是<span class="emphasis"><em>8080</em></span>，用户名为<span class="emphasis"><em>easwy</em></span>，密码是<span class="emphasis"><em>123456</em></span>，那么应该这样设置这两个环境变量：
  </p>
<pre class="programlisting">
export http_proxy=http://easwy:123456@192.168.1.1:8080
export ftp_proxy=http://easwy:123456@192.168.1.1:8080 </pre>
<p>
    这样配置之后，退出再登录一次，或者直接使用下面的命令source一下.bashrc：
  </p>
<pre class="programlisting">source ~/.bashrc</pre>
<p>
    现在，上述程序就可以通过代理服务器访问网络了。
  </p>
<p><span class="bold"><strong>[ subversion的代理服务器配置 ]</strong></span></p>
<p>
    要配置subversion的代理服务器，需要修改<span class="emphasis"><em>$HOME/.subversion/servers</em></span>文件，在此文件的<span class="emphasis"><em>[global]</em></span>段加上：
  </p>
<pre class="programlisting">
http-proxy-host = 192.168.1.1
http-proxy-port = 8080
http-proxy-username = <a href="http://easwy.com/">easwy</a>
http-proxy-password = 123456 </pre>
<p>    现在<span class="command"><strong>svn</strong></span>就可以使用代理服务器访问版本库了。
  </p>
<p><span class="bold"><strong>[ yum的代理服务器配置 ]</strong></span></p>
<p>
    如果想让CentOS中的<span class="command"><strong>yum</strong></span>可以通过代理服务器更新程序，则需要修改文件<span class="emphasis"><em>/etc/yum.conf</em></span>，在此文件中加上：
  </p>
<p>
proxy=http://easwy:123456@192.168.1.1:8080</p>
<p>
    现在使用<span class="command"><strong>yum</strong></span>就可以更新你的软件了。
  </p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/proxy-setting-on-linux-console/" target="_top">http://easwy.com/blog/archives/proxy-setting-on-linux-console/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/use_http_proxy_for_git/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用代理服务器访问git版本库'>Linux使用笔记: 使用代理服务器访问git版本库</a></li>
<li><a href='http://easwy.com/blog/archives/use-rxvt-in-cygwin/' rel='bookmark' title='Permanent Link: 使用rxvt做为cygwin终端'>使用rxvt做为cygwin终端</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/proxy-setting-on-linux-console/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用Synergy共享你的鼠标和键盘</title>
		<link>http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/</link>
		<comments>http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 02:20:14 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1000</guid>
		<description><![CDATA[ 前几天同事介绍了一个很好的软件Synergy，使用这个软件，可以在多台计算机间共享一个鼠标/键盘，每台计算机都有自己的屏幕，可以安装相同或不同的操作系统。
Easwy马上试用了一下这个软件，立刻就喜欢上了。...

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='Permanent Link: 在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-client-too-old-error/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题'>Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题</a></li>
<li><a href='http://easwy.com/blog/archives/enable-ip-forward-on-linux/' rel='bookmark' title='Permanent Link: Linux使用笔记: 在Linux中使能IP转发'>Linux使用笔记: 在Linux中使能IP转发</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    公司为每个软件开发人员配置了两部计算机，一部台式机安装Linux操作系统，一部笔记本安装Windows XP。开发编程主要在Linux下，处理文档和邮件则在Windows下。
  </p>
<p>
    工作经常需要在两台电脑间切换，一般情况下，<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>都是把椅子移来移去来切换，或者是使用远程桌面来从一台计算机上访问另外一台计算机，由Windows访问Linux远程桌面可以使用<a class="ulink" href="http://easwy.com/blog/archives/linux-remote-desktop-via-cygwin-x-server/" target="_top">cygwin X server</a>，由Linux访问Windows远程桌面可以用<a class="ulink" href="http://www.rdesktop.org/" target="_top">rdesktop</a>。但这两种方式都不太方便，移动椅子就不说了，用远程桌面只能使用一个屏幕来做显示，不能充分利用两个屏幕。
  </p>
<p>
    有时需要在两台电脑间交换数据，文件共享一般使用Samba，在Windows上访问Linux的Samba服务器，或者<a class="ulink" href="http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/" target="_top">从Linux上通过Samba访问Windows的共享目录</a>。而少量数据的共享，例如剪切板中数据的共享则比较麻烦。
  </p>
<p>
    前几天同事介绍了一个很好的软件<a class="ulink" href="http://synergy2.sourceforge.net/" target="_top">Synergy</a>，使用这个软件，可以在多台计算机间共享一个鼠标/键盘，每台计算机都可以有自己的屏幕，可以安装相同或不同的操作系统。
  </p>
<p>
    Easwy马上试用了一下这个软件，立刻就喜欢上了。安装完后，<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>把Linux台式机设置为Synergy Server，Windows XP笔记本设置为Synergy Client(因为我大多数时间在Linux下工作)。设置好后，笔记本好像变成台式机的扩展屏幕了，鼠标移出台式机的窗口右边界后，就会移入笔记本的屏幕中，而此时台式机的键盘输入就直接输入到笔记本中了。同时，两台计算机间可以共享剪切板中的数据了。在Windows上拷贝一块数据到剪切板中，鼠标移回Linux，一按中键，就粘贴在vim中了，反之亦然，非常方便。
  </p>
<p>
    Synergy的安装配置都很简单，首先到<a class="ulink" href="http://sourceforge.net/project/showfiles.php?group_id=59275&amp;release_id=406637" target="_top">http://sourceforge.net/project/showfiles.php?group_id=59275&amp;release_id=406637</a>下载synergy，根据你操作系统的类型下载Linux或Windows的版本，下载后直接安装。
  </p>
<p>
    安装后需要在每台主机上运行synergy，并做相应的配置。Window上的synergy提供了图形化配置界面，Easwy配置成&#8221;Use another computer&#8217;s shared keyboard and mouse(client)&#8221;，并填入共享键盘/鼠标计算机的主机名。
  </p>
<p>
    Linux下需要写一个简单的配置文件，<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>的配置文件如下：
  </p>
<pre class="programlisting">
section: screens
    szx-w-easwyy.easwy.com:
    szx-n-easwyy:
end
section: links
    szx-w-easwyy.easwy.com:
        right = szx-n-easwyy
    szx-n-easwyy:
        left = szx-w-easwyy.easwy.com
end </pre>
<p>
    把这个文件存为<span class="emphasis"><em>/etc/synergy.conf</em></span>，然后在命令行下执行：
  </p>
<pre class="programlisting">
synergys -f --config /etc/synergy.conf </pre>
<p>    这样就在前台启动了synergy服务器，之所以在前台启动是为了方便查看调试输出信息。接下来就可以测试一下效果。如果都没问题，按<span class="command"><strong>CTRL-C</strong></span>终止前台的synergy，然后把上面命令中的<span class="emphasis"><em>-f</em></span>参数去掉，在后台启动synergy。你可以把启动synergy加到你的启动脚本里，例如<span class="emphasis"><em>/etc/rc.local</em></span>。
  </p>
<p>
    简单介绍一下上面的配置文件：
  </p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
    <span class="emphasis"><em>screens</em></span>一节列出你打算共享同一个键盘/鼠标的主机名，需要注意的是这里的主机名必须和你计算机上<span class="command"><strong>hostname</strong></span>命令的输出一致，不然synergy就会提示找不到对应的主机。
    </li>
<li class="listitem">
      <span class="emphasis"><em>links</em></span>一节则列出各主机间的位置关系，上面的配置指明了Linux台式机的右边是笔记本，而笔记本的左边是台式机。这样，鼠标移出台式机屏幕的右边界就会移入笔记本屏幕，而移出笔记本屏幕的左边界后就会移回台式机屏幕了。
    </li>
</ul>
</div>
<p>
    如果你需要特殊的配置，或者遇到了什么问题，请参见Synergy的主页。
  </p>
<p>
    <span class="bold"><strong>2010/01/19更新</strong></span>
  </p>
<p>    网友Stephenjy留言说，Synergy从2006年以来就没有更新过了，有人在Google Code上建立了新的<a class="ulink" href="http://code.google.com/p/synergy-plus/" target="_top">Synergy+</a>项目来继续维护。所以，如果你想试用，请直接下载Synergy+，网址是<a class="ulink" href="http://code.google.com/p/synergy-plus/" target="_top">http://code.google.com/p/synergy-plus/</a>。Easwy看了一下Synergy+的说明，基本是对Synergy的Bug修正，配置方法和Synergy完全一致。使用Easwy上面给出的配置，可以正常运行Synergy+。
  </p>
<p>
    <span class="bold"><strong>2010/01/25更新</strong></span>
  </p>
<p>
在CentOS 5.3上，synergy+ 1.3.4工作有问题。如果以CentOS 5.3做为server，每当把鼠标移入客户端，然后准备输入时，server端就会没有响应。只能从客户端ssh到CentOS服务器来kill掉到Synergy+ Server，CentOS上的键盘/鼠标才能恢复使用。我已经报告了此问题：<a href="http://code.google.com/p/synergy-plus/issues/detail?id=342"> Issue 342: synergy+ server is not responding</a>，但暂时还未解决。
</p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
      <a class="ulink" href="http://synergy2.sourceforge.net/" target="_top">Synergy</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/" target="_top">http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='Permanent Link: 在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-client-too-old-error/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题'>Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题</a></li>
<li><a href='http://easwy.com/blog/archives/enable-ip-forward-on-linux/' rel='bookmark' title='Permanent Link: Linux使用笔记: 在Linux中使能IP转发'>Linux使用笔记: 在Linux中使能IP转发</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 使用代理服务器访问git版本库</title>
		<link>http://easwy.com/blog/archives/use_http_proxy_for_git/</link>
		<comments>http://easwy.com/blog/archives/use_http_proxy_for_git/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 06:40:42 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=986</guid>
		<description><![CDATA[本文介绍了如何穿越http代理服务器访问git版本库。

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/proxy-setting-on-linux-console/' rel='bookmark' title='Permanent Link: Linux下常用程序的代理服务器(proxy)配置'>Linux下常用程序的代理服务器(proxy)配置</a></li>
<li><a href='http://easwy.com/blog/archives/linux-remote-desktop-by-vnc/' rel='bookmark' title='Permanent Link: 用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)'>用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    今天想用git下载<a class="ulink" href="http://eclim.org/" target="_top">eclim</a>的源代码，因为公司的网络使用了代理服务器，无法直接访问git协议所监听端口。幸好github支持http协议的访问。于是，使用下面的命令设置了http proxy:
  </p>
<pre class="programlisting">
export http_proxy=http://my_proxy_server:port </pre>
<p>
    这样设置后，使用git可以访问版本服务器了，但在下载的时候却出现这样的错误：
  </p>
<pre class="programlisting">
$ git clone http://github.com/ervandew/eclim.git

Initialized empty Git repository in /home/easwy/90download/eclim/git/eclim/.git/

got 559057ba6b5133554e9603d400398c0700752c49
walk 559057ba6b5133554e9603d400398c0700752c49
got c177f69b4c5a18c7ee5aab65cdb88fcd410169df
got 1bd4276c2aa8832c8950f3be030e6eddde5a8b56
walk 1bd4276c2aa8832c8950f3be030e6eddde5a8b56
Getting alternates list for http://github.com/ervandew/eclim.git
Getting pack list for http://github.com/ervandew/eclim.git
Getting index for pack 523055f70fe6414d844af3180da0ade0adc95f87
Getting index for pack d338b3e2c4e213d4da51ddc86d898a11242ab9ec
Getting pack 523055f70fe6414d844af3180da0ade0adc95f87
 which contains aaae75262ebffdfa97c584f6b69967b0f5cc8cc8
 error: Unable to get pack file http://github.com/ervandew/eclim.git/objects/pack/pack-523055f70fe6414d844af3180da0ade0adc95f87.pack
 transfer closed with 30775470 bytes remaining to read
 error: Unable to find aaae75262ebffdfa97c584f6b69967b0f5cc8cc8 under http://github.com/ervandew/eclim.git
 Cannot obtain needed blob aaae75262ebffdfa97c584f6b69967b0f5cc8cc8
 while processing commit 1bd4276c2aa8832c8950f3be030e6eddde5a8b56. 

$ /usr/bin/git version
 git version 1.5.2.1 </pre>
<p>
    在网上搜了一下，也有其它人遇到这个问题，好像是git的bug，目前还不知道解决办法。即使换用git版本1.6.6还是存在此问题。难怪网上有人建议尽量不要使用http协议访问git版本库，除非你位于防火墙后面，可我恰好就是这种情况，郁闷ing!
  </p>
<p><span class="bold"><strong>2010/1/13更新</strong></span></p>
<p>
    网友ufly提到可以使用corkscrew来访问git版本库，<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>按照文章<a class="ulink" href="https://gforge.ti.com/gf/project/omapandroid/wiki/?pagename=Git+Firewall" target="_top">Git Firewall</a>里讲的试了一下，还是不成功。
  </p>
<p>
    这可能是公司所用的代理服务器的限制，比如，当我尝试通过corkscrew进行ssh访问时，代理服务器会返回下面的信息：
  </p>
<pre class="programlisting">
$ ssh easwy@remote-server
Proxy could not open connnection to remote-server:  ( The specified Secure Sockets Layer (SSL) port is not allowed. ISA Server is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )
ssh_exchange_identification: Connection closed by remote host </pre>
<p>
    也就是说，公司的http proxy限制了通过SSL访问的端口只能是443端口，如果不是443端口则拒绝连接。
  </p>
<p>
    幸好github.com也开通了443端口的访问，文章<a class="ulink" href="http://blog.codeslower.com/2008/8/Using-PuTTY-and-SSL-to-securely-access-GitHub-repositories-via-SSH" target="_top"> Access GitHub repositories from work (take that, firewall!).</a>及其后的评论介绍了如何在windows及Linux下穿越防火墙访问github.com。等有时间试一下。
  </p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章。
  </p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/use_http_proxy_for_git/" target="_top">http://easwy.com/blog/archives/use_http_proxy_for_git/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/proxy-setting-on-linux-console/' rel='bookmark' title='Permanent Link: Linux下常用程序的代理服务器(proxy)配置'>Linux下常用程序的代理服务器(proxy)配置</a></li>
<li><a href='http://easwy.com/blog/archives/linux-remote-desktop-by-vnc/' rel='bookmark' title='Permanent Link: 用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)'>用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/use_http_proxy_for_git/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>解决Thinkpad T400在Debian Linux下不能休眠/待机的问题</title>
		<link>http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/</link>
		<comments>http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 07:54:54 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=989</guid>
		<description><![CDATA[ 在Thinkpad T400上安装了Debian Lenny后，发现电源管理似乎有点问题，系统不能正常的进入休眠/待机状态。当笔记本长时间处于Idle状态时，并不能进入待机或休眠状态，Gnome电源管理程序出现下面的提示：

Sleep Problem
Your computer failed to suspend/hibernate.
Check the help file for common problems.  

在Google上搜索了一下，其它Thinkpad T400的用户可以在Linux下正常待机或者休眠(Suspend/Hibernate)，看来应该是自己笔记本配置问题。 

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='Permanent Link: 在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/' rel='bookmark' title='Permanent Link: 在Debian Lenny中配置Thinkpad T400的声卡'>在Debian Lenny中配置Thinkpad T400的声卡</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='Permanent Link: 在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    在<a class="link" href="http://easwy.com/blog/archives/debian-lenny-installation-on-thinkpad-t400/">Thinkpad T400上安装了Debian Lenny</a>后，发现电源管理似乎有点问题，系统不能正常的进入休眠/待机状态。当笔记本长时间处于Idle状态时，并不能进入待机或休眠状态，Gnome电源管理程序出现下面的提示：
  </p>
<pre class="programlisting">
Sleep Problem
Your computer failed to suspend/hibernate.
Check the help file for common problems.  </pre>
<p>
    在Google上搜索了一下，其它Thinkpad T400的用户可以在Linux下正常待机或者休眠(Suspend/Hibernate)，看来应该是自己笔记本配置问题。
  </p>
<p>    Linux上的电源管理由<a class="link" href="http://pm-utils.freedesktop.org/wiki/">pm-utils</a>实现，这个工具箱里包含了几个脚本:<span class="command"><strong>pm-hibernate</strong></span>、<span class="command"><strong>pm-suspend</strong></span>和<span class="command"><strong>pm-suspend-hybrid</strong></span>。这些脚本一般由窗口管理器Gnome或KDE，通过hald守护进程来调用。当然也可以直接调用这些脚本。<a class="link" href="http://easwy.com/blog/">Easwy</a>首先使用root用户执行<span class="command"><strong>pm-hibernate</strong></span>：
  </p>
<pre class="programlisting">
sudo pm-hibernate </pre>
<p>    执行完这个命令后，笔记本就将内存镜像保存到磁盘上，然后进入休眠模式。既然root用户能切换到休眠模式，那应该是Gnome的登录用户easwy不具备相应的权限。根据参考文档一中的说明，把用户<a class="link" href="http://easwy.com/blog/">easwy</a>加入<span class="emphasis"><em>powerdev</em></span>组中，现在在Gnome Power Manager中选择<span class="emphasis"><em>hibernate</em></span>就可以使计算机中进入休眠状态，不会出现上面的提示。
  </p>
<p>
    但新的问题又出现了，T400进入待机或休眠模式后无法正常恢复回来。现象是在恢复时，图形界面显示不完整，这时鼠标键盘都没有反应，过一段时间T400就重新加电重启了。
  </p>
<p>
    在网上搜了一下，好像这是由于xf86-video-intel驱动与芯片的兼容性问题(见参考文档二)造成的，使用下面的脚本可以解决这个问题：
  </p>
<pre class="programlisting">

#!/bin/sh
# Workaround for concurrency bug in xserver-xorg-video-intel 2:2.4.1-1ubuntu10.
# Save this as /etc/pm/sleep.d/00CPU 

. "/usr/lib/pm-utils/functions"

case "$1" in
	hibernate|suspend)
		for i in /sys/devices/system/cpu/cpu*/online ; do
			echo 0 &gt;$i
		done
		;;
	thaw|resume)
		sleep 10	# run with one core for 10 secs
		for i in /sys/devices/system/cpu/cpu*/online ; do
			echo 1 &gt;$i
		done
		;;
	*)
		;;
esac </pre>
<p>    <a class="link" href="http://easwy.com/blog/">Easwy</a>把上述脚本保存到<span class="emphasis"><em>/etc/pm/sleep.d/00CPU</em></span>，现在，Thinkpad T400可以正常待机/休眠/恢复了。
  </p>
<p>
    更多关于<a class="link" href="http://easwy.com/blog/archives/tag/thinkpad/">Linux上Thinkpad T400</a>的内容，请阅读<a class="link" href="http://easwy.com/blog/">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li><a class="link" href="http://old.nabble.com/Help-with-suspend-hibernate-in-Gnome-Power-Manager-td15181122.html">Help with suspend/hibernate in Gnome Power Manager</a></li>
<li><a class="link" href="http://wiki.archlinux.org/index.php/Lenovo_ThinkPad_T400#SUSPEND-RESUME">SUSPEND-RESUME</a></li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/" target="_top">http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='Permanent Link: 在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/' rel='bookmark' title='Permanent Link: 在Debian Lenny中配置Thinkpad T400的声卡'>在Debian Lenny中配置Thinkpad T400的声卡</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='Permanent Link: 在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</title>
		<link>http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/</link>
		<comments>http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 07:49:56 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=987</guid>
		<description><![CDATA[出于调试的需要，想在两个Xen虚拟机间使用VLAN相互访问。当Easwy在两个Xen虚拟机上都配置了VLAN后，使用ping命令可以使两台虚拟机相互ping通。但发现一个问题，一旦ping包的大小超过一定长度，也就是说当ping包开始分片后，两台虚拟机之间就不能ping通了...

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/use_http_proxy_for_git/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用代理服务器访问git版本库'>Linux使用笔记: 使用代理服务器访问git版本库</a></li>
<li><a href='http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/' rel='bookmark' title='Permanent Link: Linux使用笔记: 在标题和状态栏中显示Screen的窗口名称'>Linux使用笔记: 在标题和状态栏中显示Screen的窗口名称</a></li>
<li><a href='http://easwy.com/blog/archives/change-default-configuration-of-putty/' rel='bookmark' title='Permanent Link: Linux使用笔记: 修改putty的缺省值设置'>Linux使用笔记: 修改putty的缺省值设置</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    出于调试的需要，想在两个Xen虚拟机间使用VLAN相互访问。在Linux上启用VLAN非常简单，只需要使用命令<span class="command"><strong>vconfig</strong></span>配置一个VLAN接口就可以了：
  </p>
<pre class="programlisting">
vconfig add eth0 3
ifconfig eth0.3 11.11.4.2 netmask 255.255.255.0 up </pre>
<p>
    删除VLAN则使用<span class="command"><strong>vconfig rem eth0.3</strong></span>。当然你也可以在网络脚本中配置你的VLAN接口，这样每次系统启动后会自动配置VLAN接口，具体的配置参见文尾的第一篇参考文档。
  </p>
<p>
    当<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>在两个Xen虚拟机上都配置了VLAN后，使用ping命令可以使两台虚拟机相互ping通。但发现一个问题，一旦ping包的大小超过一定长度，也就是说当ping包开始分片后，两台虚拟机之间就不能ping通了:
  </p>
<pre class="programlisting">
root@nti etc&gt; ping 11.11.4.30 -s 1476 -c 3
PING 11.11.4.30 (11.11.4.30) 1476(1504) bytes of data.
1484 bytes from 11.11.4.30: icmp_seq=1 ttl=64 time=0.536 ms
1484 bytes from 11.11.4.30: icmp_seq=2 ttl=64 time=0.213 ms
1484 bytes from 11.11.4.30: icmp_seq=3 ttl=64 time=0.238 ms

--- 11.11.4.30 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.213/0.329/0.536/0.146 ms
root@nti etc&gt; ping 11.11.4.30 -s 1477 -c 3
PING 11.11.4.30 (11.11.4.30) 1477(1505) bytes of data.

--- 11.11.4.30 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2009ms </pre>
<p>    上面的输出显示，当ping包长度为1476字节时，可以正常ping通，但当ping包长度变为<span class="bold"><strong>1477</strong></span>字节时，就无法ping通了。
  </p>
<p>
    在网上搜索了很久，终于找到了原因。原来，在Xen中，虚拟机的网卡是通过宿主机(Domain-0)上的虚拟接口<span class="emphasis"><em>vifX.X</em></span>以及虚拟网桥设备<span class="emphasis"><em>virbrX</em></span>来实现网络通信的。
  </p>
<p>
    下面的<span class="command"><strong>/sbin/ifconfig</strong></span>输出列出了宿主机相应的网络接口：
  </p>
<pre class="programlisting">
$ /sbin/ifconfig

eth0      Link encap:Ethernet  HWaddr 00:13:72:18:E0:99
          inet addr:192.168.19.84  Bcast:192.168.190.255  Mask:255.255.255.0
          inet6 addr: fe80::213:72ff:fe18:e099/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:36017777 errors:43235 dropped:0 overruns:0 frame:46756
          TX packets:894337 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:105224895 (100.3 MiB)  TX bytes:424826680 (405.1 MiB)
          Interrupt:17 

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4698 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4698 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2439660 (2.3 MiB)  TX bytes:2439660 (2.3 MiB)

vif3.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:38149 errors:0 dropped:0 overruns:0 frame:0
          TX packets:512426 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:7652947 (7.2 MiB)  TX bytes:41352902 (39.4 MiB)

vif4.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:65806 errors:0 dropped:0 overruns:0 frame:0
          TX packets:553557 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:3835916 (3.6 MiB)  TX bytes:157035614 (149.7 MiB)

virbr0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:555514 errors:0 dropped:0 overruns:0 frame:0
          TX packets:824276 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:64025226 (61.0 MiB)  TX bytes:968699886 (923.8 MiB) </pre>
<p>
    也就是说，当虚拟机1发包给虚拟机2时，它的报文首先经过<span class="emphasis"><em>vif3.0</em></span>，然后经过网桥设备(bridge)<span class="emphasis"><em>virbr0</em></span>，最后到达虚拟机2的虚拟接口<span class="emphasis"><em>vif4.0</em></span>。
  </p>
<p>    而<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>所用的Linux内核版本2.6.18-128.el5xen中，它的bridge驱动中存在bug，当使能了conntrack模块时，bridge会把分片包重组起来进行检查，但由bridge再向外发时，却没有重新分片，这导致报文被二层丢弃。也正是这个原因，当ping包大小大于1476时，两台虚拟机间就无法相互ping通了。
  </p>
<p>
    要解决这个问题，可以重新编译内核(不过我不知道这个问题在哪一个内核版本中得到了解决)。对于Easwy来说，因为不需要使用防火墙，所以解决起来就不用这么麻烦了，只需要使用下面的命令禁用bridge的防火墙就行了：
  </p>
<pre class="programlisting">
# echo 0 &gt; /proc/sys/net/bridge/bridge-nf-call-iptables </pre>
<p>    禁用掉防火墙后，两台虚拟机间的大包可以ping通了，分片包的通过不存在问题。
  </p>
<p>
    要了解这个bug的详细信息，参见文末的第二篇参考文档。文末的第三篇和第四篇参考文档，则列出了在Xen中使用VLAN的配置方法，有兴趣的朋友可以看一下。
  </p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
      <a class="ulink" href="http://www.cyberciti.biz/tips/howto-configure-linux-virtual-local-area-network-vlan.html" target="_top">Howto: Configure Linux Virtual Local Area Network (VLAN)</a>
    </li>
<li class="listitem">
      <a class="ulink" href="https://lists.linux-foundation.org/pipermail/bridge/2007-May/005436.html" target="_top">[Bridge] [BUG] Dropping fragmented IP packets within VLAN frames on bridge</a>
    </li>
<li class="listitem">
      <a class="ulink" href="http://renial.net/weblog/2007/02/27/xen-vlan" target="_top">Bridging domains to tagged VLANs in Xen</a>
    </li>
<li class="listitem">
<p>      <a class="ulink" href="http://www.felipe-alfaro.org/blog/2006/07/21/xen-network-configuration-and-multiple-vlans/" target="_top">Xen network configuration and multiple VLANs</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/" target="_top">http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/use_http_proxy_for_git/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用代理服务器访问git版本库'>Linux使用笔记: 使用代理服务器访问git版本库</a></li>
<li><a href='http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/' rel='bookmark' title='Permanent Link: Linux使用笔记: 在标题和状态栏中显示Screen的窗口名称'>Linux使用笔记: 在标题和状态栏中显示Screen的窗口名称</a></li>
<li><a href='http://easwy.com/blog/archives/change-default-configuration-of-putty/' rel='bookmark' title='Permanent Link: Linux使用笔记: 修改putty的缺省值设置'>Linux使用笔记: 修改putty的缺省值设置</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 在标题和状态栏中显示Screen的窗口名称</title>
		<link>http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/</link>
		<comments>http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 05:38:57 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=984</guid>
		<description><![CDATA[ 在Windows上使用putty+screen时，screen会把当前窗口的名称显示在putty的标题栏上，这样当前处于哪个窗口就一目了然了。

但在Easwy的Linux系统中，使用urxvt+screen时，发现当前窗口的名称不会显示在标题栏里。在网上搜索了很久才找到答案。

要想允许Screen改变rxvt/rxvt-unicode(即urxvt)的标题栏，需要在.screenrc中加入一句termcapinfo信息...

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/use-rxvt-in-cygwin/' rel='bookmark' title='Permanent Link: 使用rxvt做为cygwin终端'>使用rxvt做为cygwin终端</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-client-too-old-error/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题'>Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题</a></li>
<li><a href='http://easwy.com/blog/archives/disable-vbell-of-screen/' rel='bookmark' title='Permanent Link: Linux使用笔记: 关闭Linux下screen的闪屏功能'>Linux使用笔记: 关闭Linux下screen的闪屏功能</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    在<a class="link" href="http://easwy.com/blog/archives/disable-vbell-of-screen/" target="_top">Windows上使用putty+screen</a>时，screen会把当前窗口的名称显示在putty的标题栏上，这样当前处于哪个窗口就一目了然了。
  </p>
<p>
    但在Easwy的Linux系统中，使用urxvt+screen时，发现当前窗口的名称不会显示在标题栏里。在网上搜索了很久才找到答案。
  </p>
<p>
    要想允许Screen改变rxvt/rxvt-unicode(即urxvt)的标题栏，需要在<span class="emphasis"><em>.screenrc</em></span>中加入一句<span class="command"><strong>termcapinfo</strong></span>信息：
  </p>
<pre class="programlisting">
termcapinfo rxvt 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' </pre>
<p>
    如果你用的是xterm，也需要在<span class="emphasis"><em>.screenrc</em></span>中加入一句类似的话，具体内容见参考文档一。
  </p>
<p>
    可是，在标题栏里只显示当前的窗口名字，不能把把窗口的列表显示出来，在使用时还不是很方便。幸好我们可以设置Screen的状态栏，使之显示我们想要的内容。
  </p>
<p>
    在<a class="link" href="http://easwy.com/blog/" target="_top">Easwy</a>的<span class="emphasis"><em>.screenrc</em></span>中加入了下面的内容：
  </p>
<pre class="programlisting">
caption always "%{= kw}%-w%{= kG}%{+b}[%n %t]%{-b}%{= kw}%+w %=%d %M %0c %{g}%H%{-}" </pre>
<p>
    上面这段话会在Screen窗口的最下面一行显示出所有窗口的列表，以及主机名等信息。它的效果图如下：
  </p>
<div class="informalfigure">
<div class="mediaobject" title="Screen在标题栏和状态栏中显示窗口名称" align="center"><img src="http://easwy.com/blog/uploads/2009/12/screen-300x198.jpg" align="middle"></div>
<div class="caption" align="center"><a class="link" href="http://easwy.com/blog/uploads/2009/12/screen.jpg" target="_blank">点击查看大图</a></div>
</div>
<p>
    现在的Screen用起来就方便多了。
  </p>
<p>
    更多内容，请阅读<a class="link" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem"><a class="link" href="http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x395.html" target="_blank">Xterm Title Bars and Screen</a></li>
<li class="listitem"><a class="link" href="http://bbs.archlinux.org/viewtopic.php?id=67955" target="_blank">screen refuses to change urxvt&#8217;s title bar</a></li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/" target="_top">http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/use-rxvt-in-cygwin/' rel='bookmark' title='Permanent Link: 使用rxvt做为cygwin终端'>使用rxvt做为cygwin终端</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-client-too-old-error/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题'>Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题</a></li>
<li><a href='http://easwy.com/blog/archives/disable-vbell-of-screen/' rel='bookmark' title='Permanent Link: Linux使用笔记: 关闭Linux下screen的闪屏功能'>Linux使用笔记: 关闭Linux下screen的闪屏功能</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/display-window-list-on-title-bar-and-status-bar-of-screen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 使用Samba访问windows的共享目录</title>
		<link>http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/</link>
		<comments>http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 08:14:40 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=981</guid>
		<description><![CDATA[ 通常我们使用Samba都是在Windows上访问做为Samba服务器的Linux。但是在某些时候情况会反过来，你可能需要从Linux上访问Windows共享出来的目录。幸运的是，Samba本身也支持这种类型的访问。

要想从Linux访问Windows上的共享目录，需要安装smbclient工具。

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/' rel='bookmark' title='Permanent Link: 使用Synergy共享你的鼠标和键盘'>使用Synergy共享你的鼠标和键盘</a></li>
<li><a href='http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/' rel='bookmark' title='Permanent Link: Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)'>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</a></li>
<li><a href='http://easwy.com/blog/archives/change-rpm-package-installation-directories/' rel='bookmark' title='Permanent Link: Linux使用笔记: 更改RPM包的安装目录'>Linux使用笔记: 更改RPM包的安装目录</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    通常我们使用Samba都是在Windows上访问做为Samba服务器的Linux。但是在某些时候情况会反过来，你可能需要从Linux上访问Windows共享出来的目录。幸运的是，Samba本身也支持这种类型的访问。
  </p>
<p>
    要想从Linux访问Windows上的共享目录，需要安装<span class="bold"><strong>smbclient</strong></span>工具。在Debian或Ubuntu上可以使用下面的命令安装：
  </p>
<pre class="programlisting">
aptitude install smbclient smbfs</pre>
<p>
    在CentOS上则使用yum命令安装：
  </p>
<pre class="programlisting">
yum install samba-client.i386 </pre>
<p>    安装好smbclient工具，就可以使用mount命令来挂载Windows上的共享目录了：
  </p>
<pre class="programlisting">
mount -t cifs -o username=easwy //windows-server/share /mnt/winshare </pre>
<p>
    在这里我们使用的文件系统类型是cifs(Common Internet File System)而不是smbfs，因为Linux Kernel将不再支持smbfs。而从<a class="link" href="http://ashkan.tehlug.org/index.php/blog/show/A-Comparison-cifs-vs-smbfs.html" target="_blank">这个网站测试结果</a>来看，smbfs的性能也远不如cifs。
  </p>
<p>
    我们所用的<span class="command"><strong>mount -t cifs</strong></span>命令其实会调用<span class="command"><strong>mount.cifs</strong></span>，如果你在mount时失败，先检查一下你的<span class="command"><strong>mount.cifs</strong></span>命令是否存在。
  </p>
<p>    如果windows计算机处于域中，那么在<span class="emphasis"><em>username</em></span>一项输入你的域用户名<span class="emphasis"><em>domain/username</em></span>就可以了。windows-server可以是一台计算机的名称，也可以是一个IP地址。
  </p>
<p>
    如果想列出Windows上的所有共享资源，可以使用命令：
  </p>
<pre class="programlisting">
smbclient -L //windows-server -U easwy </pre>
<p>
    这条命令会列出windows服务器上所有的共享目录和文件。
  </p>
<p>
    更多内容，请阅读<a class="link" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem"><a class="link" href="http://www.howtogeek.com/wiki/Mount_a_Windows_Shared_Folder_on_Linux_with_Samba" target="_blank">Mount a Windows Shared Folder on Linux with Samba</a></li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/" target="_top">http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/share-your-keyboard-and-mouse-by-synergy/' rel='bookmark' title='Permanent Link: 使用Synergy共享你的鼠标和键盘'>使用Synergy共享你的鼠标和键盘</a></li>
<li><a href='http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/' rel='bookmark' title='Permanent Link: Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)'>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</a></li>
<li><a href='http://easwy.com/blog/archives/change-rpm-package-installation-directories/' rel='bookmark' title='Permanent Link: Linux使用笔记: 更改RPM包的安装目录'>Linux使用笔记: 更改RPM包的安装目录</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 更改RPM包的安装目录</title>
		<link>http://easwy.com/blog/archives/change-rpm-package-installation-directories/</link>
		<comments>http://easwy.com/blog/archives/change-rpm-package-installation-directories/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 13:47:28 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=973</guid>
		<description><![CDATA[ 大多数人安装RPM包，都是使用下面的命令来安装：

rpm -i xxxx.rpm 

这是最简单的安装方式，RPM包中的文件将被安装到打包时所指定的默认目录中。

但在有的时候，我们没有系统的root权限不能写入根目录，或者因为某种原因(比如在进行文件恢复时)想改变一下RPM的默认安装路径。这时可以用下面的小技巧。 

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/' rel='bookmark' title='Permanent Link: Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)'>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/modify-timezone-in-centos/' rel='bookmark' title='Permanent Link: Linux使用笔记: 更改CentOS的时区(timezone)'>Linux使用笔记: 更改CentOS的时区(timezone)</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    大多数人安装RPM包，都是使用下面的命令来安装：
  </p>
<pre class="programlisting">
rpm -i xxxx.rpm </pre>
<p>
    这是最简单的安装方式，RPM包中的文件将被安装到打包时所指定的默认目录中。
  </p>
<p>
    但在有的时候，我们没有系统的root权限不能写入根目录，或者因为某种原因(比如<a class="ulink" href="http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/" target="_top">在进行文件恢复</a>时)想改变一下RPM的默认安装路径。这时可以用下面的小技巧。
  </p>
<p>
    首先用下面的命令查看一下该RPM包的默认安装目录，例如：
  </p>
<pre class="programlisting">
easwy:~$ rpm -qpl ext3grep-0.10.0-1.el5.rf.i386.rpm
/usr/bin/ext3grep
/usr/share/doc/ext3grep-0.10.0
/usr/share/doc/ext3grep-0.10.0/INSTALL
/usr/share/doc/ext3grep-0.10.0/LICENSE.GPL2
/usr/share/doc/ext3grep-0.10.0/NEWS
/usr/share/doc/ext3grep-0.10.0/README </pre>
<p>    上面的命令列出了每一个文件即将被安装的位置，现在我们只需要重新用<span class="emphasis"><em>&#8211;relocate</em></span>参数把安装目录定位一下就可以了：
  </p>
<pre class="programlisting">
rpm -i --relocate /usr/bin=/home/easwy/bin --relocate /usr/share/doc=/home/easwy/doc ext3grep-0.10.0-1.el5.rf.i386.rpm </pre>
<p>
    现在，ext3grep就会被安装到<span class="emphasis"><em>/home/<a class="ulink" href="http://easwy.com/blog/" target="_top">easwy</a>/bin</em></span>目录中了。
  </p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li>
      <a class="ulink" href="http://www.unix.com/unix-dummies-questions-answers/66110-how-install-rpm-specific-directory.html" target="_top"> how to install rpm to specific directory </a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/change-rpm-package-installation-directories/" target="_top">http://easwy.com/blog/archives/change-rpm-package-installation-directories/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/' rel='bookmark' title='Permanent Link: Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)'>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/modify-timezone-in-centos/' rel='bookmark' title='Permanent Link: Linux使用笔记: 更改CentOS的时区(timezone)'>Linux使用笔记: 更改CentOS的时区(timezone)</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/change-rpm-package-installation-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</title>
		<link>http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/</link>
		<comments>http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 02:46:10 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=979</guid>
		<description><![CDATA[ 一个同事不小心使用rm -rf命令误删了自己的代码，这意味着一个月的工作丢失了。我们知道rm命令无法撤销，那么有没有办法恢复这个被删除的目录以及其中的全部文件呢？
在网上搜索了一下，找到一个名为ext3grep的工具，本文介绍如何通过ext3grep来恢复目录和文件...

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/change-rpm-package-installation-directories/' rel='bookmark' title='Permanent Link: Linux使用笔记: 更改RPM包的安装目录'>Linux使用笔记: 更改RPM包的安装目录</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/switch-to-single-user-mode-in-grub/' rel='bookmark' title='Permanent Link: Linux使用笔记: Grub中进入单用户模式的方法'>Linux使用笔记: Grub中进入单用户模式的方法</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    一个同事不小心使用<span class="command"><strong>rm -rf</strong></span>命令误删了自己的代码，这意味着一个月的工作丢失了(一个月没有备份过代码，看来他以前一定没经历计算机崩溃的灾难)。我们知道<span class="command"><strong>rm</strong></span>命令无法撤销，那么有没有办法恢复这个被删除的目录以及其中的全部文件呢？
  </p>
<p>
    在网上搜索了一下，找到一个名为ext3grep的工具，以及它的作者的一篇文章(见<span class="bold"><strong>参考文档</strong></span>）。在这个工具出现以前，恢复ext3文件系统中被删除的数据是不可能的。因为ext3文件系统不同于ext2文件系统，它在删除一个文件后，会把文件inode结点中扇区指针清为0，而这让文件恢复看起来不太可能。不过，正如ext3grep工具作者所说的，因为ext3是一个日志型的文件系统，通过分析日志信息，有很大的可能重新解析出块指针，从而恢复出目录和文件。
  </p>
<p>
    以下是Easwy恢复文件所采用的步骤，希望对大家有帮助。
  </p>
<p><span class="bold"><strong>[ 卸载被误删除文件所在的分区，或以只读方式mount ]</strong></span></p>
<p>
    当你发现你误删除了文件后，要做的第一件事是马上卸载被误删除文件所在的分区，或者以只读的方式来挂载该分区。原因大家都很清楚，文件被删除后，文件中的数据还存在磁盘上，除非存放这些数据的数据块又被操作系统分配出去了。我们这一步就是尽量降低数据块中数据被覆盖的风险，以提高恢复数据成功的比率。
  </p>
<p>
    如果被误删的文件在根分区，那么你最好重启计算机，进入单用户模式，以只读的方式挂载根分区，然后再进行恢复。要进行单用户模式，请看<a class="ulink" href="http://easwy.com/blog/" target="_top">Grub中进入单用户模式的方法</a>。
  </p>
<p>
    进入单用户模式后，根分区还是以读写方式mount的，用下面的命令，把挂载方式由读写(rw)改为只读(ro)：
  </p>
<pre class="programlisting">
mount -o ro,remount / </pre>
<p>
    如果被删除的文件不是根分区，也可以用unmount的方式将该分区卸载。假设文件在分区/dev/sda3中，该分区挂载到/home，那么我们用下面的命令来卸载：
  </p>
<pre class="programlisting">
    umount /dev/sda3 </pre>
<p>
    或者命令：
  </p>
<pre class="programlisting">
    umount /home </pre>
<p>
    当然，在卸载前要保证没有程序在访问该分区，否则卸载会失败。所以，Easwy一般推荐进入单用户模式来恢复文件。
  </p>
<p><span class="bold"><strong>[ 安装ext3grep工具 ]</strong></span></p>
<p>
    恢复的第一步当然是安装ext3grep工具。对于Debian/Ubuntu用户来说，安装ext3grep工具非常简单，只需要执行下面的命令：
  </p>
<pre class="programlisting">
aptitude install ext3grep </pre>
<p>
    不过Easwy公司所使用的Linux版本是Centos，所以需要自己手工编译ext3grep工具，其实这也很简单，首先到<a class="ulink" href="http://code.google.com/p/ext3grep/downloads/list" target="_top">ext3grep主页</a>上下载它的源代码，然后用下面的命令解压/编译/安装这个工具。
  </p>
<pre class="programlisting">

tar zxf ext3grep-0.10.1.tar.gz
cd /home/easwy/ext3grep-0.10.1
./configure
make
make install </pre>
<p>
    <span class="bold"><strong>注：</strong></span>在网上搜了一下，ext3grep也有rpm包可以下载，比如，RHEL/CentOS的RPM包可以在<a class="ulink" href="ftp://194.199.20.114/linux/dag/redhat/el5/en/i386/dag/RPMS/ext3grep-0.10.0-1.el5.rf.i386.rpm" target="_top">这里</a>下载。其它Linux发行版的RPM也可以在<a class="ulink" href="http://www.rpmfind.net/" target="_top">rpmfind.net</a>上找到。
  </p>
<p>
    <a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>前面说过，发现误删除后，要卸载掉该分区，或者进入单用户模式。所以最好在另外一台计算机上来编译或安装这个工具，然后把ext3grep这个可执行文件拷贝到U盘中再进行恢复。这也正是Easwy所用的方法，因为同事的文件恰好在根分区中。如果你也是这种情况，那么在用RPM包安装时，则需要把RPM包安装到你<a class="ulink" href="http://easwy.com/blog/archives/change-rpm-package-installation-directories/" target="_top">你指定的目录</a>中，然后再把它拷贝到U盘中。
  </p>
<p>
    U盘里只需要拷贝ext3grep一个文件即可，它不需要动态加载库就可以执行。接下来把U盘插到待恢复的电脑上，用下面的命令加载：
  </p>
<pre class="programlisting">
mount -t vfat /dev/sdb1 /mnt </pre>
<p>
    把上面的设备号和安装点换成你自己的。如果你的设备文件还不存在的话(这也刚好是Easwy的情况)，用<span class="command"><strong>mknod</strong></span>命令创建一下吧。
  </p>
<p>    现在，我们可以开始文件恢复了。
  </p>
<p><span class="bold"><strong>[ 恢复文件 ]</strong></span></p>
<p>
    在开始恢复前，选择一个目录来存放被恢复的文件。ext3grep程序会在当前目录下创建一个名为<span class="emphasis"><em>RESTORED_FILES</em></span>的目录来存放被恢复的文件。因此在运行ext3grep命令前，先要切换到一个你可读写的目录中。
  </p>
<p>
    对Easwy来讲，因为进入了单用户模式，并且将根分区设成了只读，那么只能把恢复出来的文件放在U盘中了。因此，先<span class="command"><strong>cd /mnt</strong></span>进入U盘目录。
  </p>
<p>
    如果你有幸记得你误删除的文件名及其路径的话，就可以直接用下面的命令进行恢复了：
  </p>
<pre class="programlisting">
    ext3grep /dev/your-device --restore-file path/to/your/file/filename </pre>
<p>
    需要注意的是，上面的文件路径，是在该分区上文件路径。假设我们要恢复<span class="emphasis"><em>/dev/sda3</em></span>分区上文件，这个分区原来的安装点是<span class="emphasis"><em>/home</em></span>，现在想恢复文件<span class="emphasis"><em>/home/easwy/vi/tips.xml</em></span>，那么输入的命令应该是：
  </p>
<pre class="programlisting">
    ext3grep /dev/sda3 --restore-file easwy/vi/tips.xml </pre>
<p>
    如果你忘记了文件名，或者你误删除的是一个目录而你无法记全该目录中的文件，你可以先用下面的命令查询一下文件名：
  </p>
<pre class="programlisting">
ext3grep /dev/sda3 --dump-names | tee filename.txt</pre>
<p>
    上面的命令把ext3grep命令的输出记录到文件<span class="emphasis"><em>filename.txt</em></span>中，你可以慢慢查看，或者使用<span class="command"><strong>grep</strong></span>命令过滤出你需要的信息。
  </p>
<p>
    当你知道了目录/文件的信息后，就可以用上面说的命令进行恢复了。
  </p>
<p>
    在ext3grep命令中有一个<span class="emphasis"><em>&#8211;depth</em></span>参数，应该是用来恢复目录以及其中的所有子目录和文件的，不过<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>用这个参数无法恢复出任何文件，只好采用笨办法，写了个脚本，一个个文件的恢复。
  </p>
<p>
    经过几个小时的折磨(中间走了一些弯路)，同事的文件终于恢复成功了！
  </p>
<p>
    请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章获取更多信息。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li>
      <a class="ulink" href="http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html" target="_top">HOWTO recover deleted files on an ext3 file system</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/" target="_top">http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/change-rpm-package-installation-directories/' rel='bookmark' title='Permanent Link: Linux使用笔记: 更改RPM包的安装目录'>Linux使用笔记: 更改RPM包的安装目录</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Permanent Link: Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/switch-to-single-user-mode-in-grub/' rel='bookmark' title='Permanent Link: Linux使用笔记: Grub中进入单用户模式的方法'>Linux使用笔记: Grub中进入单用户模式的方法</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
