<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>MDLog:/sysadmin &#187; RHEL</title> <atom:link href="http://www.ducea.com/category/linux/rhel/feed/" rel="self" type="application/rss+xml" /><link>http://www.ducea.com</link> <description>The Journal Of A Linux Sysadmin</description> <lastBuildDate>Tue, 07 Feb 2012 19:40:06 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>Build your own packages easily with FPM</title><link>http://www.ducea.com/2011/08/31/build-your-own-packages-easily-with-fpm/</link> <comments>http://www.ducea.com/2011/08/31/build-your-own-packages-easily-with-fpm/#comments</comments> <pubDate>Wed, 31 Aug 2011 22:13:02 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[deb]]></category> <category><![CDATA[debian_packages]]></category> <category><![CDATA[FPM]]></category> <category><![CDATA[rpm]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=1369</guid> <description><![CDATA[Building packages is a task that every system administrator will end up doing. Most of the time this is not a very interesting task but someone has to do it, right? Normally you will end up modifying and tweaking based on your own needs an existing package that was built by the maintainers of the [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p><strong>Building packages</strong> is a task that every system administrator will end up doing. Most of the time this is not a very interesting task but someone has to do it, right? Normally you will end up modifying and tweaking based on your own needs an existing package that was built by the maintainers of the Linux distribution that you are using. In time you might even become familiar with the packaging system you are using (rpm, deb, etc.) and you will be able to write a spec file and start from scratch and build a new package if you need to. Still, this <em>process is complicated and requires a lot of work</em>.</p><p>Luckily, <strong><a
href="http://www.semicomplete.com/blog" target="_blank">Jordan Sissel</a></strong> has built a tool called <strong><a
href="https://github.com/jordansissel/fpm" target="_blank">FPM</a></strong> (Effing Package Management), exactly for this: to ease the pain of building new packages; packages that you will use for your own infrastructure and you want them customized based on your own needs; and you don&#8217;t care about upstream rules and standards and other limitations when building such packages. This can be very useful for people deploying their own applications as rpms (or debs) and can simplify a lot of the process of building those packages.</p><p>FPM can be easily installed on your build system using rubygems:<br
/> <code>gem install fpm</code></p><p>Once installed you can use fpm to build <strong>packages</strong> (targets):</p><ul><li>deb</li><li>rpm</li><li>solaris</li></ul><p>from any of the following <strong>sources</strong>:</p><ul><li>directory (of compiled source of some application)</li><li>gem</li><li>python eggs</li><li>rpm</li><li>node npm packages</li></ul><p><span
id="more-1369"></span>Use the command line help (fpm &#8211;help) or the <a
href="https://github.com/jordansissel/fpm/wiki" target="_blank">wiki</a> to see full details on how to use it. I&#8217;ll show some simple examples on how to build some packages from various input sources that I&#8217;ve found useful myself.</p><h3>1. Package a directory &#8211; output of a &#8216;make install&#8217; command</h3><p>This is how you would usually package an application that you would install with:<br
/> <em>./configure; make; make install</em><br
/> For example, here is how you can create an rpm of the latest version of memcached:<br
/> <code>wget http://memcached.googlecode.com/files/memcached-1.4.7.tar.gz<br
/> tar -zxvf memcached-1.4.7.tar.gz<br
/> cd memcached-1.4.7<br
/> ./configure --prefix=/usr<br
/> make</code><br
/> so far everything looks like a normal manual installation (that would be followed by make install). Still we will now install it in a separate folder so we can capture the output:<br
/> <code>mkdir /tmp/installdir<br
/> make install DESTDIR=/tmp/installdir</code><br
/> and finally using fpm to create the rpm package:<br
/> <code>fpm -s dir -t rpm -n memcached -v 1.4.7 -C /tmp/installdir</code><br
/> where <strong>-s</strong> is the input source type (directory), <strong>-t</strong> is the type of package (rpm), <strong>-n</strong> in the name of the package and <strong>-v</strong> is the version; <strong>-C</strong> is the directory where fpm will look for the files.<br
/> Note: you might need to install various libraries to build your package; for ex. in this case I had to install libevent-dev.</p><p>If you are packaging your own application you can do this just by pointing to your build folder and set the version of the app. Here is an example for an deb package:<br
/> <code>fpm -s dir -t deb -n myapp -v 0.0.1 -C /build/myapp/0.0.1/</code></p><p>There are various other parameters that you can use but basically this is how simple it is to build a package from a directory.<br
/> Here is an example on how to define some dependencies on the package you are building (using <strong>-d</strong>; repeat it as many times as needed):<br
/> <code>fpm -s dir -t deb -n memcached -v 1.4.7 -C /tmp/installdir \<br
/> -d "libstdc++6 (&gt;= 4.4.5)" \<br
/> -d "libevent-1.4-2 (&gt;= 1.4.13)"</code></p><h3>2. Ruby gems or python egg &#8211; converted to packages</h3><p>You can create a deb or rpm from a gem very simple with fpm:<br
/> <code>fpm -s gem -t deb &lt;gem_name&gt;</code><br
/> this will download the gem and create a package named rubygem-&lt;gem_name&gt;<br
/> For example:<br
/> <code>fpm -s gem -t deb fpm</code><br
/> will create a debian package for fpm: rubygem-fpm_0.3.7_all.deb</p><p>You can inspect it with<em> dpkg &#8211;info</em> and you can notice that in this case it will fill nicely all the fields with the maintainer, and dependencies on various other gems. Very cool.</p><p>If you use python and want to package various python eggs this will work exactly the same and you will use -s python (it will download the python packages with easy_install first).</p><p>Overall <strong>FPM</strong> is a great tool and can help you<span
style="text-decoration: underline;"><em> simplify the way you are building your own packages</em></span>. Check it out and let me know what you think and if you found it useful. And if you found this useful don’t forget to thank <strong><a
href="http://www.twitter.com/jordansissel" target="_blank">Jordan</a></strong> for his great work on this awesome tool.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2011/08/31/build-your-own-packages-easily-with-fpm/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Apache2 umask</title><link>http://www.ducea.com/2009/08/03/apache2-umask/</link> <comments>http://www.ducea.com/2009/08/03/apache2-umask/#comments</comments> <pubDate>Mon, 03 Aug 2009 23:21:49 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Tips & Tricks]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[apache-tips-and-tricks]]></category> <category><![CDATA[tips]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=951</guid> <description><![CDATA[Many times you might want to fine tune the default permissions of the files created on a linux system. This is very simple and usually if you are using bash all you have to do is to define somewhere in the bash startup files (/etc/profile is a good place for this) a new value for [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p>Many times you might want to fine tune the <strong>default permissions</strong> of the files created on a linux system. This is very simple and usually if you are using <strong>bash</strong> all you have to do is to define somewhere in the bash startup files (<em>/etc/profile</em> is a good place for this) a new value for <strong>umask</strong> like this:<br
/> <code>umask 002</code><br
/> (this will allow by default group write permissions on the newly created files)</p><p>Normally on modern linux distributions this is by <em>default set to 022</em> and you can easily find out what it is on your system by running the umask command:<br
/> <code>umask</code></p><p>Contrary to what you might think, this is not enough to have this working for all applications and daemons on the system. This works fine for any files created from a shell session, but the files created by other processes, like the web server for example, will still use the default, unless otherwise configured. In order to have <strong>apache</strong> use a <strong>different umask</strong> we can define this inside <strong>/etc/apache2/envvars</strong> (debian, and ubuntu systems) or /etc/sysconfig/httpd (rhel,centos systems) like this:<br
/> <code>umask 002</code><br
/> and restart apache to enable it.</p><p>Other daemons will have different locations where you can define this to overwrite the default setting for umask (check their documentation if you are unsure).</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2009/08/03/apache2-umask/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>PHP Sessions in Memcached</title><link>http://www.ducea.com/2009/06/02/php-sessions-in-memcached/</link> <comments>http://www.ducea.com/2009/06/02/php-sessions-in-memcached/#comments</comments> <pubDate>Tue, 02 Jun 2009 10:15:34 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Scaling]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[memcached]]></category> <category><![CDATA[pecl]]></category> <category><![CDATA[php5]]></category> <category><![CDATA[php_extensions]]></category> <category><![CDATA[php_modules]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=903</guid> <description><![CDATA[The moment a PHP application grows to run on more servers, normally people will see problems caused by PHP sessions. If the application is not persistent you are lucky and don&#8217;t care about this, but if not you will quickly see this regardless of how good the load balancer you use is handling stickiness (sending [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p>The moment a <em>PHP application grows to run on more servers</em>, normally people will see problems caused by <strong>PHP sessions</strong>. If the application is not persistent you are lucky and don&#8217;t care about this, but if not you will quickly see this regardless of how good the load balancer you use is handling stickiness (sending the users to the same real server), this will slowly become a major issue. There are various solutions that can be used to store PHP sessions in a <strong>shared location</strong>, but I want to present today one solution that is very simple to implement, yet very efficient and on the long term better suited than using a database backend for this: using <a
href="http://danga.com/memcached" target="_blank"><strong>memcache</strong></a> to store the sessions.</p><p>The <a
href="http://pecl.php.net/package/memcache" target="_blank">pecl memcache php extension</a> has supported for a long time the memcache session.save_handler, but with the release <strong>3.0.x</strong> (still in beta at this time) this brings in a set of interesting <a
href="http://pecl.php.net/package/memcache/3.0.0" target="_blank">features</a> for us:<br
/> - UDP support<br
/> - Binary protocol support<br
/> - Non-blocking IO using select()<br
/> - Key and session redundancy (values are written to N mirrors)<br
/> - Improved error reporting and failover handling</p><p><span
id="more-903"></span>Installing the php memcache module is very simple and can be done either by using distribution repositories (the version we want to use 3.0.x will probably not be available) or by using pecl or manual compilation:</p><p>Using pecl:<br
/> <code>pecl install memcache-3.0.4</code></p><p>or manually:<br
/> <code>wget http://pecl.php.net/get/memcache-3.0.4.tgz<br
/> tar xvfz memcache-3.0.4.tgz<br
/> cd memcache-3.0.4<br
/> phpize<br
/> ./configure<br
/> make<br
/> make install</code></p><p>Finally, we need to <em>activate the module in php.ini</em>. I normally prefer to create a new file for this <strong>memcache.ini</strong> inside the include directory of the php build (for ex. in debian this is under <strong>/etc/php5/conf.d/memcache.ini</strong>) like this:<br
/> <code>extension=memcache.so<br
/> memcache.allow_failover = 1<br
/> memcache.redundancy = 1<br
/> memcache.session_redundancy = 2</code></p><p>To use memcached to store the <strong>php sessions</strong> we will have to edit php.ini and replace the default file handler settings with something like:<br
/> <code>; Use memcache as a session handler<br
/> session.save_handler = memcache<br
/> ; Use a comma separated list of server urls to use for storage:<br
/> session.save_path="udp://&lt;memcache_server&gt;:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15"</code></p><p>or if we don&#8217;t want to use this serverwide, we can just define it inside a php block like this:</p><pre><code>$session_save_path = "tcp://&lt;memcache_server1&gt;:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15, tcp://&lt;memcache_server2&gt;:11211";
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', $session_save_path);</code></pre><p>Note: as you can see I used in the above example tcp and udp also. Please be sure that your memcached server has udp support enabled if you want to use that. Also ensure that the web server can connect to the memcache server/port (use proper firewall rules to allow this) in order for this to work.</p><p>After restarting apache, it will start using memcache to store the php sessions. If redundancy is needed (why not?) we will probably want to use the internal php memcache support to save the sessions to more servers, or if you prefer you can use an external solution to replicate the memcached server data &#8211; <a
href="http://repcached.lab.klab.org/" target="_blank">repcached</a>.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2009/06/02/php-sessions-in-memcached/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>iopp: howto get i/o information per process</title><link>http://www.ducea.com/2009/03/09/iopp-howto-get-io-information-per-process/</link> <comments>http://www.ducea.com/2009/03/09/iopp-howto-get-io-information-per-process/#comments</comments> <pubDate>Mon, 09 Mar 2009 10:30:16 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[iopp]]></category> <category><![CDATA[vmstat]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=712</guid> <description><![CDATA[We all know and love vmstat, but wouldn&#8217;t it be nice to get such information on a per process basis, to be able to better understand what is causing i/o problems? This is exactly what iopp, written by Mark Wong and released as open source does: &#8220;It&#8217;s a custom tool to go through the Linux [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p>We all know and love <strong>vmstat</strong>, but wouldn&#8217;t it be nice to get such information on a <strong>per process</strong> basis, to be able to better understand what is causing <strong>i/o</strong> problems? This is exactly what <strong>iopp</strong>, written by <em>Mark Wong</em> and released as open source does:<br
/> <em>&#8220;It&#8217;s a custom tool to go through the Linux process table to get i/o statistics per process. It is open source and can be downloaded from: <a
href="http://git.postgresql.org/?p=~markwkm/iopp.git;a=summary" target="_blank">http://git.postgresql.org/?p=~markwkm/iopp.git;a=summary</a>&#8220;</em></p><p>Now this sounds interesting, and I am sure anyone that has dealt with i/o issues in the past will probably find this very useful. Let&#8217;s see how we can <strong>install </strong>it and what kind of reporting we get. We will install this from source and here are some quick steps to do this (you will need git and cmake for this):<br
/> <code>git clone git://git.postgresql.org/git/~markwkm/iopp.git<br
/> cd iopp<br
/> cmake CMakeLists.txt<br
/> make</code></p><p><span
id="more-712"></span>And install it:<br
/> <code>make install DESTDIR=/usr<br
/> [100%] Built target iopp<br
/> Install the project...<br
/> -- Install configuration: ""<br
/> -- Installing /usr/bin/iopp<br
/> -- Installing /usr/share/man/man8/iopp.8</code><br
/> after this <strong>iopp </strong>will be installed into <strong>/usr/bin</strong>.</p><p>Let&#8217;s see what are the program parameters:<br
/> <code>iopp -h<br
/> usage: iopp -h|--help<br
/> usage: iopp [-ci] [-k|-m] [delay [count]]<br
/> -c, --command display full command line<br
/> -h, --help display help<br
/> -i, --idle hides idle processes<br
/> -k, --kilobytes display data in kilobytes<br
/> -m, --megabytes display data in megabytes<br
/> -u, --human-readable display data in kilo-, mega-, or giga-bytes</code></p><p>And finally let&#8217;s test it:<br
/> <code>iopp -i -u 5<br
/> pid rchar wchar    syscr    syscw reads writes cwrites command<br
/> 2464    0B    0B        0        0    0B  8192B      0B kjournald<br
/> 3364  515K    0B     1336        0    0B     0B      0B mysqld<br
/> 4664    0B  134B        0        4    0B     0B      0B apache2<br
/> 4685  803K  114K      454       80    0B     0B      0B collectd<br
/> 20758   82K   82K      329      329    0B    84K      0B cronolog<br
/> 26236   67K 3754B       59       27    0B     0B      0B apache2<br
/> ...</code></p><p>The manual page explains each output field:</p><ul><li> <strong>pid</strong>: The process id.</li><li> <strong>rchar</strong>: The number of bytes which this task has caused to be read from storage.</li><li> <strong>wchar</strong>: The number of bytes which this task has caused, or shall cause to be written to disk.</li><li> <strong>syscr</strong>: Count of the number of read I/O operations.</li><li> <strong>syscw</strong>: Count of the number of write I/O operations.</li><li> <strong>rbytes rkb rmb reads</strong>: Count of the number of bytes which this process really did cause to be fetched from the storage layer.</li><li> <strong>wbytes wkb wmb writes</strong>: Count of the number of bytes which this process really did cause to be sent to the storage layer.</li><li> <strong>cwbytes cwkb cwmb cwrites</strong>: The number of bytes which this process caused to not happen, by truncating pagecache.</li><li> <strong>command</strong>: Filename of the executable.</li></ul><p>Other similar tools are <strong><a
href="http://guichaz.free.fr/iotop/" target="_blank">iotop</a> </strong>and <strong>pidstat </strong>from newer <strong>sysstat </strong>packages and I will describe them in a future post.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2009/03/09/iopp-howto-get-io-information-per-process/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Mdadm Cheat Sheet</title><link>http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/</link> <comments>http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/#comments</comments> <pubDate>Sun, 08 Mar 2009 11:19:20 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Tips & Tricks]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[cheatsheet]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[raid]]></category> <category><![CDATA[tips]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=691</guid> <description><![CDATA[Mdadm is the modern tool most Linux distributions use these days to manage software RAID arrays; in the past raidtools was the tool we have used for this. This cheat sheet will show the most common usages of mdadm to manage software raid arrays; it assumes you have a good understanding of software RAID and [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p><strong>Mdadm </strong>is the modern tool most Linux distributions use these days to manage <strong>software RAID</strong> arrays; in the past <em>raidtools </em>was the tool we have used for this. This cheat sheet will show the most <em>common usages of mdadm</em> to manage software raid arrays; it assumes you have a good understanding of software RAID and Linux in general, and it will just explain the commands line usage of mdadm. The examples bellow use RAID1, but they can be adapted for any RAID level the Linux kernel driver supports.</p><h3>1. Create a new RAID array</h3><p>Create (mdadm &#8211;create) is used to create a new array:<br
/> <code>mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2</code><br
/> <span
id="more-691"></span>or using the compact notation:<br
/> <code>mdadm -Cv /dev/md0 -l1 -n2 /dev/sd[ab]1</code></p><h3>2. /etc/mdadm.conf</h3><p>/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:<br
/> <code>mdadm --detail --scan &gt;&gt; /etc/mdadm.conf</code><br
/> or on debian<br
/> <code>mdadm --detail --scan &gt;&gt; /etc/mdadm/mdadm.conf</code></p><h3>3. Remove a disk from an array</h3><p>We can&#8217;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):<br
/> <code>mdadm --fail /dev/md0 /dev/sda1</code><br
/> and now we can remove it:<br
/> <code>mdadm --remove /dev/md0 /dev/sda1</code></p><p>This can be done in a single step using:<br
/> <code>mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1</code></p><h3>4. Add a disk to an existing array</h3><p>We can add a new disk to an array (replacing a failed one probably):<br
/> <code>mdadm --add /dev/md0 /dev/sdb1</code></p><h3>5. Verifying the status of the RAID arrays</h3><p>We can check the status of the arrays on the system with:<br
/> <code>cat /proc/mdstat</code><br
/> or<br
/> <code>mdadm --detail /dev/md0</code></p><p>The output of this command will look like:</p><pre><code>cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]

md1 : active raid1 sdb3[1] sda3[0]
19542976 blocks [2/2] [UU]

md2 : active raid1 sdb4[1] sda4[0]
223504192 blocks [2/2] [UU]</code></pre><p>here we can see both drives are used and working fine &#8211; <strong>U</strong>. A failed drive will show as <strong>F</strong>, while a degraded array will miss the second disk <strong>-</strong></p><p>Note: while monitoring the status of a RAID rebuild operation using watch can be useful:<br
/> <code>watch cat /proc/mdstat</code></p><h3>6. Stop and delete a RAID array</h3><p>If we want to completely remove a raid array we have to stop if first and then remove it:<br
/> <code>mdadm --stop /dev/md0<br
/> mdadm --remove /dev/md0</code><br
/> and finally we can even delete the superblock from the individual drives:<br
/> <code>mdadm --zero-superblock /dev/sda</code></p><p>Finally in using RAID1 arrays, where we create <strong>identical partitions</strong> on both drives this can be useful to copy the partitions from sda to sdb:<br
/> <code>sfdisk -d /dev/sda | sfdisk /dev/sdb</code></p><p>(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).</p><p>There are many other usages of <strong>mdadm </strong>particular for each type of RAID level, and I would recommend to use the manual page (<em>man mdadm</em>) or the help (<em>mdadm &#8211;help</em>) if you need more details on its usage. Hopefully these quick examples will put you on the fast track with how mdadm works.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/feed/</wfw:commentRss> <slash:comments>58</slash:comments> </item> <item><title>HowTo force remote devices (routers/switches) to refresh their arp cache entry for a machine</title><link>http://www.ducea.com/2009/03/06/howto-force-remote-devices-routersswitches-to-refresh-their-arp-cache-entry-for-a-machine/</link> <comments>http://www.ducea.com/2009/03/06/howto-force-remote-devices-routersswitches-to-refresh-their-arp-cache-entry-for-a-machine/#comments</comments> <pubDate>Fri, 06 Mar 2009 20:02:14 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Tips & Tricks]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[arp]]></category> <category><![CDATA[arping]]></category> <category><![CDATA[router]]></category> <category><![CDATA[switch]]></category> <category><![CDATA[tips]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=679</guid> <description><![CDATA[The Address Resolution Protocol (ARP) is the method for finding a host&#8217;s link layer (hardware) address when only its Internet Layer (IP) or some other Network Layer address is known. ARP is a Link Layer protocol (Layer 2) because it only operates on the local area network or point-to-point link that a host is connected [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p>The <strong><a
href="http://en.wikipedia.org/wiki/Address_Resolution_Protocol" target="_blank">Address Resolution Protocol</a> (ARP)</strong> is the method for finding a host&#8217;s link layer (hardware) address when only its Internet Layer (IP) or some other Network Layer address is known. ARP is a Link Layer protocol (Layer 2) because it only operates on the local area network or point-to-point link that a host is connected to. When we <strong>migrate one IP</strong> from a machine to another one, we might have problems caused by &#8216;<strong>arp caching</strong>&#8216;. Various devices will cache the arp information for a specified amount of time and even after we moved the IP this will not be seen by some devices that will still use the cached information. I am talking about directly connected <strong>switches or routers</strong>, that we might have control or maybe not. If we have control on all the external devices, normally we just connect to the router or switch and remove the arp entry, forcing the device to query again for the information. This post will try to help in the situation where<em> we <strong>don&#8217;t </strong>have direct control on the external devices </em>(we are collocated or use rented servers in a remote datacenter, etc.), to <strong>minimize the downtime</strong> associated with this type of IP migration.</p><p>It is quite frequent to use separate IPs for various services on the same machine, and move those IPs to another server if needed. These are sometimes called <strong>portable IPs</strong> that can be migrated to any server in a particular colo/lan. This is done normally to minimized downtime and keep maintenance of such operations minimal (and to not rely on dns changes). Still <strong>arp caching</strong> on various network devices can cause big problems. Let&#8217;s assume we moved the IP from one server to another one in the same LAN to move away some service from our main web server. Taking down the IP from the existing server and bringing it up on the new server will complete our direct work if we don&#8217;t have access on the switches/routers in front of us. <em>Again if you have control on all devices just connect to them and delete the arp cache for this ip to allow it to be re-cached on the new machine.</em></p><p><span
id="more-679"></span>So after we have the IP moved on the new machine and now have to wait&#8230; The arp cache depends on the actual devices and can be anything from <em>5 minutes to not expire</em>. Let&#8217;s assume for this example that the ip is <em>192.168.0.101</em> and after we run <strong>ifup </strong>and <strong>ifdown </strong>we have the IP correctly showing on the new server, <em>srv02</em>. If we don&#8217;t want to wait helpless for this to happen automatically, the solution is to <strong>broadcast </strong>from our new machine the arp with the source of the IP. Hopefully this will make the remote device to verify and invalidate its existing cache entry. For this we can use <strong>arping</strong>; installation is simple as it should be in most modern linux distributions by default. On debian you would install arping just by running:<br
/> <code>aptitude install arping</code><br
/> finally we use a command like:<br
/> <code>arping -S &lt;our_IP&gt; -B</code><br
/> that will <strong>broadcast </strong>our source IP and direct it to the broadcast address (255.255.255.255) . If your arp command uses different parameters notations, you should looks for something similar (to set the source and ping the broadcast). In our example with the IP 192.168.0.101 we would use:<br
/> <code>srv02:~# arping -S 192.168.0.101 -B<br
/> ARPING 255.255.255.255<br
/> --- 255.255.255.255 statistics ---<br
/> 16 packets transmitted, 0 packets received, 100% unanswered</code><br
/> (stop it with CTRL-C once it is working).</p><p>Normally after this, all should be ok and the remote device should <strong>cache the new arp entry</strong>, invalidating the existing cached one. If this is not the case, then call your datacenter to minimize the downtime <img
src='http://www.ducea.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . I would always suggest testing this first and seeing what downtime to expect and if you can minimize it like this with <strong>arping</strong>, first try with a non-production test IP. Don&#8217;t do this with live, production IP/service until you know what to expect. I hope this post will help you if you will have to deal with a similar situation. If this doesn’t work as expected in your case, please let us know what devices you found problematic, and if you were able to use a different workaround.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2009/03/06/howto-force-remote-devices-routersswitches-to-refresh-their-arp-cache-entry-for-a-machine/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>HowTo ignore some files/folders from awstats reports</title><link>http://www.ducea.com/2009/02/09/howto-ignore-some-filesfolders-from-awstats-reports/</link> <comments>http://www.ducea.com/2009/02/09/howto-ignore-some-filesfolders-from-awstats-reports/#comments</comments> <pubDate>Mon, 09 Feb 2009 12:14:42 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[News from Outside]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[awstats]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=565</guid> <description><![CDATA[Awstats will consider as a page hit any entry from the log it processes. By default some file extensions (for regular image types and css/js) are excluded from what awstats will consider as a page: NotPageList="css js class gif jpg jpeg png bmp ico"(this is the default). All other file types will be counted as [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p><strong>Awstats </strong>will consider as a page hit any entry from the log it processes. <em>By default some file extensions</em> (for regular image types and css/js) are excluded from what awstats will consider as a page:<br
/> <code>NotPageList="css js class gif jpg jpeg png bmp ico"</code>(this is the default). All other file types will be counted as pages. Now, if we want to completely ignore some files, or even all the content of one folder from the awstats processing we can use the <strong>SkipFiles </strong>parameter. We might want to do this to ignore some frames, hidden pages, ajax calls, etc.</p><p><span
id="more-565"></span>The <strong>SkipFiles </strong>parameter is <em>by default empty</em>, and in order to use it we have to add the appropriate config in our <em>awstats.conf</em> file.  For example to ignore a file called <em>somefile.php</em> we will add <em>&#8220;/somefile.php</em>&#8220;:<br
/> <code>SkipFiles="/somefile.php"</code><br
/> while if we want to ignore all the pages in a folder called <em>somefolder </em>we will have to use a regex value like: <em>&#8220;REGEX[^\/somefolder]&#8220;</em><br
/> We can add several rules separated by spaces:<br
/> <code>SkipFiles="/somefile.php REGEX[^\/somefolder]"</code></p><p><em>Note</em>: this will be effective only for <strong>new updates</strong>; meaning existing data will not be affected by this (if really needed you will have to regenerate your stats to get rid of those pages in old stats).</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2009/02/09/howto-ignore-some-filesfolders-from-awstats-reports/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Sendmail Multiple Queues</title><link>http://www.ducea.com/2008/08/19/sendmail-multiple-queues/</link> <comments>http://www.ducea.com/2008/08/19/sendmail-multiple-queues/#comments</comments> <pubDate>Tue, 19 Aug 2008 12:00:05 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[Fedora]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[sendmail]]></category> <category><![CDATA[tuning]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=300</guid> <description><![CDATA[Sendmail will use by default a single mail queue. This is what most users will need, and if you don&#8217;t have any special requirement you will not care about this. Still for high traffic mail servers it might be useful to split the queue over several directories, as thousands of files in a single directory [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p><strong>Sendmail </strong>will use by default <strong>a single mail queue</strong>. This is what most users will need, and if you don&#8217;t have any special requirement you will not care about this. Still for high traffic mail servers it might be useful to <em>split the queue over several directories</em>, as thousands of files in a single directory will become a performance penalty at some point and also processing the queue sequentially will become very slow. <em>This post will show how we can implement multiple mail queues with modern sendmail versions</em>.</p><p><span
id="more-300"></span>Let&#8217;s start by assuming we want to use <strong>8 mail queues</strong>. First thing is to <strong>create the actual directories</strong> as sendmail will not do this by default:<br
/> <code>mkdir /var/spool/mqueue/q{1,2,3,4,5,6,7,8}</code><br
/> And fix the permissions to the ones of the original folder /var/spool/mqueue. For ex. this might look like:<br
/> <code>chown -R smmta:smmsp /var/spool/mqueue/q*</code><br
/> using a default sendmail install running on debian. Fix the users to the specific ones found on your system (ls -al /var/spool/mqueue if you are uncertain of this).</p><p>Next, we need to <strong>enable the multiple queues in the sendmail configuration</strong>. For this we will edit <strong>sendmail.mc</strong> (normally found under /etc/mail) and append one line:<br
/> <code>define(`QUEUE_DIR', `/var/spool/mqueue/q*')dnl</code><br
/> and now regenerate <strong>sendmail.cf</strong>; this is done normally running:<br
/> <code>m4 sendmail.mc &gt; /etc/mail/sendmail.cf</code><br
/> (fix your paths appropriately), or if you are using debian sendmail you can just run <strong>make all</strong> in <em>/etc/mail</em>.</p><p>After <strong>restarting </strong>sendmail, it will start using the multiple queues we defined. Running <strong>mailq </strong>will output each of the queues:<br
/> <code>mailq<br
/> /var/spool/mqueue/q6 is empty<br
/> /var/spool/mqueue/q4 is empty<br
/> /var/spool/mqueue/q3 is empty<br
/> /var/spool/mqueue/q2 is empty<br
/> /var/spool/mqueue/q5 is empty<br
/> /var/spool/mqueue/q1 is empty<br
/> /var/spool/mqueue/q7 is empty<br
/> /var/spool/mqueue/q8 is empty<br
/> Total requests: 0</code></p><p><strong>Note</strong>: if you want to add more folders to the configuration all you have to do is to create the respective folders, set the appropriate permissions and restart sendmail.</p><p>If you had existing mails in the queue (most likely if you were looking for this solution), if you want them still processed, move them from /var/spool/mqueue in one of the newly created queues (q1 for ex).</p><p>Individual queue directories can be symbolic links to other partitions to spreads load among multiple disks. Queue IDs are unique across queues so you can move the items among queues if you have to.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2008/08/19/sendmail-multiple-queues/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>When should we expect Centos 5.2?</title><link>http://www.ducea.com/2008/05/30/when-should-we-expect-centos-52/</link> <comments>http://www.ducea.com/2008/05/30/when-should-we-expect-centos-52/#comments</comments> <pubDate>Fri, 30 May 2008 18:52:57 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[Centos]]></category> <category><![CDATA[RHEL]]></category> <category><![CDATA[distributions]]></category> <category><![CDATA[releases]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=240</guid> <description><![CDATA[Last week RedHat released RHEL5.2 on the 21st, and probably most people running Centos 5 are wandering when they will get the updated Centos5.2 release as well. From past releases I have noticed that this takes a couple of weeks, close to a month, but didn&#8217;t really track the exact time lag between the releases. [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p>Last week RedHat released <strong>RHEL5.2</strong> on the <strong>21st</strong>, and probably most people running <a
href="http://www.centos.org/" target="_blank">Centos 5</a> are wandering when they will get the updated <strong>Centos5.2</strong> release as well. From past releases I have noticed that this takes a couple of weeks, close to a month, but didn&#8217;t really track the exact time lag between the releases.</p><p>Reading from <strong>Tim Verhoeven&#8217;s</strong> <a
href="http://misterd77.blogspot.com/2008/05/centos-52.html" target="_blank">explanation</a>:</p><p>&#8220;For some background information, why does it take <strong>3,5 weeks</strong> ? First we need to remove all the logos and trademarks of Upstream. Secondly we need to build everything from source and this for both i386 and x86_64. Then everything that gets build goes past the QA team that verify that everything works as it should. From all the build packages install media will be created and these also need to be tested by the QA team. For each release a set of release notes are created and these are translated in different languages (12 for 5.1). Finally all the packages and media need to be uploaded in distributed to the mirror network so you can download it.&#8221;</p><p>we learn that we should expect Centos 5.2 released sometimes <em>around June 14th 2008</em> (sooner or later).</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2008/05/30/when-should-we-expect-centos-52/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>RHEL 5.2 (Tikanga) Released</title><link>http://www.ducea.com/2008/05/24/rhel-52-tikanga-released/</link> <comments>http://www.ducea.com/2008/05/24/rhel-52-tikanga-released/#comments</comments> <pubDate>Sat, 24 May 2008 09:18:51 +0000</pubDate> <dc:creator>- Marius -</dc:creator> <category><![CDATA[RHEL]]></category> <category><![CDATA[distributions]]></category> <category><![CDATA[releases]]></category><guid
isPermaLink="false">http://www.ducea.com/?p=235</guid> <description><![CDATA[Earlier this week, RedHat has announced the second minor update to Red Hat Enterprise Linux 5: RHEL5.2. I was not able to update the rhel5 systems I manage until Friday, when this has become available in the update channels: cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.2 (Tikanga) Red Hat Enterprise Linux 5.2 enhancements [...]<p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p> ]]></description> <content:encoded><![CDATA[<p>Earlier this week, RedHat has announced the second minor update to <strong>Red Hat Enterprise Linux 5</strong>: RHEL5.2. I was not able to update the rhel5 systems I manage until Friday, when this has become available in the update channels:<br
/> <code>cat /etc/redhat-release<br
/> Red Hat Enterprise Linux Server release 5.2 (Tikanga)</code><br
/> Red Hat Enterprise Linux 5.2 enhancements are primarily focused in six areas:</p><ul><li> Virtualization</li><li> Laptop and Desktop improvements</li><li> Encryption and Security</li><li> Cluster &amp; Storage Enhancements</li><li> Networking &amp; IPv6 Enablement</li><li> Serviceability</li></ul><p><em>&#8220;Update brings broad refresh of hardware support and improved quality, combined with new features and enhancements in areas such as virtualization, desktop, networking, storage &amp; clustering and security&#8221;</em></p><p>For full details check out the redhat <a
href="http://www.redhat.com/about/news/prarchive/2008/rhel_5_2.html" target="_blank">press release</a>.</p><p><a
href="http://www.thycotic.com/zSS_Ducea.html?utm_source=ducea&utm_medium=banner&utm_content=iquit&utm_campaign=SSDucea"><img
src="http://www.ducea.com/images/SS468by60.jpg"></a></p>]]></content:encoded> <wfw:commentRss>http://www.ducea.com/2008/05/24/rhel-52-tikanga-released/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Served from: www.ducea.com @ 2012-02-08 13:59:47 by W3 Total Cache -->
