<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6027410081979169343</id><updated>2012-01-12T17:08:17.658+07:00</updated><category term='cheat sheet'/><category term='sas2ircu'/><category term='lighttpd'/><category term='grub'/><category term='opcode'/><category term='admin'/><category term='cache'/><category term='gentoo'/><category term='loopback'/><category term='ram'/><category term='monit'/><category term='auth'/><category term='precomplie'/><category term='graph'/><category term='query log'/><category term='webserver'/><category term='awk'/><category term='find'/><category term='rrdtool'/><category term='shell'/><category term='nginx'/><category term='mysqldump'/><category term='nosql'/><category term='mdadm'/><category term='cacti'/><category term='raid'/><category term='perc H200'/><category term='linux'/><category term='apache'/><category term='harddisk'/><category term='back up'/><category term='debug'/><category term='coredump'/><category term='mysql'/><category term='php'/><category term='apt'/><category term='monitoring'/><category term='memory'/><category term='prebuilt'/><category term='mongodb'/><category term='fcgi'/><category term='emerge'/><category term='tcp'/><category term='cgi'/><category term='terminal'/><category term='filesystem'/><category term='snmp'/><category term='tunning'/><category term='network'/><category term='ubuntu'/><category term='xcache'/><category term='svn'/><title type='text'>Handy Linux Blog.</title><subtitle type='html'>A brief short linux how to and problem solving. This blog is intended to be a reference by summarizing from reliable data source and my experience. Readers should have a basic understanding about linux.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>55</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-5028379963584033981</id><published>2012-01-12T17:08:00.003+07:00</published><updated>2012-01-12T17:08:17.673+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><title type='text'>awk basic</title><content type='html'>awk is very useful tool for linux user.&lt;br /&gt;For example, you have output from ps aux like this :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#ps aux&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;root &amp;nbsp; &amp;nbsp; &amp;nbsp;2213 &amp;nbsp;0.0 &amp;nbsp;0.4 &amp;nbsp; 6596 &amp;nbsp;2428 pts/2 &amp;nbsp; &amp;nbsp;S &amp;nbsp; &amp;nbsp;12:08 &amp;nbsp; 0:00 bash&lt;br /&gt;root &amp;nbsp; &amp;nbsp; &amp;nbsp;2235 &amp;nbsp;0.0 &amp;nbsp;0.1 &amp;nbsp; 4848 &amp;nbsp; 952 pts/2 &amp;nbsp; &amp;nbsp;S+ &amp;nbsp; 12:08 &amp;nbsp; 0:00 /bin/bash xxx&lt;br /&gt;root &amp;nbsp; &amp;nbsp; &amp;nbsp;2236 &amp;nbsp;0.0 &amp;nbsp;0.6 &amp;nbsp; 7132 &amp;nbsp;3236 pts/2 &amp;nbsp; &amp;nbsp;S+ &amp;nbsp; 12:08 &amp;nbsp; 0:04 ssh xxx&lt;br /&gt;&lt;br /&gt;The second column is PID, and 8th is process state.&lt;br /&gt;To find the zombie process you just execute the following command &amp;nbsp;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;# ps aux | awk '{ print $8 " " $2 }' | grep -w Z&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;See just use $th of the column, you will get the value of that column. Also, you can apply even you have comma separated field with -F option.&lt;br /&gt;&lt;br /&gt;For more usage of this command please consult&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#man awk&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;:)&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-5028379963584033981?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/5028379963584033981/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2012/01/awk-basic.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5028379963584033981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5028379963584033981'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2012/01/awk-basic.html' title='awk basic'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-8929067488479488269</id><published>2011-12-13T10:58:00.002+07:00</published><updated>2011-12-13T10:58:31.506+07:00</updated><title type='text'>Ubuntu ramdisk</title><content type='html'>&lt;br /&gt;Mounting ram as a working space which help I/O faster.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#mkdir -p /tmp/ram&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#sudo mount -t tmpfs -o size=512M tmpfs /tmp/ram/&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;However, be careful to not exceed the memory you have in the system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ubuntuka.com/ubuntu-ramdisk-ramdrive-easy-way/"&gt;http://www.ubuntuka.com/ubuntu-ramdisk-ramdrive-easy-way/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-8929067488479488269?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/8929067488479488269/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/12/ubuntu-ramdisk.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8929067488479488269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8929067488479488269'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/12/ubuntu-ramdisk.html' title='Ubuntu ramdisk'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-8839618479748028161</id><published>2011-12-08T14:29:00.001+07:00</published><updated>2011-12-08T15:05:25.529+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nosql'/><category scheme='http://www.blogger.com/atom/ns#' term='mongodb'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>ubuntu installing mongodb- part II : install php driver</title><content type='html'>&lt;div&gt;After finishing this part, your php will be able to use mongodb function.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To install mongodb php driver, first of all we need pecl to install from PHP repository.&amp;nbsp;&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#sudo apt-get install php5-dev php5-cli php-pear&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;Running pecl to get and install php driver.&amp;nbsp;&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#sudo pecl install mongo&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;Turn your back to the screen and have a coffee while system compiling the mongo extension. After finishing installation, you will see this :&amp;nbsp;&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;Build process completed successfully&lt;br /&gt;Installing '/usr/lib/php5/20090626+lfs/mongo.so'&lt;br /&gt;install ok: channel://pecl.php.net/mongo-1.2.6&lt;br /&gt;configuration option "php_ini" is not set to php.ini location&lt;br /&gt;You should add "extension=mongo.so" to php.ini&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;Then, edit php.ini &amp;nbsp;(/etc/php5/cli/php.ini, ubuntu) &amp;nbsp;and add this line&amp;nbsp;extension=mongo.so.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Reference : http://www.mongodb.org/display/DOCS/PHP+Language+Center&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-8839618479748028161?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/8839618479748028161/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/12/ubuntu-installing-mongodb-part-ii.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8839618479748028161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8839618479748028161'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/12/ubuntu-installing-mongodb-part-ii.html' title='ubuntu installing mongodb- part II : install php driver'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-9214004930301619984</id><published>2011-11-30T16:07:00.001+07:00</published><updated>2011-12-08T14:28:42.280+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nosql'/><category scheme='http://www.blogger.com/atom/ns#' term='mongodb'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>ubuntu installing mongodb- part I : install server</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The newest version of mongodb is not in repository of ubuntu. To install newest 2.0, custom repository 10gen is needed.&lt;br /&gt;&lt;br /&gt;Add key :&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Add repository by creating file name '/etc/apt/sources.list.d/10gen.list'&lt;br /&gt;with this line :&lt;br /&gt;(using upstart)&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen&lt;/span&gt;&lt;/blockquote&gt;You're ready to install :&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#apt-get update&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#apt-get install mongodb-10gen&lt;/span&gt;&lt;/blockquote&gt;The mongodb is running in the system. The configuration for mongodb is &lt;i&gt;/etc/mongodb.conf&lt;/i&gt; and in &lt;i&gt;/etc/init/mongodb.conf&lt;/i&gt; (for startup script)&lt;br /&gt;&lt;br /&gt;Reference:&lt;br /&gt;http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-9214004930301619984?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/9214004930301619984/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/11/ubuntu-installing-mongodb-part-i.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/9214004930301619984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/9214004930301619984'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/11/ubuntu-installing-mongodb-part-i.html' title='ubuntu installing mongodb- part I : install server'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6150997151436756317</id><published>2011-10-14T16:33:00.001+07:00</published><updated>2011-10-14T16:33:55.116+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nginx'/><title type='text'>(link) Nginx "how to" - Fast and Secure webserver</title><content type='html'>This might be a informative link worth to visit if you are experiencing performance issue with web server. Nginx is an option.&lt;br /&gt;&lt;a href="https://calomel.org/nginx.html"&gt;https://calomel.org/nginx.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6150997151436756317?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6150997151436756317/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/10/link-nginx-how-to-fast-and-secure.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6150997151436756317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6150997151436756317'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/10/link-nginx-how-to-fast-and-secure.html' title='(link) Nginx &quot;how to&quot; - Fast and Secure webserver'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7520545393309699359</id><published>2011-09-30T10:14:00.000+07:00</published><updated>2011-10-01T04:22:48.501+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>mysql commonly use statement</title><content type='html'>Create table&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt; CREATE &amp;nbsp;table if not exists &lt;i&gt;tblname &lt;/i&gt;like &lt;i&gt;old_tblname&lt;/i&gt;;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;INSERT ... SELECT&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt;&amp;nbsp;INSERT INTO &lt;i&gt;tblname1 &lt;/i&gt;SELECT * &amp;nbsp;from &lt;i&gt;tblname2 &lt;/i&gt;where ...;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Empty table&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt;&amp;nbsp;TRUNCATE table story_longcon_40;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Delete/Drop table&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt;&amp;nbsp;DROP&amp;nbsp;TABLE&amp;nbsp;&lt;i&gt;tblname&lt;/i&gt;;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Delete/Drop database&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt;&amp;nbsp;DROP {DATABASE | SCHEMA} [IF EXISTS] &lt;i&gt;db_name&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;Optimize Table&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt; OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE&amp;nbsp;tbl_name [, tbl_nam&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7520545393309699359?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7520545393309699359/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/09/mysql-commonly-use-statement.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7520545393309699359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7520545393309699359'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/09/mysql-commonly-use-statement.html' title='mysql commonly use statement'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-8241470292159426875</id><published>2011-09-29T17:38:00.001+07:00</published><updated>2011-09-29T17:38:57.299+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='back up'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqldump'/><title type='text'>[MySQL]  Backing up data</title><content type='html'>There are several ways to backing up data&lt;br /&gt;1) Logical backup&lt;br /&gt;&lt;br /&gt;* SQL dumps&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#mysqldump dbname tblname&lt;/span&gt;&lt;/blockquote&gt;Not suitable for huge backup. Both table structure and the data are stored together.(option available)&lt;br /&gt;&lt;br /&gt;* Delimited file backups&lt;br /&gt;backing up :&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt; SELECT * INTO OUTFILE '/tmp/t1.txt'&lt;br /&gt;&amp;nbsp; &amp;nbsp; -&amp;gt; FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'&lt;br /&gt;&amp;nbsp; &amp;nbsp; -&amp;gt; LINES TERMINATED BY '\n'&lt;br /&gt;&amp;nbsp; &amp;nbsp; -&amp;gt; FROM test.t1&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;restore :&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt; LOAD DATA INFILE '/tmp/t1.txt'&lt;br /&gt;&amp;nbsp; &amp;nbsp; -&amp;gt; INTO TABLE test1.t1&lt;br /&gt;&amp;nbsp; &amp;nbsp; -&amp;gt; FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'&lt;br /&gt;&amp;nbsp; &amp;nbsp; -&amp;gt; LINES TERMINATED BY '\n';&lt;/span&gt;&lt;/blockquote&gt;*parallel dump: maatkit(mk-parallel-dump)&lt;br /&gt;&lt;br /&gt;2) File system snapshot (LVM)&lt;br /&gt;not covered here.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-8241470292159426875?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/8241470292159426875/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/09/mysql-backing-up-data.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8241470292159426875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8241470292159426875'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/09/mysql-backing-up-data.html' title='[MySQL]  Backing up data'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-3775339813698476913</id><published>2011-09-29T17:15:00.000+07:00</published><updated>2011-09-29T17:15:40.078+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='back up'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>mysql backup/dump/export  table schema, definition</title><content type='html'>&lt;br /&gt;1) use mysqldump&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;server# mysqldump -uroot -p &lt;i&gt;dbname tblname &lt;/i&gt;-d&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;with this method you will get sql statement. You can use this for backing up table definition as well.&lt;br /&gt;&lt;br /&gt;2) create table from another table&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mysql&amp;gt; create table if not exists &lt;i&gt;tblname &lt;/i&gt;like &lt;i&gt;old_tblname&lt;/i&gt;;&lt;/span&gt;&lt;/blockquote&gt;with this method you get a copy of table. It is useful if you want to have a another table with the same structure for backing up, testing. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-3775339813698476913?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/3775339813698476913/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/09/mysql-backupdumpexport-table-schema.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3775339813698476913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3775339813698476913'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/09/mysql-backupdumpexport-table-schema.html' title='mysql backup/dump/export  table schema, definition'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-8996403052381987827</id><published>2011-08-05T18:03:00.002+07:00</published><updated>2011-08-05T18:05:14.099+07:00</updated><title type='text'>Postfix วิธีการ pipe mail ที่ได้รับ ไปยัง command ต่างๆ</title><content type='html'>&lt;p&gt;Environment ที่ใช้ทดสอบนะครับ ใช้ Ubuntu 10.04.3, Postfix, Dovecot เป็นหลัก  สิ่งที่ต้องการคือ เมื่อมีคนส่ง e-mail มาที่ &lt;a href="mailto:test@example.com"&gt;test@example.com&lt;/a&gt; แล้ว ให้ postfix ทำการ pipe  email นั้นเข้าสู่โปรแกรม /home/myuser/testperl ซึ่งเป็น perl script  ที่ผมเขียนรอไว้ก่อนหน้านี้แล้ว &lt;/p&gt; &lt;p&gt;ทั้งนี้ ตัว postfix ผม config ตัว virtual domains, virtual mailbox  ที่ติดต่อกับ mysql server เอาไว้ด้วยนะครับ&lt;/p&gt; &lt;p&gt;เริ่มจาก&lt;/p&gt; &lt;ul&gt; &lt;li&gt;เข้าไปแก้ไข /etc/postfix/main.cf&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;ที่บรรทัด smtpd_recipient_restrictions เพิ่มคำสั่ง check_recipient_access  เข้าไป&lt;/p&gt; &lt;blockquote&gt;&lt;pre&gt;smtpd_recipient_restrictions =  &lt;/pre&gt;&lt;pre&gt;# bypass checks on outgoing mail  &lt;/pre&gt;&lt;pre&gt;permit_mynetworks  &lt;/pre&gt;&lt;pre&gt;# reject if not full email address  &lt;/pre&gt;&lt;pre&gt;reject_non_fqdn_recipient &lt;/pre&gt;&lt;pre&gt;# next line rejects if the account/domain does not exist  &lt;/pre&gt;&lt;pre&gt;# ALSO prevents OPEN RELAY - if missing RELAY is OPEN!!  &lt;/pre&gt;&lt;pre&gt;# MUST appear before the check_recipient_access  &lt;/pre&gt;&lt;pre&gt;reject_unauth_destination  &lt;/pre&gt;&lt;pre&gt;# perform filter access by recipient name  &lt;/pre&gt;&lt;pre&gt;&lt;strong&gt;check_recipient_access hash:/usr/local/etc/postfix/script_filter&lt;/strong&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;ul&gt; &lt;li&gt;เพิ่ม /etc/postfixscript_filter&lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt;&lt;pre&gt;&lt;a href="mailto:test@example.com"&gt;test@example.com&lt;/a&gt; FILTER support:dummy&lt;/pre&gt;&lt;/blockquote&gt; &lt;ul&gt; &lt;li&gt;# postmap script_filter จะมีไฟล์ script_filter.db เพิ่มขึ้นมา&lt;/li&gt; &lt;li&gt;เข้าไปแก้ master.cf&lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt;&lt;pre&gt;support  unix - n n - - pipe  flags=Rq user=www    argv=/home/myuser/testperl $(sender)$(recipient)&lt;/pre&gt;&lt;/blockquote&gt; &lt;p&gt;โดยใน perl script จะได้ argument 1 = sender และ argument 2 = receiver&lt;/p&gt; &lt;p&gt;แค่นี้ ระบบก็เรียบร้อยพร้อมใช้งานแล้ว &lt;img style="BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none" class="wlEmoticon wlEmoticon-smile" alt="ยิ้ม" src="file:///C:/Users/ntseries/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles1C32CE2/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-8996403052381987827?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/8996403052381987827/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/08/postfix-pipe-mail-command.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8996403052381987827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8996403052381987827'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/08/postfix-pipe-mail-command.html' title='Postfix วิธีการ pipe mail ที่ได้รับ ไปยัง command ต่างๆ'/><author><name>ntseries</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6240800186185653672</id><published>2011-06-16T13:39:00.003+07:00</published><updated>2011-06-16T13:42:13.798+07:00</updated><title type='text'>How to Setup Canon MX350 Series on Ubuntu 11.04 Natty</title><content type='html'>&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small;"&gt;sudo add-apt-repository ppa:michael-gruz/canon&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small;"&gt;&lt;br /&gt;sudo apt-get update&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small;"&gt;apt-get install &lt;/span&gt;&lt;span style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;cnijfilter-mx350series&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;and now you can add printer by&lt;br /&gt;1. Go to search -&amp;gt; printing&lt;br /&gt;2. Add -&amp;gt; Network Printer&lt;br /&gt;3. Canon MX350 Series will appear in left panel&lt;br /&gt;4. Follow the instruction&lt;br /&gt;5. Finish installation&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6240800186185653672?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6240800186185653672/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/06/how-to-setup-canon-mx350-series-on.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6240800186185653672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6240800186185653672'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/06/how-to-setup-canon-mx350-series-on.html' title='How to Setup Canon MX350 Series on Ubuntu 11.04 Natty'/><author><name>ntseries</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2495215704072474725</id><published>2011-06-09T13:58:00.002+07:00</published><updated>2011-06-09T14:01:23.103+07:00</updated><title type='text'>Ubuntu apt-get history</title><content type='html'>for Ubuntu admin you can track apt-get history at&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;/var/log/apt/history.log&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;for a brief&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;for more detail at &lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;/var/log/apt/term.log&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2495215704072474725?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2495215704072474725/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/06/ubuntu-apt-get-history.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2495215704072474725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2495215704072474725'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/06/ubuntu-apt-get-history.html' title='Ubuntu apt-get history'/><author><name>ntseries</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-8536087961840572562</id><published>2011-06-09T11:42:00.002+07:00</published><updated>2011-06-09T11:45:13.096+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mdadm'/><category scheme='http://www.blogger.com/atom/ns#' term='cheat sheet'/><title type='text'>mdadm cheat sheet</title><content type='html'>&lt;div&gt;Mdadm Cheat Sheet&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. Create a new RAID array&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create (mdadm –create) is used to create a new array:&lt;/div&gt;&lt;div&gt;mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2&lt;/div&gt;&lt;div&gt;or using the compact notation:&lt;/div&gt;&lt;div&gt;mdadm -Cv /dev/md0 -l1 -n2 /dev/sd[ab]1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2. /etc/mdadm.conf&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/etc/mdadm.conf or /etc/mdadm/mdadm.conf (on debian) is the main configuration file for mdadm. After we create our RAID arrays we add them to this file using:&lt;/div&gt;&lt;div&gt;mdadm --detail --scan &amp;gt;&amp;gt; /etc/mdadm.conf&lt;/div&gt;&lt;div&gt;or on debian&lt;/div&gt;&lt;div&gt;mdadm --detail --scan &amp;gt;&amp;gt; /etc/mdadm/mdadm.conf&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;3. Remove a disk from an array&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can’t remove a disk directly from the array, unless it is failed, so we first have to fail it (if the drive it is failed this is normally already in failed state and this step is not needed):&lt;/div&gt;&lt;div&gt;mdadm --fail /dev/md0 /dev/sda1&lt;/div&gt;&lt;div&gt;and now we can remove it:&lt;/div&gt;&lt;div&gt;mdadm --remove /dev/md0 /dev/sda1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This can be done in a single step using:&lt;/div&gt;&lt;div&gt;mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;4. Add a disk to an existing array&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can add a new disk to an array (replacing a failed one probably):&lt;/div&gt;&lt;div&gt;mdadm --add /dev/md0 /dev/sdb1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;5. Verifying the status of the RAID arrays&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can check the status of the arrays on the system with:&lt;/div&gt;&lt;div&gt;cat /proc/mdstat&lt;/div&gt;&lt;div&gt;or&lt;/div&gt;&lt;div&gt;mdadm --detail /dev/md0&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The output of this command will look like:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;cat /proc/mdstat&lt;/div&gt;&lt;div&gt;Personalities : [raid1]&lt;/div&gt;&lt;div&gt;md0 : active raid1 sdb1[1] sda1[0]&lt;/div&gt;&lt;div&gt;104320 blocks [2/2] [UU]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;md1 : active raid1 sdb3[1] sda3[0]&lt;/div&gt;&lt;div&gt;19542976 blocks [2/2] [UU]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;md2 : active raid1 sdb4[1] sda4[0]&lt;/div&gt;&lt;div&gt;223504192 blocks [2/2] [UU]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;here we can see both drives are used and working fine – U. A failed drive will show as F, while a degraded array will miss the second disk -&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note: while monitoring the status of a RAID rebuild operation using watch can be useful:&lt;/div&gt;&lt;div&gt;watch cat /proc/mdstat&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;6. Stop and delete a RAID array&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If we want to completely remove a raid array we have to stop if first and then remove it:&lt;/div&gt;&lt;div&gt;mdadm --stop /dev/md0&lt;/div&gt;&lt;div&gt;mdadm --remove /dev/md0&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and finally we can even delete the superblock from the individual drives:&lt;/div&gt;&lt;div&gt;mdadm --zero-superblock /dev/sda&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;#Clone partition table &lt;/b&gt;&lt;/div&gt;&lt;div&gt;sfdisk -d /dev/sda | sfdisk /dev/sdb&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(this will dump the partition table of sda, removing completely the existing partitions on sdb, so be sure you want this before running this command, as it will not warn you at all).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are many other usages of mdadm particular for each type of RAID level, and I would recommend to use the manual page (man mdadm) or the help (mdadm –help) if you need more details on its usage. Hopefully these quick examples will put you on the fast track with how mdadm works.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Reference : &lt;/div&gt;&lt;div&gt;http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-8536087961840572562?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/8536087961840572562/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/06/mdadm-cheat-sheet.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8536087961840572562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/8536087961840572562'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/06/mdadm-cheat-sheet.html' title='mdadm cheat sheet'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2377782141752161467</id><published>2011-06-03T15:33:00.002+07:00</published><updated>2011-06-03T15:38:08.490+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='snmp'/><title type='text'>ubuntu snmp</title><content type='html'>I've install cacti to a server which will poll the data from linux box, installed snmp.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To test polling data from cacti to linux box,&lt;/div&gt;&lt;div&gt;#snmpwalk -c public -v 2c [ip-address]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In ubuntu if you want to allow other host to view this data you need to modified &lt;/div&gt;&lt;div&gt;"/etc/default/snmp " &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid [ip-address]'&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2377782141752161467?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2377782141752161467/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/06/ubuntu-snmp.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2377782141752161467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2377782141752161467'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/06/ubuntu-snmp.html' title='ubuntu snmp'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2742967028331155168</id><published>2011-05-31T12:53:00.001+07:00</published><updated>2011-05-31T12:56:22.649+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><category scheme='http://www.blogger.com/atom/ns#' term='cgi'/><category scheme='http://www.blogger.com/atom/ns#' term='auth'/><title type='text'>apache http auth with cgi</title><content type='html'>If you are using apache http auth with cgi, you have a few more things to do. &lt;div&gt;You need to enable .htaccess &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;RewriteEngine On&lt;/div&gt;&lt;div&gt;RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2742967028331155168?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2742967028331155168/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/05/apache-http-auth-with-cgi.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2742967028331155168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2742967028331155168'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/05/apache-http-auth-with-cgi.html' title='apache http auth with cgi'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6175635905312825208</id><published>2011-05-15T14:33:00.000+07:00</published><updated>2011-05-16T14:19:08.772+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='query log'/><title type='text'>mysql open query log without changing my.cnf and restart</title><content type='html'>&lt;div&gt;Use mysql client connect to server &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#show variables like 'general%';&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;+------------------+----------------------------+&lt;/div&gt;&lt;div&gt;| Variable_name    | Value                      |&lt;/div&gt;&lt;div&gt;+------------------+----------------------------+&lt;/div&gt;&lt;div&gt;| general_log      | OFF                        |&lt;/div&gt;&lt;div&gt;| general_log_file | /var/run/mysqld/mysqld.log |&lt;/div&gt;&lt;div&gt;+------------------+----------------------------+&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This 2 vaiables control mysql query logging. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To turn query log on  :&lt;/div&gt;&lt;div&gt;SET GLOBAL general_log_file = '/var/log/mysql/sql-log.log' ;&lt;/div&gt;&lt;div&gt;SET GLOBAL general_log = 1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To turn query log off :&lt;/div&gt;&lt;div&gt;SET GLOBAL general_log = 0 ;&lt;/div&gt;&lt;div&gt;SET GLOBAL general_log_file = '/var/run/mysqld/mysqld.log'; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Notice: This is for mysql 5.1 only. For mysql 5.0, those variable is not available. you need editing my.cnf and restart.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6175635905312825208?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6175635905312825208/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/05/mysql-open-query-log-without-changing.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6175635905312825208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6175635905312825208'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/05/mysql-open-query-log-without-changing.html' title='mysql open query log without changing my.cnf and restart'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-1527488500291456470</id><published>2011-02-24T14:16:00.000+07:00</published><updated>2011-02-24T14:19:21.664+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tunning'/><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><title type='text'>Page cache and pdflush: Theory of operation and tuning for write-heavy loads</title><content type='html'>&lt;div&gt;For write-heavy option in system, some kernel option must be adjusted. Here are link to article about some kernel options that might help. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Please refer to : &lt;a href="http://www.westnet.com/~gsmith/content/linux-pdflush.htm"&gt;http://www.westnet.com/~gsmith/content/linux-pdflush.htm&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-1527488500291456470?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/1527488500291456470/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/02/page-cache-and-pdflush-theory-of.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1527488500291456470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1527488500291456470'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/02/page-cache-and-pdflush-theory-of.html' title='Page cache and pdflush: Theory of operation and tuning for write-heavy loads'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2430571204471414888</id><published>2011-02-22T11:02:00.000+07:00</published><updated>2011-02-22T11:48:34.102+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><category scheme='http://www.blogger.com/atom/ns#' term='perc H200'/><category scheme='http://www.blogger.com/atom/ns#' term='sas2ircu'/><title type='text'>perc H200 hardware raid utility in linux</title><content type='html'>&lt;div&gt;I just bought server coming with hardware raid  PERC H200 (Dell).&lt;/div&gt;&lt;div&gt;By the time of this blog, I understand that it use chipset from LSI here are out put from &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#lspci --n &lt;/div&gt;&lt;div&gt;LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] [1000:0072] (rev 03)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Unfortunately, the monitoring software for this h/w raid is not open. You have to download sas2ircu bin code. The program will display raid status. &lt;/div&gt;&lt;div&gt;I've downloaded from this link : &lt;/div&gt;&lt;div&gt;&lt;a href="http://www.natecarlson.com/2010/08/23/lsi-command-line-utility-for-sas2-non-raid-controllers/#comments"&gt;http://www.natecarlson.com/2010/08/23/lsi-command-line-utility-for-sas2-non-raid-controllers/#comments&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please visit for usage: &lt;/div&gt;&lt;a href="http://hwraid.le-vert.net/wiki/LSIFusionMPTSAS2#a2.Linuxkerneldrivers"&gt;http://hwraid.le-vert.net/wiki/LSIFusionMPTSAS2#a2.Linuxkerneldrivers&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2430571204471414888?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2430571204471414888/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/02/perc-h200-hardware-raid-utility-in.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2430571204471414888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2430571204471414888'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/02/perc-h200-hardware-raid-utility-in.html' title='perc H200 hardware raid utility in linux'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7088810623396985325</id><published>2011-01-12T15:57:00.000+07:00</published><updated>2011-01-12T16:04:16.059+07:00</updated><title type='text'>find command for deleting empty folder</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;find ./ -type d -exec rmdir 2&gt;/dev/null {} \;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7088810623396985325?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7088810623396985325/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/01/find-command-for-deleting-empty-folder.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7088810623396985325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7088810623396985325'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/01/find-command-for-deleting-empty-folder.html' title='find command for deleting empty folder'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-1868945490232724632</id><published>2011-01-04T10:23:00.000+07:00</published><updated>2011-01-04T10:29:13.513+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>protecting web access with mod_auth</title><content type='html'>&lt;div&gt;You can limit web access by password. Apache has module mod_auth*  for you. It's easy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. create password file &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;# htpasswd -c /usr/local/apache/passwd/passwords rbowen&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;New password: mypassword&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Re-type new password: mypassword&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Adding password for user rbowen&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;for additional user just remove "-c"&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. add directive to apache (.httaccess or &lt;directory&gt;) &lt;/directory&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;AuthType Basic&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;AuthName "Restricted Files"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;# (Following line optional)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;AuthBasicProvider file&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;AuthUserFile /usr/local/apache/passwd/passwords&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Require user rbowen&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; "&gt;3. Restart apache and have fun!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; "&gt;If you have a problem, please investigate the error_log first.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More information :&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; "&gt;&lt;a href="http://httpd.apache.org/docs/trunk/howto/auth.html"&gt;http://httpd.apache.org/docs/trunk/howto/auth.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-1868945490232724632?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/1868945490232724632/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2011/01/protecting-web-access-with-modauth.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1868945490232724632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1868945490232724632'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2011/01/protecting-web-access-with-modauth.html' title='protecting web access with mod_auth'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-4789703010472067446</id><published>2010-10-27T15:45:00.001+07:00</published><updated>2010-10-27T15:49:47.712+07:00</updated><title type='text'>split /var/log/message log</title><content type='html'>I'm using gentoo and  vixie-cron as a system cron. After using it for a while, I found that gentoo store cron log in to /var/log/message. And, I just kind of like to split this for  monitoring easily. Here is what I have done.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;edit this : &lt;/div&gt;&lt;div&gt;/etc/syslog-ng/syslog-ng.conf&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;add the following lines : &lt;/div&gt;&lt;div&gt;&lt;div&gt;filter f_cron   { facility (cron);   };&lt;/div&gt;&lt;div&gt;destination cron { file("/var/log/cron.log"); };&lt;/div&gt;&lt;div&gt;log { source(src); filter(f_cron); destination(cron); };&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;reload syslog-ng :&lt;/div&gt;&lt;div&gt;/etc/init.d/syslog-ng reload&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;you may need to setting the logrotate. Please see the example in /etc/logrotate.d/ for example &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-4789703010472067446?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/4789703010472067446/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/10/split-varlogmessage-log.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4789703010472067446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4789703010472067446'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/10/split-varlogmessage-log.html' title='split /var/log/message log'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7693994501499251741</id><published>2010-10-19T14:58:00.000+07:00</published><updated>2010-10-19T15:01:29.637+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='terminal'/><title type='text'>terminal key map</title><content type='html'>&lt;div&gt;Some ssh client need config for special button. &lt;/div&gt;&lt;div&gt;You can use this value to map the keyboard button to this value perform function properly. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Home &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;\033[1~&lt;/div&gt;&lt;div&gt;Delete &lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;/span&gt;\033[3~&lt;/div&gt;&lt;div&gt;End &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;\033[4~&lt;/div&gt;&lt;div&gt;Page Up &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;\033[5~&lt;/div&gt;&lt;div&gt;Page Down &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;\033[6~&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7693994501499251741?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7693994501499251741/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/10/terminal-key-map.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7693994501499251741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7693994501499251741'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/10/terminal-key-map.html' title='terminal key map'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-148936527717377767</id><published>2010-10-06T11:48:00.000+07:00</published><updated>2010-10-06T11:55:37.152+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='find'/><title type='text'>find command with -exec options</title><content type='html'>find command is quite a handy tool for file searching. It can also include an command to execute for matched file with &lt;div&gt;&lt;br /&gt;&lt;div&gt;1) -exec command ;&lt;/div&gt;&lt;div&gt;2) -exec command {} +&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Both are different.&lt;/div&gt;&lt;div&gt;Let say you have 3 files, a b c in the directory.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;#find . -exec echo '{}' &gt;&gt; tmp1 \;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;output in tmp1 will be :&lt;/div&gt;&lt;div&gt;.&lt;/div&gt;&lt;div&gt;./b&lt;/div&gt;&lt;div&gt;./a&lt;/div&gt;&lt;div&gt;./c&lt;/div&gt;&lt;div&gt;./tmp1&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;#find . -exec echo '{}' &gt;&gt; tmp2 \+;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;output in tmp2 will be :&lt;/div&gt;&lt;div&gt;a  b  c&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;with + all matched file will be append and execute once.&lt;/div&gt;&lt;div&gt;with ; all matched file will be execute for each matching.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-148936527717377767?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/148936527717377767/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/10/find-command-with-exec-options.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/148936527717377767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/148936527717377767'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/10/find-command-with-exec-options.html' title='find command with -exec options'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2703659544896966738</id><published>2010-09-10T13:59:00.000+07:00</published><updated>2010-09-10T14:31:59.132+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='precomplie'/><category scheme='http://www.blogger.com/atom/ns#' term='prebuilt'/><category scheme='http://www.blogger.com/atom/ns#' term='emerge'/><title type='text'>Gentoo prebuilt package installation</title><content type='html'>With gentoo, you can customize every packages you want because gentoo give that choices to you. Emerge, package manager, will built package for you from source code. However, compiling package in gentoo can be very time-consuming task, Especially, when you have more gentoo system. I have found option of emerge that can build package and you can use this prebuilt package to other system. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(1) build package &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new'; "&gt;#quickpkg mysql&lt;/span&gt;&lt;/div&gt;&lt;div&gt;- This will build package from files on your system. If the package you wanna built are on the system already. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;#emerge -b mysql &lt;/span&gt;&lt;/div&gt;&lt;div&gt;-the -b(--buildpkg) option tell emerge to do additional task when installing package to the system.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;*In this case(mysql), the prebuilt package will be available in  /usr/portage/packages/dev-db/ directory.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(2) use prebuilt package &lt;/div&gt;&lt;div&gt;Place the prebuilt package in appropriate directory, in this case : /usr/portage/packages/dev-db/ &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;#emerge  --usepkgonly mysql &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For more information please consult the man page : &lt;/div&gt;&lt;div&gt;#man emerge&lt;/div&gt;&lt;div&gt;#man quickpkg&lt;/div&gt;&lt;div&gt;#man make.conf&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2703659544896966738?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2703659544896966738/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/09/gentoo-prebuilt-package-installation.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2703659544896966738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2703659544896966738'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/09/gentoo-prebuilt-package-installation.html' title='Gentoo prebuilt package installation'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6906461201387052635</id><published>2010-09-07T16:55:00.000+07:00</published><updated>2010-09-07T17:19:23.259+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Install windows font in linux(ubuntu)</title><content type='html'>&lt;code&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'trebuchet ms';"&gt;Linux user cannot avoid living with windows user. That make linux users to adjust ourselves to read file from windows including fonts they using. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:'trebuchet ms';font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:'trebuchet ms';font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 16px;"&gt;(1) using font package&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;#sudo apt-get install msttcorefonts&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;#sudo fc-cache -fv&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: 16px; "&gt;(2) copying font files from windows &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: 16px; "&gt;copy *.ttf font to /usr/share/fonts/truetype/thai&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#fc-cache -fv &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;reference &lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;1. ms-font package installation &lt;a href="http://embraceubuntu.com/2005/09/09/installing-microsoft-fonts/"&gt;[here]&lt;/a&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6906461201387052635?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6906461201387052635/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/09/install-windows-font-in-linuxubuntu.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6906461201387052635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6906461201387052635'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/09/install-windows-font-in-linuxubuntu.html' title='Install windows font in linux(ubuntu)'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7667874303855990772</id><published>2010-08-30T14:05:00.000+07:00</published><updated>2011-01-28T16:20:41.361+07:00</updated><title type='text'>mtime, ctime, and atime timestamp Linux</title><content type='html'>Recently, I've implemented a caching system. This involve removing old file from the cache. One important factor for making a decision is a file timestamp. There are many timestamp implemented in the file system here are method for viewing timestamp info.&lt;br /&gt;&lt;br /&gt;mtime, ctime, and atime&lt;br /&gt;&lt;br /&gt;atime - access time&lt;br /&gt;mtime  - if modify time&lt;br /&gt;ctime  - of change time&lt;br /&gt;&lt;br /&gt;To view atime&lt;br /&gt;&lt;br /&gt;ls -lu&lt;br /&gt;&lt;br /&gt;To view ctime&lt;br /&gt;&lt;br /&gt;ls -lc&lt;br /&gt;&lt;br /&gt;To view mtime&lt;br /&gt;&lt;br /&gt;ls -lt&lt;br /&gt;&lt;br /&gt;Access time is when last time data from the file was access.&lt;br /&gt;&lt;br /&gt;Modify time is when last change was done to the file.&lt;br /&gt;&lt;br /&gt;Change time id when you change owner.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Or&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Use  stat command&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;stat filename&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;stat newname2.txt &lt;/div&gt;&lt;div&gt;  File: `newname2.txt'&lt;/div&gt;&lt;div&gt;  Size: 13              Blocks: 8          IO Block: 4096   regular file&lt;/div&gt;&lt;div&gt;Device: 805h/2053d      Inode: 2338058     Links: 1&lt;/div&gt;&lt;div&gt;Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)&lt;/div&gt;&lt;div&gt;Access: 2011-01-28 16:01:10.000000000 +0700&lt;/div&gt;&lt;div&gt;Modify: 2011-01-28 16:02:35.000000000 +0700&lt;/div&gt;&lt;div&gt;Change: 2011-01-28 16:06:26.000000000 +0700&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;to verify with ls command &lt;/div&gt;&lt;div&gt;--&lt;/div&gt;&lt;div&gt;References :&lt;/div&gt;&lt;div&gt;&lt;a href="http://baliyansandeep.blogspot.com/2010/02/mtime-ctime-and-atime-timestamp-unic.html"&gt;http://baliyansandeep.blogspot.com&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7667874303855990772?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7667874303855990772/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/08/mtime-ctime-and-atime-timestamp-linux.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7667874303855990772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7667874303855990772'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/08/mtime-ctime-and-atime-timestamp-linux.html' title='mtime, ctime, and atime timestamp Linux'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-3974237550879222470</id><published>2010-08-04T13:46:00.000+07:00</published><updated>2010-08-04T14:04:48.570+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harddisk'/><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><title type='text'>Gentoo migration to raid</title><content type='html'>&lt;div&gt;At some point, high availability become more essential to your server. Raid1(mirror) can help server to be able to continue even the disk go wrong. This blog is intend to be a complete just-type-guide for system admin. I hope that you guy succeeded in this migration &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Background my system is gentoo on sda. The new disk will be sdb. After finishing copying data to sdb. The another new disk will be replace as sda. sda and sdb will be raid1 mirroring each other.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#0 move running service to another system&lt;/div&gt;&lt;div&gt;- make sure that the system can be down for maintainance &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#1 shutdown system&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;shutdown -h now &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#2 install new hdd as sdb&lt;/div&gt;&lt;div&gt;some vendor disable port B (for sdb) please make sure that it is enable so it can be visible from linux.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#3 boot system with live cd &lt;/div&gt;&lt;div&gt;modprobe raid1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#4 format disk and create raid on sdb&lt;/div&gt;&lt;div&gt;available 500GB&lt;/div&gt;&lt;div&gt;-&gt; sdb1 boot 1GB ext2&lt;/div&gt;&lt;div&gt;-&gt; sdb5 root entire ext3&lt;/div&gt;&lt;div&gt;-&gt; sdb6 swap 4GB swap&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cfdisk /dev/sdb&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cd /dev &amp;amp;&amp;amp; MAKEDEV md&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mdadm --create /dev/md5 --level=1 --raid-devices=2 missing /dev/sdb5&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mke2fs /dev/md1 &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mke2fs -j /dev/md5 &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mkswap /dev/sdb6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;swapon /dev/sdb6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#5 copy data from sda to raid&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mkdir /mnt/gentoo1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mount /dev/sda5 /mnt/gentoo1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mount /dev/md5 /mnt/gentoo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mount /dev/sda1 /mnt/gentoo1/boot&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mkdir /mnt/gentoo/boot&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mount /dev/md1 /mnt/gentoo/boot&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cp -dpRx /mnt/gentoo1/* /mnt/gentoo/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#6 install boot loader to raid&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mount -t proc none /mnt/gentoo/proc&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mount -o bind /dev /mnt/gentoo/dev&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;chroot /mnt/gentoo /bin/bash&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;env-update&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;source /etc/profile&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;export PS1=”(chroot) $PS1”&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; "&gt;#Edit grub.conf change root=/dev/sdaxx to mdxx&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;nano /boot/grub/grub.conf &lt;/span&gt;&lt;/div&gt;&lt;div&gt;#install boot loader to the disk &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;grub –no-floppy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt; &lt;/span&gt;- device (hd0) /dev/sdb&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt; &lt;/span&gt;- root (hd0,0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt; &lt;/span&gt;- setup (hd0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#7 edit fstab to mount disk on raid instead  // or just copy from preedit @ /home/username/fstab&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;nano /etc/fstab&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#8 shutdown &amp;amp; replace sda with new disk &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;exit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cd /&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;umount /mnt/gentoo1/boot /mnt/gentoo1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;shutdown -h now&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; "&gt;-replace new disk &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#9 sync disk and install boot loader&lt;/div&gt;&lt;div&gt;-change bios priority to start boot from sdb &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;sfdisk -d /dev/sdb | sfdisk /dev/sda&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mdadm --add /dev/md1 /dev/sda1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mdadm --add /dev/md5 /dev/sda5&lt;/span&gt;&lt;/div&gt;&lt;div&gt;#edit fstab add sda as swap &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;nano /etc/fstab &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;mkswap /dev/sda6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;swapon /dev/sda6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;grub –no-floppy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;- device (hd0) /dev/sda&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;- root (hd0,0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;- setup (hd0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#wait until sync finish &lt;/div&gt;&lt;div&gt;- reboot test &lt;/div&gt;&lt;div&gt;- restore bios boot priority &lt;/div&gt;&lt;div&gt;- restore sevice back to the server. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-3974237550879222470?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/3974237550879222470/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/08/gentoo-migration-to-raid.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3974237550879222470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3974237550879222470'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/08/gentoo-migration-to-raid.html' title='Gentoo migration to raid'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-1562486177649692651</id><published>2010-04-23T09:41:00.000+07:00</published><updated>2010-04-23T09:51:29.991+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='filesystem'/><category scheme='http://www.blogger.com/atom/ns#' term='loopback'/><title type='text'>Mounting file as filesystem</title><content type='html'>Linux provide various and flexible file system for user to choose.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here are an example &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create empty 10 Mb file.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#dd if=/dev/zero of=file.img bs=1k count=10000&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;Attach the file to loopback file system &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#losetup /dev/loop0 file.img&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;Create file system on loopback device&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#mke2fs -c /dev/loop0 10000&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;Mount loopback device &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#mount -t ext2 /dev/loop0 /mnt/point1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;So you can have any file system on any file system. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;To find out more detail about file system please visit the following links : &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;-Anatomy of file system&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.ibm.com/developerworks/linux/library/l-linux-filesystem/"&gt;http://www.ibm.com/developerworks/linux/library/l-linux-filesystem/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;-Cryptographic File Systems Performance&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.fsl.cs.sunysb.edu/docs/nc-perf/index.html"&gt;http://www.fsl.cs.sunysb.edu/docs/nc-perf/index.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;-Loopback Tricks&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.fsl.cs.sunysb.edu/docs/nc-perf/index.html"&gt;http://nst.sourceforge.net/nst/docs/user/ch04s04.html#filesystem.loopback&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-1562486177649692651?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/1562486177649692651/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/04/mounting-file-as-filesystem.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1562486177649692651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1562486177649692651'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/04/mounting-file-as-filesystem.html' title='Mounting file as filesystem'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-4997625420281574078</id><published>2010-03-12T13:03:00.000+07:00</published><updated>2010-03-15T12:05:01.088+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>The linux documentation project</title><content type='html'>Linux newbie might be looking for reliable document for linux.&lt;br /&gt;Here is a good link that worth a look.&lt;br /&gt;&lt;br /&gt;Link:&lt;br /&gt;&lt;a href="http://tldp.org/guides.html"&gt;http://tldp.org/guides.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-4997625420281574078?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/4997625420281574078/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/linux-documentation-project.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4997625420281574078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4997625420281574078'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/linux-documentation-project.html' title='The linux documentation project'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7292687404561916426</id><published>2010-03-10T12:59:00.000+07:00</published><updated>2010-03-10T13:09:34.343+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='fcgi'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Configuring gentoo apache with fcgi</title><content type='html'>mod php and worker are not stable as PHP official page.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Gentoo user might not aware this because we can compile PHP with threads use flag without realizing the warning.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before get start with apache-worker fcgid and php. You  need the following :&lt;/div&gt;&lt;div&gt;1) installed PHP with cgi use flag.&lt;/div&gt;&lt;div&gt;2) installed mod_fcgid (emerge mod_fcgid) &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PHP configuration : &lt;/div&gt;&lt;div&gt;- modify /etc/php/cgi-php5/php.ini to suite your need.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;apache configuration : &lt;/div&gt;&lt;div&gt;- modify /etc/apache2/modules.d/20_mod_fcgid.conf  adding the following in &lt;ifdefine&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;AddHandler    fcgid-script .php .fcgi&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;DefaultInitEnv PHPRC "/etc/php/cgi-php5"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;IdleTimeout 60&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;BusyTimeout 120&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;ProcessLifeTime 360&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;SpawnScoreUpLimit 2100&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;MaxProcessCount 2100&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;DefaultMaxClassProcessCount 2100&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;IPCConnectTimeout 120&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;IPCCommTimeout 120&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;directory&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;        FCGIWrapper /usr/bin/php-cgi .php&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;/directory&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;/ifdefine&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Please change the /usr/bin/cgi/ to your path. And don't forget to add +ExecCGI to option directive.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- edit /etc/conf.d/apache2 add -D FCGID to APACHE2_OPTS&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;restarting apache.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7292687404561916426?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7292687404561916426/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/configuring-gentoo-apache-with-fcgi.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7292687404561916426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7292687404561916426'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/configuring-gentoo-apache-with-fcgi.html' title='Configuring gentoo apache with fcgi'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-1413432476604159236</id><published>2010-03-09T17:37:00.000+07:00</published><updated>2010-03-09T17:43:58.749+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='monit'/><category scheme='http://www.blogger.com/atom/ns#' term='monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Monit : debuging monit process</title><content type='html'>Misconfiguration on apache can lead monit false alet and do wrong action. I found that some monit process in one of my servers always complaining about apache cannot connect port 80. which is not right cause I can still access the pages.&lt;br /&gt;&lt;br /&gt;Here are tip for debugging what goes wrong:&lt;br /&gt;&lt;br /&gt;1) stop monit as a daemon&lt;br /&gt;2) smart monit in foreground&lt;br /&gt;#monit -Iv&lt;br /&gt;3) see the message&lt;br /&gt;&lt;br /&gt;From my experience, the server response with 403 http code cause monit alert cannot connect host port 80.&lt;br /&gt;So, I change apache config to get 200 code and everything back to work :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-1413432476604159236?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/1413432476604159236/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/monit-debuging-monit-process.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1413432476604159236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1413432476604159236'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/monit-debuging-monit-process.html' title='Monit : debuging monit process'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2659833053607159008</id><published>2010-03-09T17:26:00.000+07:00</published><updated>2010-03-09T17:42:21.299+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='monit'/><category scheme='http://www.blogger.com/atom/ns#' term='monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Monit : server monitoring tools</title><content type='html'>If you have a web server, have you ever experience apache process not responding to http request?&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;How to make sure that apache are running? and If server load go too high please restart it for me.&lt;br /&gt;&lt;br /&gt;Monit can help you monitoring common for system admin.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It can monitoring server process, file size, memory server load. And, you can set the appropriate action to those events: sending email, restart process etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;To install monit&lt;br /&gt;&lt;/span&gt;&lt;span&gt;for gentoo : &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;#emerge -av monit&lt;br /&gt;for debian:&lt;br /&gt;#apt-get install monit&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Configuring monit &lt;/span&gt;&lt;br /&gt;Locate configuration file : /etc/monitrc or /etc/monit/monitrc&lt;br /&gt;Here is the example configuration for apache with these condition&lt;br /&gt;1) check whether apache is running : if not restart&lt;br /&gt;2) check http:80 is working : if not restart&lt;br /&gt;3) if server go to high : restart apache process&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;set daemon 120&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set mailserver smtp.localhost&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set mail-format { from: admin@localhost.com }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set alert systemadmin@localhost.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; check process apache with pidfile /var/run/apache2.pid&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        start program = "/etc/init.d/apache2 start" &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        stop program  = "/etc/init.d/apache2 stop"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        if failed port 80 protocol http then restart&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        if loadavg(5min) greater than 100 for 2 cycles then restart&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        alert  extrapeople@localhost.com&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;If you are interested in monit for advance feature please visit monit official site.&lt;br /&gt;&lt;a href="http://mmonit.com/monit/documentation/monit.html"&gt;check out monit document&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2659833053607159008?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2659833053607159008/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/monit-server-monitoring-tools.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2659833053607159008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2659833053607159008'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/monit-server-monitoring-tools.html' title='Monit : server monitoring tools'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6657349324503614897</id><published>2010-03-05T17:20:00.000+07:00</published><updated>2010-03-05T17:28:14.930+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Advance php error handling</title><content type='html'>PHP server need different configuration for production and development server.&lt;br /&gt;&lt;br /&gt;This article help you understanding php.ini configuration better and applicable to your server.&lt;br /&gt;&lt;br /&gt;- display_errors&lt;br /&gt;echo error to the browser this should be turn off for production but should be enable for test server.&lt;br /&gt;&lt;br /&gt;- log_errors&lt;br /&gt;instead of displaying error to stderr, you can choose to enable error logging to the file instead for production.&lt;br /&gt;&lt;br /&gt;More option  can be study here :&lt;br /&gt;&lt;a href="http://perishablepress.com/press/2008/01/30/advanced-php-error-handling-via-php/"&gt;http://perishablepress.com/press/2008/01/30/advanced-php-error-handling-via-php/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6657349324503614897?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6657349324503614897/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/advance-php-error-handling.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6657349324503614897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6657349324503614897'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/advance-php-error-handling.html' title='Advance php error handling'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-5359160724031496396</id><published>2010-03-05T16:37:00.000+07:00</published><updated>2010-04-05T16:10:13.318+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fcgi'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><category scheme='http://www.blogger.com/atom/ns#' term='cgi'/><title type='text'>apache with fcgid</title><content type='html'>Once, I used gentoo with apache(worker) + phpmod  as a webserver. After switching to ubuntu, I've found that phpmod is not stable with apache(worker), this is not a problem with gentoo  b'coz u can customize everything by yourself.&lt;br /&gt;&lt;br /&gt;Up to this point ,there are 2 choice for ubuntu apache works with php&lt;br /&gt;1) use apache prefork + phpmod&lt;br /&gt;2) use apache worker + cgi + php&lt;br /&gt;&lt;br /&gt;&lt;div&gt;More description about fcgid/fastcgi &lt;a href="http://www.seaoffire.net/fcgi-faq.html"&gt;http://www.seaoffire.net/fcgi-faq.html&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;I found the following study show that fcgid might be a good choice. And, it is.&lt;br /&gt;&lt;a href="http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html"&gt;http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For fcgid reference for apache :&lt;br /&gt;&lt;a href="http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html"&gt;http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-5359160724031496396?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/5359160724031496396/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/apache-with-fcgid.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5359160724031496396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5359160724031496396'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/apache-with-fcgid.html' title='apache with fcgid'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6237191077482077060</id><published>2010-03-04T15:15:00.000+07:00</published><updated>2010-03-05T16:15:36.955+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='cacti'/><title type='text'>monitoring mysql with cacti</title><content type='html'>By default, cacti don't come with mysql graphing template. Here is the plugin that help you graphing mysql important data.&lt;br /&gt;&lt;br /&gt;The installation is like  the other plugins.&lt;br /&gt;1) copy php script to cacti host /script directory&lt;br /&gt;2) import template using web interface&lt;br /&gt;3) add mysql user to mysql host&lt;br /&gt;4) have fun :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;plugin document/download :&lt;br /&gt;&lt;a href="http://code.google.com/p/mysql-cacti-templates/wiki/InstallingTemplates"&gt;http://code.google.com/p/mysql-cacti-templates/wiki/InstallingTemplates&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;author blog:&lt;br /&gt;&lt;a href="http://www.xaprb.com/blog/2009/10/25/version-1-1-4-of-improved-cacti-templates-released/"&gt;http://www.xaprb.com/blog/2009/10/25/version-1-1-4-of-improved-cacti-templates-released/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6237191077482077060?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6237191077482077060/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/03/monitoring-mysql-with-cacti.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6237191077482077060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6237191077482077060'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/03/monitoring-mysql-with-cacti.html' title='monitoring mysql with cacti'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6519415138386612308</id><published>2010-02-17T09:22:00.000+07:00</published><updated>2010-02-19T16:43:16.752+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Apache Mod setenvif</title><content type='html'>Some software/browser didn't follow the standard or have some bugs. I found that MSIE 6  have problem with richtext editor -javascript. Mod setenvif can be used to set special variable to correct the problem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In file: /etc/apache2/mods-enabled/setenvif.conf&lt;br /&gt;&lt;tt&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/tt&gt;&lt;span style="font-weight: bold;"&gt;BrowserMatch "MSIE 4\.0b2;"  gzip-only-text/html&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;With this line apache the user with MSIE6 will be:&lt;br /&gt;-send gzip format for text/html only&lt;br /&gt;-disable keepalive&lt;br /&gt;-downgraded request to HTTP 1.0&lt;br /&gt;-response with HTTP 1.0&lt;br /&gt;&lt;br /&gt;To find our more directive of this mod.&lt;br /&gt;&lt;a href="http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html"&gt;http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There are more interesting variable that can be set.&lt;br /&gt;&lt;a href="http://httpd.apache.org/docs/2.2/env.html"&gt;http://httpd.apache.org/docs/2.2/env.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6519415138386612308?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6519415138386612308/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/02/apache-mod-setenvif.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6519415138386612308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6519415138386612308'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/02/apache-mod-setenvif.html' title='Apache Mod setenvif'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6618430846299537169</id><published>2010-02-12T17:55:00.000+07:00</published><updated>2011-02-09T17:13:29.917+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apt'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu package management  &amp; package installed for web server</title><content type='html'>Update list of package&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#apt-get update&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Upgrade all package in system&lt;br /&gt;#apt-get upgrade&lt;br /&gt;&lt;br /&gt;To install package&lt;br /&gt;#apt-get install foo&lt;br /&gt;&lt;br /&gt;To remove package&lt;br /&gt;#apt-get remove foo&lt;br /&gt;-remove configuration on the system&lt;br /&gt;#apt-get --purge remove for&lt;br /&gt;&lt;br /&gt;To upgrade all packages on the system&lt;br /&gt;#apt-get dist-upgrade&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;apt-cache : query package list tool&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To ﬁnd packages whose description contain word:&lt;br /&gt;#apt-cache search word&lt;br /&gt;&lt;br /&gt;To print the detailed information of a package:&lt;br /&gt;#apt-cache show package&lt;br /&gt;&lt;br /&gt;To print the packages a given package depends on:&lt;br /&gt;#apt-cache depends package&lt;br /&gt;&lt;br /&gt;#To print detailed information of the versions available for a package and the packages&lt;br /&gt;that reverse-depends on it:&lt;br /&gt;apt-cache showpkg package&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PHP package &lt;/span&gt;&lt;br /&gt;php5&lt;br /&gt;php5-cgi&lt;br /&gt;php5-cli&lt;br /&gt;php5-curl&lt;br /&gt;php4-common&lt;br /&gt;php5-gd&lt;br /&gt;php5-imagick&lt;br /&gt;php5-memcache&lt;br /&gt;php5-mysql&lt;br /&gt;php5-xcache&lt;br /&gt;libapache2-mod-fcgid&lt;br /&gt;nfs-kernel-server&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Apache package&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;apache2&lt;br /&gt;apache2-mpm-worker&lt;br /&gt;apache2-utils&lt;br /&gt;apache2.2-bin&lt;br /&gt;apache2.2-common&lt;br /&gt;libapache2-mod-fcgid&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Apache Ubuntu vs Apache gentoo&lt;/span&gt;&lt;br /&gt;add user apache with uid81 (gentoo)&lt;br /&gt;#useradd -r -u 81 apache&lt;br /&gt;&lt;br /&gt;edit&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; /etc/apache2/envvars to run apache with user apache&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;Reference :&lt;/u&gt;&lt;/div&gt;&lt;div&gt;A Debian Package Primer: Part One&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.linux-mag.com/cache/7747/1.html"&gt;http://www.linux-mag.com/cache/7747/1.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Aptitude :part two&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.linux-mag.com/cache/7752/1.html"&gt;http://www.linux-mag.com/cache/7752/1.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Ubuntu Community Doc. &lt;/div&gt;&lt;div&gt;&lt;a href="https://help.ubuntu.com/community/SoftwareManagement"&gt;https://help.ubuntu.com/community/SoftwareManagement&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6618430846299537169?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6618430846299537169/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/02/ubuntu-package-management-package.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6618430846299537169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6618430846299537169'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/02/ubuntu-package-management-package.html' title='Ubuntu package management  &amp; package installed for web server'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-745985339160984459</id><published>2010-02-11T16:09:00.000+07:00</published><updated>2010-02-12T11:36:38.114+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Understanding apache config order in debian/ubuntu</title><content type='html'>In ubuntu, i've found a lot of config file for apache. To identify the problem, you need to know which config loading sequence which might overwrite another one.&lt;br /&gt;&lt;br /&gt;/etc/apache2&lt;br /&gt;&lt;br /&gt;1) &lt;span style="font-weight: bold;"&gt;apache2.conf &lt;/span&gt;- define #process, timeout etc...&lt;br /&gt;2) &lt;span style="font-weight: bold;"&gt;mods-enabled/*.conf&lt;/span&gt; - module configuration&lt;br /&gt;3)&lt;span style="font-weight: bold;"&gt; httpd.conf&lt;/span&gt; (user configuration)&lt;br /&gt;4) ports.conf - port listening&lt;br /&gt;5) conf.d/*- generic snippet statement - charset localized-error-pages, security&lt;br /&gt;6) &lt;span style="font-weight: bold;"&gt;sites-enable/*&lt;/span&gt; -all vhost&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-745985339160984459?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/745985339160984459/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/02/understanding-apache-config-in.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/745985339160984459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/745985339160984459'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/02/understanding-apache-config-in.html' title='Understanding apache config order in debian/ubuntu'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2769088805469450251</id><published>2010-02-11T13:42:00.001+07:00</published><updated>2010-02-11T16:08:28.052+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='opcode'/><category scheme='http://www.blogger.com/atom/ns#' term='tunning'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='xcache'/><title type='text'>xcache opcode/optimizer for php tunning</title><content type='html'>Installing xcache can help php-apache app responding faster.&lt;br /&gt;&lt;br /&gt;1) installing xcache&lt;br /&gt;gentoo :&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#emerge cache&lt;/span&gt;&lt;br /&gt;ubuntu/debian&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#apt-get install  php5-xcache &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;after installing you will see path for xcache admin&lt;br /&gt;2) set xcache config and admin password&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#echo -n "yourpassword" | md5sum&lt;/span&gt;&lt;br /&gt;edit xcache.ini this line :&lt;br /&gt;xcache.admin.pass="" (from previous command)&lt;br /&gt;&lt;a href="http://xcache.lighttpd.net/wiki/XcacheIni"&gt;http://xcache.lighttpd.net/wiki/XcacheIni&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3) point apache to xcache admin path&lt;br /&gt;&lt;br /&gt;4) browse xcache admin with browser&lt;br /&gt;&lt;br /&gt;use this admin page to see what variable need to be adjusted.&lt;br /&gt;&lt;br /&gt;I'll point some importtatn config&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;xcache.size&lt;/span&gt;&lt;br /&gt;- set just fit, not too low or too high. see OOM(out of memory column) from admin page. If there are lots of OOM, please consider increasing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;xcache.count&lt;/span&gt;&lt;br /&gt;- set to number of your cpu : cat /proc/cpuinfo | grep -c processor&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;xcache.slots&lt;/span&gt;&lt;br /&gt;- the more slot, the faster PHP code accessing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;More reading here :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;introduction to xcache &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-php-fastapps1/"&gt;http://www.ibm.com/developerworks/opensource/library/os-php-fastapps1/&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;set xcache adminpage  &lt;a href="http://www.linuxtuts.net/ubuntu-webserver-tutorials/228-how-install-xcache-administration-page-ubuntu-linux.html" target="_blank"&gt;http://www.linuxtuts.net/&lt;wbr&gt;ubuntu-webserver-tutorials/&lt;wbr&gt;228-how-install-xcache-&lt;wbr&gt;administration-page-ubuntu-&lt;wbr&gt;linux.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;xcaching tunning&lt;a href="http://serveradmins.net/tuning-xcache-for-fun-and-profit/"&gt; http://serveradmins.net/tuning-xcache-for-fun-and-profit/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;xcache ini document &lt;a href="http://xcache.lighttpd.net/wiki/XcacheIni"&gt;http://xcache.lighttpd.net/wiki/XcacheIni&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2769088805469450251?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2769088805469450251/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/02/xcache-opcodeoptimizer-for-php-tunning.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2769088805469450251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2769088805469450251'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/02/xcache-opcodeoptimizer-for-php-tunning.html' title='xcache opcode/optimizer for php tunning'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-6421862296872472692</id><published>2010-02-09T13:48:00.000+07:00</published><updated>2010-03-05T15:55:08.587+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rrdtool'/><category scheme='http://www.blogger.com/atom/ns#' term='graph'/><category scheme='http://www.blogger.com/atom/ns#' term='cacti'/><title type='text'>rrdtool tune rra file</title><content type='html'>Using SNMP and cacti, you need to adjust rrd file manually for displaying graph correctly.&lt;br /&gt;&lt;br /&gt;/cacti/rra&lt;br /&gt;show file info to see the limitation of value&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#rrdtool info &lt;span style="font-weight: bold;"&gt;filename&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;.rrd   &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;tunning it&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#rrdtool tune &lt;span style="font-weight: bold;"&gt;filename.rrd &lt;/span&gt;&lt;rrd&gt; --maximum &lt;ds-name&gt;cpu_user:800&lt;new&gt;&lt;/new&gt;&lt;/ds-name&gt;&lt;/rrd&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-6421862296872472692?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/6421862296872472692/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/02/rrdtool-rra-file.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6421862296872472692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/6421862296872472692'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/02/rrdtool-rra-file.html' title='rrdtool tune rra file'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-3399449835013042001</id><published>2010-02-08T11:46:00.000+07:00</published><updated>2010-02-11T16:08:54.332+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='snmp'/><category scheme='http://www.blogger.com/atom/ns#' term='cacti'/><title type='text'>gentoo SNMP</title><content type='html'>Installing SNMP in gentoo for system monitoring.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#emerge net-snmp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;edit /etc/snmp/snmpd.conf add the following&lt;br /&gt;com2sec Mybox     localhost          public&lt;br /&gt;com2sec cacti     192.168.1.0/24     public&lt;br /&gt;&lt;br /&gt;group   RWGroup    v2c       Mybox&lt;br /&gt;group   ROGroup    v1        cacti&lt;br /&gt;group   ROGroup    v2c       cacti&lt;br /&gt;&lt;br /&gt;view all     included  .1        80&lt;br /&gt;view system  included  system    fe&lt;br /&gt;&lt;br /&gt;access  ROGroup   ""      any    noauth    exact   all     none   none&lt;br /&gt;access  RWGroup   ""      v2c    noauth    exact   all     all    all&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#rc-update add snmpd default&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-3399449835013042001?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/3399449835013042001/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/02/gentoo-snmp.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3399449835013042001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3399449835013042001'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/02/gentoo-snmp.html' title='gentoo SNMP'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-4506270026360954207</id><published>2010-01-21T14:20:00.000+07:00</published><updated>2010-02-11T16:08:00.482+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>timer shell script</title><content type='html'>To measure performance, you might want to know how much does it take to complete the task.&lt;br /&gt;Here are shell script to help you.&lt;br /&gt;&lt;br /&gt;The following measure hard disk  performance by creating 10 GB file.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;START=$(date +%s)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# do something&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# start your script work here&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;dd if=/dev/zero of=/home/user/hd2/file.img bs=1M count=1000&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# your logic ends here&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;END=$(date +%s)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;DIFF=$(( $END - $START ))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;echo "It took $DIFF seconds"&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-4506270026360954207?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/4506270026360954207/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/timer-shell-script.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4506270026360954207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4506270026360954207'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/timer-shell-script.html' title='timer shell script'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7134685634322842908</id><published>2010-01-21T09:41:00.000+07:00</published><updated>2010-02-11T16:09:11.154+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webserver'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='nginx'/><category scheme='http://www.blogger.com/atom/ns#' term='lighttpd'/><title type='text'>Nginx / lighttpd light weight web server.</title><content type='html'>Apache is a standard for web server. But, you can help apache and utilize computing resource by using lighttpd and nginx as a helper for static content/load balancer for your website.&lt;br /&gt;&lt;br /&gt;nginx :&lt;br /&gt;&lt;a href="http://wiki.nginx.org/NginxModules"&gt;http://wiki.nginx.org/NginxModules&lt;/a&gt;&lt;br /&gt;lighttpd&lt;br /&gt;&lt;a href="http://redmine.lighttpd.net/wiki/lighttpd"&gt;http://redmine.lighttpd.net/wiki/lighttpd&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7134685634322842908?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7134685634322842908/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/nginx-lighttpd-light-weight-web-server.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7134685634322842908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7134685634322842908'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/nginx-lighttpd-light-weight-web-server.html' title='Nginx / lighttpd light weight web server.'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-713923749565144064</id><published>2010-01-20T10:25:00.000+07:00</published><updated>2010-02-11T16:07:43.700+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webserver'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>webserver http-caching header</title><content type='html'>Here are link to speed up your http server :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mnot.net/cache_docs/"&gt;http://www.mnot.net/cache_docs/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.web-caching.com/"&gt;http://www.web-caching.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-713923749565144064?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/713923749565144064/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/webserver-http-caching.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/713923749565144064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/713923749565144064'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/webserver-http-caching.html' title='webserver http-caching header'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-1514995897671886220</id><published>2010-01-20T09:10:00.001+07:00</published><updated>2010-04-20T10:35:55.611+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='admin'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>User &amp; group management : uid, gid user</title><content type='html'>If you share file about variety distro of linux, you might experience with permission error.&lt;br /&gt;&lt;br /&gt;The following command help to change uid, gid of user apache group apache to 81 :&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#usermod -u 81 apache&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#groupmod -g 81 apache&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#id apache&lt;/span&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Read more: &lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;user &amp;amp; group management : &lt;a href="http://www.linux-mag.com/cache/7759/1.html"&gt;http://www.linux-mag.com/cache/7759/1.html&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-1514995897671886220?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/1514995897671886220/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/change-uid-gid-for-user-in-ubuntu-linux.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1514995897671886220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/1514995897671886220'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/change-uid-gid-for-user-in-ubuntu-linux.html' title='User &amp; group management : uid, gid user'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-5373787978753179628</id><published>2010-01-12T11:50:00.000+07:00</published><updated>2010-03-26T10:56:57.477+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harddisk'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to monitor harddisk with smartmontools</title><content type='html'>&lt;p&gt;Now let's install the &lt;a href="http://gentoo-portage.com/Search?search=sys-apps/smartmontools" class="extiw" title="ebuild:sys-apps/smartmontools"&gt;smartmontools&lt;/a&gt; package: &lt;/p&gt; &lt;pre&gt;# emerge -av smartmontools&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;Finally, you have to check if your hard disk(s) support SMART: &lt;/p&gt; &lt;pre&gt;# smartctl -i /dev/hda&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;For SATA drives: &lt;/p&gt; &lt;pre&gt;# smartctl -i -d ata /dev/sda&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; Using smartctl &lt;/span&gt;&lt;/h2&gt; &lt;div class="editsection" style="float: right; margin-left: 5px;"&gt;[&lt;a href="http://users.atw.hu/index.php?title=HOWTO_Monitor_your_hard_disk%28s%29_with_smartmontools&amp;amp;action=edit&amp;amp;section=4" title="Edit section: SMART Health Status"&gt;edit&lt;/a&gt;]&lt;/div&gt;&lt;a name="SMART_Health_Status"&gt;&lt;/a&gt;&lt;h3&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;SMART Health Status&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Let's check the SMART Health Status: &lt;/p&gt; # smartctl -H /dev/hda  &lt;p&gt;If you read &lt;i&gt;PASSED&lt;/i&gt; it's ok, but if you read &lt;i&gt;FAILED&lt;/i&gt; you have to backup your data now: the disk has already failed or it's predicted to fail within 24 hours! &lt;span style="font-family:monospace;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;To recover from bad block :&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://smartmontools.sourceforge.net/badblockhowto.html"&gt;http://smartmontools.sourceforge.net/badblockhowto.html&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:monospace;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;smartmontool document: &lt;/p&gt;&lt;p&gt;&lt;a href="http://sourceforge.net/apps/trac/smartmontools/wiki/TocDoc"&gt;http://sourceforge.net/apps/trac/smartmontools/wiki/TocDoc&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:monospace;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-5373787978753179628?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/5373787978753179628/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/how-to-monitor-harddisk-with.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5373787978753179628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5373787978753179628'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/how-to-monitor-harddisk-with.html' title='How to monitor harddisk with smartmontools'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-5063076659703761761</id><published>2010-01-08T15:54:00.000+07:00</published><updated>2010-02-11T16:06:54.850+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tunning'/><title type='text'>swappiness tuning linux</title><content type='html'>vm.swappiness is a tunable kernel parameter that controls how much the kernel favors swap over RAM. At the source code level, it’s also defined as the tendency to steal mapped memory. A high swappiness value means that the kernel will be more apt to unmap mapped pages. A low swappiness value means the opposite, the kernel will be less apt to unmap mapped pages. In other words, the higher the vm.swappiness value, the more the system will swap.&lt;br /&gt;&lt;br /&gt;More to read : &lt;a href="http://www.linuxvox.com/2009/10/what-is-the-linux-kernel-parameter-vm-swappiness/"&gt;http://www.linuxvox.com/2009/10/what-is-the-linux-kernel-parameter-vm-swappiness/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The following is the test. It seems that the higher swapiness the slower i/o rate. More to read : &lt;a href="http://lwn.net/Articles/100978/"&gt;http://lwn.net/Articles/100978/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-5063076659703761761?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/5063076659703761761/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/swappiness-tuning-linux.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5063076659703761761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/5063076659703761761'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/swappiness-tuning-linux.html' title='swappiness tuning linux'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-272788122400288436</id><published>2010-01-08T10:59:00.000+07:00</published><updated>2010-02-11T16:06:30.747+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ram'/><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><title type='text'>linux memory management</title><content type='html'>&lt;h2&gt; &lt;span class="mw-headline"&gt;Overview of memory management&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Traditional Unix tools like 'top' often report a surprisingly small amount of free memory after a system has been running for a while. For instance, after about 3 hours of uptime, the machine I'm writing this on reports under 60 MB of free memory, even though I have 512 MB of RAM on the system. Where does it all go?&lt;/p&gt;&lt;p&gt;The biggest place it's being used is in the disk cache, which is currently over 290 MB. This is reported by top as "cached". Cached memory is essentially free, in that it can be replaced quickly if a running (or newly starting) program needs the memory.&lt;/p&gt;&lt;p&gt;The reason Linux uses so much memory for disk cache is because the RAM is wasted if it isn't used. Keeping the cache means that if something needs the same data again, there's a good chance it will still be in the cache in memory. Fetching the information from there is around 1,000 times quicker than getting it from the hard disk. If it's not found in the cache, the hard disk needs to be read anyway, but in that case nothing has been lost in time.&lt;/p&gt;&lt;p&gt;To see a better estimation of how much memory is really free for applications to use, run the command free -m:&lt;/p&gt;&lt;table style="border: 1px solid rgb(191, 255, 191); background-color: rgb(242, 255, 242);" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="border-style: solid; border-color: rgb(160, 255, 160) rgb(160, 255, 160) rgb(136, 136, 136); border-width: 1px; background-color: rgb(193, 255, 193);"&gt; &lt;span style=""&gt;&lt;b&gt;Code:&lt;/b&gt; free -m&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="scroll"&gt;&lt;pre&gt;             total       used       free     shared    buffers     cached&lt;br /&gt;Mem:           503        451         52          0         14        293&lt;br /&gt;-/+ buffers/cache:        143        360&lt;br /&gt;Swap:         1027          0       1027&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;The &lt;b&gt;-/+ buffers/cache&lt;/b&gt; line shows how much memory is used and free from the perspective of the applications. Generally speaking, if little swap is being used, memory usage isn't impacting performance at all.&lt;/p&gt;&lt;p&gt;Notice that I have 512 MB of memory in my machine, but only 52 is listed as available by free. This is mainly because the kernel can't be swapped out, so the memory it occupies could never be freed. There may also be regions of memory reserved for/by the hardware for other purposes as well, depending on the system architecture. However, 360M are free for application consumption.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2&gt; &lt;span class="mw-headline"&gt;The difference among VIRT, RES, and SHR in top output&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card's RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.&lt;/p&gt;&lt;p&gt;RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. (This also corresponds directly to the %MEM column.) This will virtually always be less than the VIRT size (there are only very rare cases that they will be equal, and RES will never be more than VIRT).&lt;/p&gt;&lt;p&gt;SHR indicates how much of the VIRT size is actually sharable (memory or libraries). In the case of libraries, it does not necessarily mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES.&lt;/p&gt; &lt;a name="The_difference_between_buffers_and_cache"&gt;&lt;/a&gt;&lt;h2&gt; &lt;span class="mw-headline"&gt;The difference between buffers and cache&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Buffers are allocated by various processes to use as input queues, etc. Most of the time, buffers are some processes' output, and they are file buffers. A simplistic explanation of buffers is that they allow processes to temporarily store input in memory until the process can deal with it.&lt;/p&gt;&lt;p&gt;Cache is typically frequently requested disk I/O. If multiple processes are accessing the same files, much of those files will be cached to improve performance (RAM being so much faster than hard drives), it's disk cache.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;More to read : &lt;a href="http://www.gentoo-wiki.info/FAQ_Linux_Memory_Management"&gt;http://www.gentoo-wiki.info/FAQ_Linux_Memory_Management&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.gentoo-wiki.info/FAQ_Linux_Memory_Management"&gt;&lt;/a&gt;&lt;a href="http://forums.gentoo.org/viewtopic-t-175419-postdays-0-postorder-asc-start-0.html"&gt;http://forums.gentoo.org/viewtopic-t-175419-postdays-0-postorder-asc-start-0.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-272788122400288436?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/272788122400288436/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/linux-memory-management.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/272788122400288436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/272788122400288436'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/linux-memory-management.html' title='linux memory management'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2839853027006053202</id><published>2010-01-08T09:11:00.000+07:00</published><updated>2010-01-08T09:12:41.448+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>optimize Tortoise SVN cache</title><content type='html'>From : http://www.paraesthesia.com/archive/2007/09/26/optimize-tortoise-svn-cache-tsvncache.exe-disk-io.aspx&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;To optimize the disk usage...&lt;/p&gt; &lt;ol&gt;&lt;li&gt;Right-click on your desktop and select "TortoiseSVN -&gt; Settings..." &lt;/li&gt;&lt;li&gt;In the tree view, find the "Look and Feel/Icon Overlays" branch. &lt;/li&gt;&lt;li&gt;In the "Exclude Paths" box, put &lt;code&gt;C:\*&lt;/code&gt; to exclude the entire C drive.  If you have more drives than that, exclude them all at the top level.  Separate the values by newlines. &lt;/li&gt;&lt;li&gt;In the "Include Paths" box, list all of the locations you have working copies, separated by newlines.  Again, this is easier if you keep all of your working copies in a specific folder or set of folders.  Using my example, this is what I put in the "Include Paths" box:&lt;br /&gt;    &lt;code&gt;C:\dev\*&lt;br /&gt;    C:\Documents and Settings\tillig\My Documents\Visual Studio 2005\*&lt;br /&gt;    C:\Documents and Settings\tillig\My Documents\Visual Studio Projects\*&lt;/code&gt;&lt;br /&gt;   &lt;br /&gt;    And here's a screen shot:&lt;br /&gt;    &lt;img alt="TortoiseSVN icon overlay options - set the &amp;quot;Exclude paths&amp;quot; and &amp;quot;Include paths&amp;quot; values" src="http://farm4.static.flickr.com/3110/2825266523_d15b74d15f_o.jpg" height="320" width="450" /&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;Click OK to apply the changes. &lt;/li&gt;&lt;li&gt;Either reboot or open Task Manager and kill "TSVNCache.exe" so it restarts when needed.  You have to restart it for these options to take effect. &lt;/li&gt;&lt;/ol&gt; &lt;p&gt;After I did this, the icon overlays still worked great but the disk I/O went down to nearly nothing.  YMMV.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2839853027006053202?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2839853027006053202/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/optimize-tortoise-svn-cache.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2839853027006053202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2839853027006053202'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/optimize-tortoise-svn-cache.html' title='optimize Tortoise SVN cache'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-564176203607408725</id><published>2010-01-06T16:24:00.000+07:00</published><updated>2010-02-11T16:06:02.978+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='coredump'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Apache Segmentation fault</title><content type='html'>Recently, I've found the message in&lt;br /&gt;#/var/log/apache2/error_log&lt;br /&gt;[notice] child pid 20295 exit signal Segmentation fault (11)&lt;br /&gt;&lt;br /&gt;Getting core dump file  : &lt;a href="http://www.question-defense.com/2009/07/15/upgrade-php-version-51-to-php-version-52-with-yum-on-a-centos-server-running-ispconfig"&gt;http://www.question-defense.com/2009/07/15/apache-notice-child-pid-27609-exit-signal-segmentation-fault-11&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;debugin apache : &lt;a href="http://httpd.apache.org/dev/debugging.html"&gt;http://httpd.apache.org/dev/debugging.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Apache document directive for coredump : &lt;a href="http://httpd.apache.org/docs/2.0/mod/mpm_common.html"&gt;http://httpd.apache.org/docs/2.0/mod/mpm_common.html&lt;/a&gt;&lt;br /&gt;&lt;h2&gt;&lt;a name="CoreDumpDirectory" id="CoreDumpDirectory"&gt;CoreDumpDirectory&lt;/a&gt; &lt;a name="coredumpdirectory" id="coredumpdirectory"&gt;Directive&lt;/a&gt;&lt;/h2&gt; &lt;table class="directive"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;th&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/directive-dict.html#Description"&gt;Description:&lt;/a&gt;&lt;/th&gt;&lt;td&gt;Directory where Apache attempts to switch before dumping core&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/directive-dict.html#Syntax"&gt;Syntax:&lt;/a&gt;&lt;/th&gt;&lt;td&gt;&lt;code&gt;CoreDumpDirectory &lt;var&gt;directory&lt;/var&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/directive-dict.html#Default"&gt;Default:&lt;/a&gt;&lt;/th&gt;&lt;td&gt;&lt;code&gt;See usage for the default setting&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/directive-dict.html#Context"&gt;Context:&lt;/a&gt;&lt;/th&gt;&lt;td&gt;server config&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/directive-dict.html#Status"&gt;Status:&lt;/a&gt;&lt;/th&gt;&lt;td&gt;MPM&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/directive-dict.html#Module"&gt;Module:&lt;/a&gt;&lt;/th&gt;&lt;td&gt;&lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/beos.html"&gt;beos&lt;/a&gt;&lt;/code&gt;, &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/leader.html"&gt;leader&lt;/a&gt;&lt;/code&gt;, &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mpm_winnt.html"&gt;mpm_winnt&lt;/a&gt;&lt;/code&gt;, &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/perchild.html"&gt;perchild&lt;/a&gt;&lt;/code&gt;, &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/prefork.html"&gt;prefork&lt;/a&gt;&lt;/code&gt;, &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/threadpool.html"&gt;threadpool&lt;/a&gt;&lt;/code&gt;, &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/worker.html"&gt;worker&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;     &lt;p&gt;This controls the directory to which Apache attempts to     switch before dumping core. The default is in the     &lt;code class="directive"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/core.html#serverroot"&gt;ServerRoot&lt;/a&gt;&lt;/code&gt; directory, however     since this should not be writable by the user the server runs     as, core dumps won't normally get written. If you want a core     dump for debugging, you can use this directive to place it in a     different location.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-564176203607408725?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/564176203607408725/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/apache-segmentation-fault.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/564176203607408725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/564176203607408725'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/apache-segmentation-fault.html' title='Apache Segmentation fault'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-3778641269299408448</id><published>2010-01-05T10:16:00.000+07:00</published><updated>2010-02-11T16:05:48.000+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><title type='text'>TCP/networking tunning</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Kernel TCP Networking tunning . &lt;/span&gt;&lt;br /&gt;You can achieve a high network performance by adjusting some value to to the kernel&lt;br /&gt;From &lt;a href="http://www.gentoo-wiki.info/HOWTO_TCP_Tuning"&gt;http://www.gentoo-wiki.info/HOWTO_TCP_Tuning&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.techrepublic.com.com/opensource/?p=62"&gt;http://blogs.techrepublic.com.com/opensource/?p=62&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.freebsd.org/doc/en/books/handbook/index.html"&gt;http://www.freebsd.org/doc/en/books/handbook/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; &lt;span class="mw-headline"&gt; Variables to Change, and suggested Values &lt;/span&gt;&lt;/h3&gt;&lt;dl&gt;&lt;dt&gt; net.core.rmem_max="16777216" &lt;/dt&gt;&lt;dd&gt; This setting changes the maximum network receive buffer size to 16777216 bytes.&lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt&gt; net.core.wmem_max="16777216" &lt;/dt&gt;&lt;dd&gt; The same thing for the send buffer&lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt&gt; net.ipv4.tcp_rmem="4096 87380 16777216" &lt;/dt&gt;&lt;dd&gt; This sets the kernel's minimum, default, and maximum TCP receive buffer sizes. You might be surprised, seeing the maximum of 16M, that many Unix-like operating systems still have a maximum of 256K!&lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt&gt; net.ipv4.tcp_wmem="4096 65536 16777216" &lt;/dt&gt;&lt;dd&gt; A similar setting for the TCP send buffer. Note that the default value is a little lower. Don't worry about this, the send buffer size is less important than the receive buffer.&lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt&gt; net.ipv4.tcp_no_metrics_save=1&lt;br /&gt;&lt;/dt&gt;&lt;/dl&gt;Moreover, There are a couple of kernel value you should adjust&lt;br /&gt;tcp_max_syn_backlog&lt;br /&gt;somaxconn&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-3778641269299408448?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/3778641269299408448/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/tcpnetworking-tunning.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3778641269299408448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3778641269299408448'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/tcpnetworking-tunning.html' title='TCP/networking tunning'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-7634703046491960598</id><published>2010-01-04T17:29:00.001+07:00</published><updated>2010-02-11T16:05:34.109+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harddisk'/><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Hardisk upgrade/Replace</title><content type='html'>เปลี่ยน ฮาร์ดดิส ให้ลิกนุกซ์&lt;br /&gt;&lt;a href="http://www.losurs.org/docs/LDP/HOWTO/Hard-Disk-Upgrade/index.html"&gt;http://www.losurs.org/docs/LDP/HOWTO/Hard-Disk-Upgrade/index.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-7634703046491960598?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/7634703046491960598/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2010/01/hardisk-upgrade.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7634703046491960598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/7634703046491960598'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2010/01/hardisk-upgrade.html' title='Hardisk upgrade/Replace'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-4846883505985600878</id><published>2009-12-08T13:37:00.000+07:00</published><updated>2010-04-08T10:00:32.795+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu handy configuration and command after installation + apache PHP</title><content type='html'>Ubuntu&lt;br /&gt;&lt;br /&gt;configuration after setup.&lt;br /&gt;&lt;br /&gt;startup interface/fix ip on startup&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt; /etc/network/interfaces.&lt;/span&gt;&lt;br /&gt;iface eth1 inet static&lt;br /&gt;address 192.168.0.2&lt;br /&gt;netmask 255.255.255.0&lt;br /&gt;gateway 192.168.0.1&lt;br /&gt;&lt;br /&gt;set name server&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt; /etc/resolv.conf&lt;/span&gt;&lt;br /&gt;nameserver 204.11.126.131&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;install ssh for remote login&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt; openssh&lt;/span&gt;&lt;br /&gt;sudo apt-get install openssh-client openssh-server&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;adduser&lt;/span&gt;&lt;br /&gt;sudo adduser username&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;user / add/ super user (group admin)&lt;/span&gt; sodoer&lt;br /&gt;sudo adduser xeon&lt;br /&gt;sudo adduser xeon admin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;php5 + mysql &lt;/span&gt;&lt;br /&gt;sudo apt-get install&lt;br /&gt;&lt;ul&gt;&lt;li&gt;php5 &lt;/li&gt;&lt;li&gt;php5-cgi &lt;/li&gt;&lt;li&gt;php5-cli &lt;/li&gt;&lt;li&gt;php5-mysql &lt;/li&gt;&lt;li&gt;php5-memcache &lt;/li&gt;&lt;li&gt;php5-gd &lt;/li&gt;&lt;li&gt;php5-imagick &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;apache&lt;/span&gt;&lt;br /&gt;sudo apt-get install apache2-mpm-worker&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;remove service from startup&lt;/span&gt;&lt;br /&gt;update-rc.d -f apache2 remove&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;add service&lt;/span&gt;&lt;br /&gt;update-rc.d apache2 defaults&lt;br /&gt;&lt;br /&gt;&gt;more reading on services&lt;br /&gt;http://www.debuntu.org/how-to-manage-services-with-update-rc.d&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;NFS&lt;/span&gt; server&lt;br /&gt;sudo apt-get install nfs-kernel-server&lt;br /&gt;sudo /etc/init.d/nfs-kernel-server start&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&gt;/etc/exports&lt;br /&gt;/ubuntu  *(ro,sync,no_root_squash)&lt;br /&gt;/home    *(rw,sync,no_root_squash)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&gt;package management&lt;br /&gt;&lt;/span&gt;-install&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#apt-get install packagename &lt;/span&gt;&lt;br /&gt;-see update current version&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# apt-cache policy apache2&lt;/span&gt;&lt;br /&gt;apache2:&lt;br /&gt;Installed: 2.2.8-1ubuntu0.3&lt;br /&gt;Candidate: 2.2.8-1ubuntu0.14&lt;br /&gt;Version table:&lt;br /&gt; 2.2.8-1ubuntu0.14 0&lt;br /&gt;    500 http://th.archive.ubuntu.com hardy-updates/main Packages&lt;br /&gt;    500 http://security.ubuntu.com hardy-security/main Packages&lt;br /&gt;*** 2.2.8-1ubuntu0.3 0&lt;br /&gt;    100 /var/lib/dpkg/status&lt;br /&gt; 2.2.8-1 0&lt;br /&gt;    500 http://th.archive.ubuntu.com hardy/main Packages&lt;br /&gt;&lt;br /&gt;Remark&lt;br /&gt;*apache worker mpm not work with libapach2-php&lt;br /&gt;using fcgid mod and php cgi&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;*NFS add host to /etc/hosts.allow&lt;/span&gt;&lt;br /&gt;*snmpd change init opt /etc/default/snmpd&lt;br /&gt;*all rp_filter need to be disable&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-4846883505985600878?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/4846883505985600878/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2009/12/ubuntu-apache-php5-configuration-after.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4846883505985600878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/4846883505985600878'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2009/12/ubuntu-apache-php5-configuration-after.html' title='Ubuntu handy configuration and command after installation + apache PHP'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-3991818734990953669</id><published>2009-12-08T13:02:00.000+07:00</published><updated>2010-03-16T13:39:06.676+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to Monitor/manager software raid</title><content type='html'>&lt;span style="font-weight: bold;font-family:courier new;"&gt;# cat /proc/mdstat&lt;/span&gt;&lt;br /&gt;Personalities : [raid1]&lt;br /&gt;md1 : active raid1 sdb5[2] sda5[0]&lt;br /&gt;9767424 blocks [2/1] [U_]&lt;br /&gt;[=====&gt;...............]  recovery = 25.8% (2528512/9767424) finish=4.4min speed=27019K/sec&lt;br /&gt;&lt;br /&gt;md2 : active raid1 sdb6[1]&lt;br /&gt;19534912 blocks [2/1] [_U]&lt;br /&gt;&lt;br /&gt;md3 : active raid1 sdb8[1] sda8[0]&lt;br /&gt;44756992 blocks [2/2] [UU]&lt;br /&gt;&lt;br /&gt;md0 : active raid1 sdb1[1] sda1[0]&lt;br /&gt;64128 blocks [2/2] [UU]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;"&gt;# mdadm --detail /dev/md1&lt;/span&gt;&lt;br /&gt;/dev/md1:&lt;br /&gt;Version : 0.90&lt;br /&gt;Creation Time : Sat Jul  9 21:46:05 2005&lt;br /&gt;Raid Level : raid1&lt;br /&gt;Array Size : 9767424 (9.31 GiB 10.00 GB)&lt;br /&gt;Used Dev Size : 9767424 (9.31 GiB 10.00 GB)&lt;br /&gt;Raid Devices : 2&lt;br /&gt;Total Devices : 1&lt;br /&gt;Preferred Minor : 1&lt;br /&gt;Persistence : Superblock is persistent&lt;br /&gt;&lt;br /&gt;Update Time : Tue Dec  8 12:59:37 2009&lt;br /&gt;State : clean, degraded&lt;br /&gt;Active Devices : 1&lt;br /&gt;Working Devices : 1&lt;br /&gt;Failed Devices : 0&lt;br /&gt;Spare Devices : 0&lt;br /&gt;&lt;br /&gt;UUID : 5757d121:b65d61e8:0f50c7af:cbb83343&lt;br /&gt;Events : 0.367292852&lt;br /&gt;&lt;br /&gt;Number   Major   Minor   RaidDevice State&lt;br /&gt;0       8        5        0      active sync   /dev/sda5&lt;br /&gt;1       0        0        1      removed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Rebuild raid :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;"&gt;# mdadm --add /dev/md1 /dev/sdb5&lt;/span&gt;&lt;br /&gt;mdadm: re-added /dev/sdb5&lt;div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Mark device as faulty&lt;/span&gt;&lt;br /&gt;#mdadm --manage /dev/md0 --fail /dev/sda2&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Remove device from array&lt;/span&gt;&lt;br /&gt;#mdadm --remove /dev/md3 /dev/sb3&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Stop &amp;amp; remove raid &lt;/b&gt;&lt;/div&gt;&lt;div&gt;*please unmount all file system before stop / remove raid.&lt;/div&gt;&lt;div&gt;#mdadm --stop /dev/md2&lt;/div&gt;&lt;div&gt;#mdadm --zero-superblock /dev/sda2&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;----&lt;/div&gt;&lt;div&gt;Reference :&lt;br /&gt;&lt;a href="http://tldp.org/HOWTO/Software-RAID-0.4x-HOWTO.html#toc4"&gt;http://tldp.org/HOWTO/Software-RAID-0.4x-HOWTO.html#toc4&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tldp.org/HOWTO/Software-RAID-HOWTO-6.html"&gt;http://tldp.org/HOWTO/Software-RAID-HOWTO-6.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.sanitarium.net/golug/Linux_Software_RAID.html"&gt;http://www.sanitarium.net/golug/Linux_Software_RAID.html&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://blogama.org/node/1825"&gt;http://blogama.org/node/1825&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-3991818734990953669?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/3991818734990953669/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2009/12/monitoring-software-raid.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3991818734990953669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/3991818734990953669'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2009/12/monitoring-software-raid.html' title='How to Monitor/manager software raid'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2356241496239742837</id><published>2009-12-08T12:42:00.000+07:00</published><updated>2010-03-15T17:20:28.816+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to : Software Raid migration</title><content type='html'>Now use sfdisk to duplicate partitions from old drive to new drive:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#sfdisk -d /dev/sda | sfdisk /dev/sdb&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now use mdadm to create the raid arrays. We mark the first drive (sda) as "missing" so it doesn't wipe out our existing data:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now copy the remaining partitions. Be careful to match your md devices with your filesystem layout. This example is for my particular setup&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;mount /dev/md1 /mnt/var&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;cp -dpRx /var /mnt&lt;/span&gt;&lt;br /&gt;... repeat for remaining folder.&lt;br /&gt;&lt;br /&gt;Setting fstab, grub to boot from mdX&lt;br /&gt;&lt;br /&gt;Reboot&lt;br /&gt;&lt;br /&gt;At this point, you have all of your original data on the new drive, so we can safely add the original drive to the raid volume.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;mdadm --add /dev/md0 /dev/sda1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;mdadm --add /dev/md1 /dev/sda2&lt;/span&gt;&lt;br /&gt;... repeat for remaining partitions.&lt;br /&gt;&lt;br /&gt;Thanks to :&lt;br /&gt;&lt;a href="http://www.debian-administration.org/articles/238"&gt;http://www.debian-administration.org/articles/238&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2356241496239742837?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2356241496239742837/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2009/12/software-raid-migration.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2356241496239742837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2356241496239742837'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2009/12/software-raid-migration.html' title='How to : Software Raid migration'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6027410081979169343.post-2913655453106650321</id><published>2009-12-08T12:30:00.000+07:00</published><updated>2009-12-08T13:02:06.423+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='grub'/><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to : software raid GRUB + RAID</title><content type='html'>&lt;span style="font-weight: bold;"&gt;How to : software raid GRUB + RAID &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the Software RAID howto it is mentioned that it is not known how&lt;br /&gt;to set up GRUB to boot off RAID. Here is how I did it:&lt;br /&gt;**Follow at your own risk. If you break something it's your fault.**&lt;br /&gt;==================================================================&lt;br /&gt;Configuration:&lt;br /&gt;- /dev/hda (Pri. Master) 60 GB Seagate HDD (blank)&lt;br /&gt;- /dev/hdc (Sec. Master) 60 GB Seagate HDD (blank)&lt;br /&gt;- /dev/hdd (Sec. Slave) CDROM Drive&lt;br /&gt;&lt;br /&gt;Setup Goals:&lt;br /&gt;- /boot as /dev/md0: RAID1 of /dev/hda1 &amp;amp; /dev/hdc1 for redundancy&lt;br /&gt;- /     as /dev/md1: RAID1 of /dev/hda2 &amp;amp; /dev/hdc2 for redundancy&lt;br /&gt;- swap*2 with equal priority: /dev/hda3 &amp;amp; /dev/hdc3 for more speed&lt;br /&gt;- GRUB installed in boot records of /dev/hda and /dev/hdc so either&lt;br /&gt;drive can fail but system still boot.&lt;br /&gt;&lt;br /&gt;Tools:&lt;br /&gt;- mdadm (http://www.cse.unsw.edu.au/~neilb/source/mdadm/)&lt;br /&gt;(I used 1.2.0, but notice that as of 20030729 1.3.0 is available)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. Boot up off rescue/installation CD/disk/HDD/whatever with mdadm&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;tools installed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. Partitioning of hard drives:&lt;/span&gt;&lt;br /&gt;(I won't show you how to do this. See: # man fdisk ; man sfdisk )&lt;br /&gt;But here's how stuff was arranged:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# sfdisk -l /dev/hda&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Disk /dev/hda: 7297 cylinders, 255 heads, 63 sectors/track&lt;br /&gt;Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting&lt;br /&gt;from 0&lt;br /&gt;&lt;br /&gt;Device Boot Start   End  #cyls   #blocks  Id System&lt;br /&gt;/dev/hda1  *      0+   16     17-   136521  fd Linux raid autodetect&lt;br /&gt;/dev/hda2        17  7219   7203  57858097+ fd Linux raid autodetect&lt;br /&gt;/dev/hda3      7220  7296     77    618502+ 82 Linux swap&lt;br /&gt;/dev/hda4         0     -      0         0   0 Empty&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;To make /dev/hdc the same:&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# sfdisk -d /dev/hda | sfdisk /dev/hdc&lt;/span&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;/dev/hd[ac]1 for /dev/md0 for /boot&lt;br /&gt;/dev/hd[ac]2 for /dev/md1 for /&lt;br /&gt;/dev/hd[ac]3 for 2*swap&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;It is important to make md-to-be partitions with ID 0xFD, not 0x83.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3. Set up md devices: (both are RAID1 [mirrors])&lt;/span&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# mdadm --create /dev/md0 --level=1 \&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    --raid-devices=2 /dev/hda1 /dev/hdc1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# mdadm --create /dev/md1 --level=1 \&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    --raid-devices=2 /dev/hda2 /dev/hdc2&lt;/span&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;•    สร้าง metadevice ด้วยคำสั่ง cd /dev &amp;amp;&amp;amp; MAKEDEV md&lt;br /&gt;(หรือทำเอง mknod /dev/md1 b 9 1 )&lt;br /&gt;•    กำหนด raid ด้วยคำสั่ง&lt;br /&gt;◦    mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1&lt;br /&gt;◦    mdadm --create --verbose /dev/md5 --level=1 --raid-devices=2 /dev/sda5 /dev/sdb5&lt;br /&gt;◦    mdadm --create --verbose /dev/md6 --level=1 --raid-devices=2 /dev/sda6 /dev/sdb6&lt;br /&gt;&lt;br /&gt;รอให้สร้าง raid เสร็จก่อนด้วย คำสั่ง cat /proc/mdstat&lt;br /&gt;&lt;br /&gt;หมายเหตุ ถ้ามีการ create แล้วให้ใช้ mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4. Make filesystems:&lt;/span&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# mke2fs /dev/md0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# mkreiserfs /dev/md1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# mkswap /dev/hda3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# mkswap /dev/hdc3&lt;/span&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5. Install Your distribution:&lt;/span&gt;&lt;br /&gt;Simply treat /dev/md0 and /dev/md1 as the partitions to install on,&lt;br /&gt;and install the way your normally do.&lt;br /&gt;&lt;br /&gt;Here're the relevant entries /etc/fstab for the newly created&lt;br /&gt;partitions:&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;/dev/md0      /boot        ext2       noauto,noatime          1 1&lt;br /&gt;/dev/md1      /        reiserfs       noatime                 1 1&lt;br /&gt;/dev/hda3     none         swap       sw,pri=1                0 0&lt;br /&gt;/dev/hdc3     none         swap       sw,pri=1                0 0&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;The "pri=1" for each of the swap partitions makes them the same&lt;br /&gt;priority so the kernel does striping and that speeds up vm. Of&lt;br /&gt;course, this means that if a disk dies then the system may crash,&lt;br /&gt;needing a reboot. Perhaps it would be wiser to make hd[ac]3 a RAID1&lt;br /&gt;array too, and just use /dev/md2 as swap.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;6. Setting up GRUB: (assuming you've already installed it)&lt;/span&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# grub&lt;/span&gt;&lt;br /&gt;grub&gt; root (hd0,0)&lt;br /&gt;Filesystem type is ext2fs, partition type 0xfd&lt;br /&gt;&lt;br /&gt;grub&gt; setup (hd0)&lt;br /&gt;Checking if "/boot/grub/stage1" exists... yes&lt;br /&gt;Checking if "/boot/grub/stage2" exists... yes&lt;br /&gt;Checking if "/boot/grub/e2fs_stage1_5" exists... yes&lt;br /&gt;Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  16 sectors are&lt;br /&gt;embedded.&lt;br /&gt;succeeded&lt;br /&gt;Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p&lt;br /&gt;(hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded&lt;br /&gt;Done.&lt;br /&gt;&lt;br /&gt;grub&gt; root (hd1,0)&lt;br /&gt;Filesystem type is ext2fs, partition type 0xfd&lt;br /&gt;&lt;br /&gt;grub&gt; setup (hd1)&lt;br /&gt;Checking if "/boot/grub/stage1" exists... yes&lt;br /&gt;Checking if "/boot/grub/stage2" exists... yes&lt;br /&gt;Checking if "/boot/grub/e2fs_stage1_5" exists... yes&lt;br /&gt;Running "embed /boot/grub/e2fs_stage1_5 (hd1)"...  16 sectors are&lt;br /&gt;embedded.&lt;br /&gt;succeeded&lt;br /&gt;Running "install /boot/grub/stage1 (hd1) (hd1)1+16 p&lt;br /&gt;(hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded&lt;br /&gt;Done.&lt;br /&gt;&lt;br /&gt;grub&gt; quit&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;Here is how /boot/grub/grub.conf is: (/dev/md0 mounted as /boot)&lt;br /&gt;(Assuming kernel is installed as /boot/bzImage, and RAID1 support&lt;br /&gt;compiled into the kernel).&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;# Boot automatically after 30 secs.&lt;br /&gt;timeout 30&lt;br /&gt;&lt;br /&gt;# By default, boot the first entry.&lt;br /&gt;default 0&lt;br /&gt;&lt;br /&gt;# Fallback to the second entry.&lt;br /&gt;fallback 1&lt;br /&gt;&lt;br /&gt;# For booting with disc 0 kernel&lt;br /&gt;title  GNU/Linux (hd0,0)&lt;br /&gt;kernel (hd0,0)/bzImage root=/dev/md1&lt;br /&gt;&lt;br /&gt;# For booting with disc 1 kernel, if (hd0,0)/bzImage is unreadable&lt;br /&gt;title  GNU/Linux (hd1,0)&lt;br /&gt;kernel (hd1,0)/bzImage root=/dev/md1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://www.linuxsa.org.au/mailing-list/2003-07/1270.html&lt;br /&gt;http://en.gentoo-wiki.com/wiki/RAID/Software&lt;br /&gt;http://www.geisterstunde.org/drupal/?q=raid1&lt;br /&gt;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6027410081979169343-2913655453106650321?l=handylinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://handylinux.blogspot.com/feeds/2913655453106650321/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://handylinux.blogspot.com/2009/12/grub-software-raid-linux.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2913655453106650321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6027410081979169343/posts/default/2913655453106650321'/><link rel='alternate' type='text/html' href='http://handylinux.blogspot.com/2009/12/grub-software-raid-linux.html' title='How to : software raid GRUB + RAID'/><author><name>sapparod</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
