<?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>Rest Valley &#187; pacman</title> <atom:link href="http://lihdd.net/tag/pacman/feed/" rel="self" type="application/rss+xml" /><link>http://lihdd.net</link> <description>The scratchpad of quark</description> <lastBuildDate>Sat, 09 Oct 2010 13:56:19 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <item><title>让 Archlinux 的 pacman 健步如飞</title><link>http://lihdd.net/archlinux-pacman-accelerate/</link> <comments>http://lihdd.net/archlinux-pacman-accelerate/#comments</comments> <pubDate>Wed, 05 May 2010 01:38:46 +0000</pubDate> <dc:creator>quark</dc:creator> <category><![CDATA[Config]]></category> <category><![CDATA[archlinux]]></category> <category><![CDATA[pacman]]></category><guid
isPermaLink="false">http://lihdd.net/?p=403</guid> <description><![CDATA[使用 Archlinux 的朋友大概遇到过这样的烦恼，软件安装得比较多的时候，再用 pacman 做任何事情的时候都可以看到硬盘狂转一段时间，然后才有反应。 pacman 官方给了一个 pacman-optimize，它会把 pacman 数据库文件打包到别的地方，删除，然后再放回去。这样做可能会让这些零碎的文件在硬盘上是连续排列的，但实际效果却不是很好。 虽然用 Archlinux 应该有三年左右了，但我还从来没有看过 pacman 的数据库是什么模样。有一天终于忍不住去看了一下 /var/lib/pacman 下面到底是什么，原来是这么多零碎的小文件啊！ 于是解决方案也就有了：把所谓的 pacman 数据库放到 reiserfs 文件系统里。如果你本来在这个地方用的就是 reiserfs 的话，那么不需要做任何事情， pacman 应该就很快了。如果你和我一样用的是 ext4 这样的文件系统，也不必慌张地把整个分区都换成 reiserfs。 新建一个 160 MB 的 reiserfs 文件 pacman_db.fs： truncate pacman_db.fs --size 160M mkfs.reiserfs -f ./pacman_db.fs 把现有的 pacman 数据库复制到这个 reiserfs 里面： sudo mount pacman_db.fs -t reiserfs /mnt -o [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://lihdd.net/wp-content/uploads/2010/05/pacman.png"><img
class="alignright size-full wp-image-404" title="pacman" src="http://lihdd.net/wp-content/uploads/2010/05/pacman.png" alt="pacman" width="128" height="119" /></a>使用 Archlinux 的朋友大概遇到过这样的烦恼，软件安装得比较多的时候，再用 <code>pacman</code> 做任何事情的时候都可以看到硬盘狂转一段时间，然后才有反应。</p><p><code>pacman</code> 官方给了一个 <code>pacman-optimize</code>，它会把 <code>pacman</code> 数据库文件打包到别的地方，删除，然后再放回去。这样做可能会让这些零碎的文件在硬盘上是连续排列的，但实际效果却不是很好。</p><p>虽然用 Archlinux 应该有三年左右了，但我还从来没有看过 <code>pacman</code> 的数据库是什么模样。有一天终于忍不住去看了一下 <code>/var/lib/pacman</code> 下面到底是什么，原来是这么多零碎的小文件啊！</p><p>于是解决方案也就有了：把所谓的 <code>pacman</code> 数据库放到 reiserfs 文件系统里。如果你本来在这个地方用的就是 reiserfs 的话，那么不需要做任何事情， <code>pacman</code> 应该就很快了。如果你和我一样用的是 ext4 这样的文件系统，也不必慌张地把整个分区都换成 reiserfs。<span
id="more-403"></span></p><p>新建一个 160 MB 的 reiserfs 文件 <code>pacman_db.fs</code>：</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">truncate pacman_db.fs <span style="color: #660033;">--size</span> 160M
mkfs.reiserfs <span style="color: #660033;">-f</span> .<span style="color: #000000; font-weight: bold;">/</span>pacman_db.fs</pre></div></div><p>把现有的 <code>pacman</code> 数据库复制到这个 reiserfs 里面：</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;">mount</span> pacman_db.fs <span style="color: #660033;">-t</span> reiserfs <span style="color: #000000; font-weight: bold;">/</span>mnt <span style="color: #660033;">-o</span> loop 
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</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>pacman<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>mnt
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt</pre></div></div><p>接下来修改 <code>/etc/fstab</code>，加上一行：</p><div
class="wp_syntax"><div
class="code"><pre class="auto" style="font-family:monospace;">/[path_to_pacman_db]/pacman_db.fs /var/lib/pacman reiserfs defaults,loop 0 4</pre></div></div><p>左边的 <code>[path_to_pacman_db]</code> 需要根据实际情况填一下。最右边的 4 应该是比 <code>fstab</code> 中其他条目大一些的数字，表示 <code>fsck</code> 检查时最后处理这个地方。</p><p>如果想让这个设置立即生效，执行 <code>sudo mount /var/lib/pacman</code> 即可。否则，重启一下就可以了。现在，使用 <code>pacman -Syu</code> 更新一下系统，是不是比以前快许多？ <img
src='http://lihdd.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://lihdd.net/archlinux-pacman-accelerate/feed/</wfw:commentRss> <slash:comments>21</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: lihdd.net @ 2012-05-19 15:01:33 -->
