<?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>Randy&#039;s BlogRandy&#039;s Blog</title>
	<atom:link href="http://djlab.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://djlab.com</link>
	<description>Ramblings of an overworked sysadmin.</description>
	<lastBuildDate>Fri, 17 May 2013 18:24:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Remount read/write in single user mode</title>
		<link>http://djlab.com/2013/04/remount-readwrite-in-single-user-mode/</link>
		<comments>http://djlab.com/2013/04/remount-readwrite-in-single-user-mode/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 12:49:43 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1038</guid>
		<description><![CDATA[If /etc/fstab is correct, you can simply type: # mount -n -o remount / If /etc/fstab is wrong, you must give the device name and possibly the type, too: e.g. # mount -n -o remount -t ext4 /dev/sda3 /]]></description>
				<content:encoded><![CDATA[<p>If /etc/fstab is correct, you can simply type:</p>
<p># mount -n -o remount /</p>
<p>If /etc/fstab is wrong, you must give the device name and possibly the<br />
type, too: e.g.</p>
<p># mount -n -o remount -t ext4 /dev/sda3 /</p>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/04/remount-readwrite-in-single-user-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pacemaker / Corosync / DRBD Cheatsheet</title>
		<link>http://djlab.com/2013/04/pacemaker-corosync-drbd-cheatsheet/</link>
		<comments>http://djlab.com/2013/04/pacemaker-corosync-drbd-cheatsheet/#comments</comments>
		<pubDate>Sat, 20 Apr 2013 13:46:00 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1035</guid>
		<description><![CDATA[Monitor the status: crm_mon Migrate all resources to another node: crm resource migrate rg_main &#60;fqdn_node_name&#62; Take node offline and online (be careful, this sets a &#8216;prefer&#8217; to the other node to force a transition, which may or may not get removed afterwards): crm node standby crm node online Start and stop all resources (warning, this [...]]]></description>
				<content:encoded><![CDATA[<p>Monitor the status:</p>
<pre><code>crm_mon</code></pre>
<p>Migrate all resources to another node:</p>
<pre><code>crm resource migrate rg_main &lt;fqdn_node_name&gt;</code></pre>
<p>Take node offline and online (be careful, this sets a &#8216;prefer&#8217; to the other node to force a transition, which may or may not get removed afterwards):</p>
<pre><code>crm node standby
crm node online</code></pre>
<p>Start and stop all resources (warning, this will take them completely offline, NOT migrate):</p>
<pre><code>crm resource stop rg_main
crm resource start rg_main</code></pre>
<p>Show configuration:</p>
<pre><code>crm configure show</code></pre>
<p>If resources are stuck in &#8216;(unmanaged) FAILED&#8217; state, e.g. due to a failed stop action, you can clear it out:</p>
<pre><code>crm_resource -P</code></pre>
<p><strong>Be careful</strong> &#8212; this could trigger a migration if the stuck resources were preventing one.  Make sure you&#8217;re ready for one.</p>
<p>Monitor the cluster status along with fail counts:</p>
<pre><code>crm_mon --failcount</code></pre>
<p>One-shot status output:</p>
<pre><code>crm status</code></pre>
<p>Check DRBD status:</p>
<pre><code>cat /proc/drbd</code></pre>
<p>DRBD split-brain cleanup on secondary node:</p>
<pre><code>drbdadm disconnect main
drbdadm -- --discard-my-data connect main</code></pre>
<p>DRBD split-brain cleanup on primary node:</p>
<pre><code>drbdadm disconnect main
drbdadm primary main
drbdadm connect main</code></pre>
<p>Scheduler optimizing on large arrays (untested):</p>
<pre><code>echo deadline &gt; /sys/block/sdb/queue/scheduler
echo 0 &gt;  /sys/block/sdb/queue/iosched/front_merges
echo 150 &gt; /sys/block/sdb/queue/iosched/read_expire
echo 1500 &gt; /sys/block/sdb/queue/iosched/write_expire</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/04/pacemaker-corosync-drbd-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange 2012 Allow Relay from IP</title>
		<link>http://djlab.com/2013/04/exchange-2012-allow-relay-from-ip/</link>
		<comments>http://djlab.com/2013/04/exchange-2012-allow-relay-from-ip/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 14:20:35 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1026</guid>
		<description><![CDATA[Enable mail relaying from a specific IP or range of IPs. 1. Exchange Management Console -> Server Configuration -> Hub Transport 2. New Receive Connector * Set remote network to the IP or range you want to allow relay from (default is any IP so watch out here) * &#8220;Externally Secured&#8221; authentication * &#8220;Exchange Servers&#8221; [...]]]></description>
				<content:encoded><![CDATA[<p>Enable mail relaying from a specific IP or range of IPs.</p>
<p>1.  Exchange Management Console -> Server Configuration -> Hub Transport</p>
<p>2.  New Receive Connector</p>
<p>* Set remote network to the IP or range you want to allow relay from (default is <strong>any IP</strong> so watch out here)<br />
* &#8220;<strong>Externally Secured</strong>&#8221; authentication<br />
* &#8220;<strong>Exchange Servers</strong>&#8221; permission group<br />
* All other options disabled</p>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/04/exchange-2012-allow-relay-from-ip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increasing max files or folders per directory on Linux EXT filesystem</title>
		<link>http://djlab.com/2013/03/increasing-max-files-or-folders-per-directory-on-linux-ext-filesystem/</link>
		<comments>http://djlab.com/2013/03/increasing-max-files-or-folders-per-directory-on-linux-ext-filesystem/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 15:45:09 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1023</guid>
		<description><![CDATA[If a (poorly coded) app reaches the maximum number of files or folders per directory in Linux, you may see errors like this: Error happened when generating Download Link. Please try again or Contact administrator. (ERROR:mkdir) A quick and dirty way to increase the limit (and overall performance of the system) is to add the [...]]]></description>
				<content:encoded><![CDATA[<p>If a (poorly coded) app reaches the maximum number of files or folders per directory in Linux, you may see errors like this:</p>
<pre><code>Error happened when generating Download Link.
Please try again or Contact administrator.
(ERROR:mkdir)</code></pre>
<p>A quick and dirty way to increase the limit (and overall performance of the system) is to add the dir_index flag to the ext filesystem, then reindex:</p>
<pre><code>tune2fs -O dir_index /dev/sda3
updatedb &amp;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/03/increasing-max-files-or-folders-per-directory-on-linux-ext-filesystem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset Supermicro IPMI password with ipmitool</title>
		<link>http://djlab.com/2013/03/reset-supermicro-ipmi-password-with-ipmitool/</link>
		<comments>http://djlab.com/2013/03/reset-supermicro-ipmi-password-with-ipmitool/#comments</comments>
		<pubDate>Sun, 24 Mar 2013 18:27:15 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1021</guid>
		<description><![CDATA[This will set the &#8216;ADMIN&#8217; user password back to default of &#8216;ADMIN&#8217;. You could set it to anything you want, this is just an example. yum -y install ipmitool modprobe ipmi_devintf ipmitool -I open user set password 2 ADMIN]]></description>
				<content:encoded><![CDATA[<p>This will set the &#8216;ADMIN&#8217; user password back to default of &#8216;ADMIN&#8217;.  You could set it to anything you want, this is just an example.</p>
<pre><code>yum -y install ipmitool
modprobe ipmi_devintf
ipmitool -I open user set password 2 ADMIN</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/03/reset-supermicro-ipmi-password-with-ipmitool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strong Password Encryption in PHP</title>
		<link>http://djlab.com/2013/03/password-encryption-in-php/</link>
		<comments>http://djlab.com/2013/03/password-encryption-in-php/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 02:10:17 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1007</guid>
		<description><![CDATA[Don&#8217;t try to reinvent a complex and highly refined wheel, especially when customer data is involved. Please use phpass on any PHP project. (that&#8217;s PH-Pass) http://www.openwall.com/phpass/ Good reading for password hashing in general. http://www.openwall.com/articles/PHP-Users-Passwords]]></description>
				<content:encoded><![CDATA[<p>Don&#8217;t try to reinvent a complex and highly refined wheel, especially when customer data is involved.  Please use phpass on any PHP project.  (that&#8217;s PH-Pass)</p>
<p><a href="http://www.openwall.com/phpass/" title="http://www.openwall.com/phpass/">http://www.openwall.com/phpass/</a></p>
<p>Good reading for password hashing in general.</p>
<p><a href="http://www.openwall.com/articles/PHP-Users-Passwords" title="http://www.openwall.com/articles/PHP-Users-Passwords">http://www.openwall.com/articles/PHP-Users-Passwords</a></p>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/03/password-encryption-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cpanel Apache Symlink Protection</title>
		<link>http://djlab.com/2013/03/cpanel-apache-symlink-protection/</link>
		<comments>http://djlab.com/2013/03/cpanel-apache-symlink-protection/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 21:55:46 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1014</guid>
		<description><![CDATA[wget http://layer1.rack911.com/before_apache_make -O /scripts/before_apache_make chmod 700 /scripts/before_apache_make ## Rebuild apache (might want to do it thru WHM instead) /scripts/easyapache --build]]></description>
				<content:encoded><![CDATA[<pre><code>wget http://layer1.rack911.com/before_apache_make -O /scripts/before_apache_make
chmod 700 /scripts/before_apache_make
## Rebuild apache (might want to do it thru WHM instead)
/scripts/easyapache --build</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/03/cpanel-apache-symlink-protection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS Number Stats on Linux</title>
		<link>http://djlab.com/2013/03/as-number-stats-on-linux/</link>
		<comments>http://djlab.com/2013/03/as-number-stats-on-linux/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 14:58:17 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1010</guid>
		<description><![CDATA[I&#8217;ve got a couple of Linux machines that are sitting outside of the Sflow &#8216;zone&#8217; and AS traffic stats go unmeasured. I wanted to get a rough idea on the number of connections per AS number so here&#8217;s a little app that parses netstat and sorts AS numbers by number of connection. NOTE1: This won&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve got a couple of Linux machines that are sitting outside of the Sflow &#8216;zone&#8217; and AS traffic stats go unmeasured.  I wanted to get a rough idea on the number of connections per AS number so here&#8217;s a little app that parses netstat and sorts AS numbers by number of connection.</p>
<p>NOTE1: This won&#8217;t work on Cpanel servers due to tmp restrictions.</p>
<p>NOTE2: Specify an alternative (e.g newer) GeoIPASNum.dat file with the &#8211;geo option.</p>
<pre><code>wget http://djlab.com/stuff/asnum
chmod +x asnum
./asnum</code></pre>
<p>Example output:</p>
<pre><code>[root@mx1 ~]# ./asnum
(18) | RFC1918 or BOGON
(11) | AS29889 Fast Serv Networks, LLC
(4) | AS3320 Deutsche Telekom AG
(2) | AS7922 Comcast Cable Communications, Inc.</code></pre>
<p>Quick and (very) dirty cron script</p>
<pre><code>#!/bin.sh
#/root/doasnum.sh
#*/5 * * * * /root/./doasnum.sh &gt;&gt; /var/log/asnum.log

thedate=`date`
echo "***********************"
echo $thedate
/root/asnum
echo "***********************"</code></pre>
<p>Don&#8217;t forget to rotate the logs.</p>
<pre><code>#/etc/logrotate.d/asnum
/var/log/asnum.log
{
        rotate 7
        daily
        missingok
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/03/as-number-stats-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obfuscate or Encrypt Perl</title>
		<link>http://djlab.com/2013/03/obfuscate-or-encrypt-perl/</link>
		<comments>http://djlab.com/2013/03/obfuscate-or-encrypt-perl/#comments</comments>
		<pubDate>Fri, 01 Mar 2013 13:50:02 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1008</guid>
		<description><![CDATA[There are 3 primary options: 1. Use PAR with PAR::Filter::Obfuscate or PAR::Filter::Crypto 2. Use Filter::Crypto::CryptFile (requires certain modules installed on target system) 3. Encrypt modules with Module::Crypt.]]></description>
				<content:encoded><![CDATA[<p>There are 3 primary options:</p>
<p>1. Use PAR with PAR::Filter::Obfuscate or PAR::Filter::Crypto</p>
<p>2. Use Filter::Crypto::CryptFile (requires certain modules installed on target system)</p>
<p>3. Encrypt modules with Module::Crypt. </p>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/03/obfuscate-or-encrypt-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clone a live linux system with Rsync over SSH</title>
		<link>http://djlab.com/2013/02/cloning-a-live-linux-system-with-rsync-over-ssh/</link>
		<comments>http://djlab.com/2013/02/cloning-a-live-linux-system-with-rsync-over-ssh/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 15:56:46 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[clone]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://djlab.com/?p=1002</guid>
		<description><![CDATA[All commands are run on new server. 1. Boot into rescue mode (iso, pxe, ect). 2. Create partitions with &#8216;fdisk /dev/sda&#8217;. Type 83 for non-RAID fs, 82 for swap, type fd in the case of RAID (all partitions). Flag boot partition as bootable. In the case of SSD, add -S 32 -H 32 to the [...]]]></description>
				<content:encoded><![CDATA[<p>All commands are run on new server.</p>
<p>1.  Boot into rescue mode (iso, pxe, ect).</p>
<p>2.  Create partitions with &#8216;fdisk /dev/sda&#8217;.  Type 83 for non-RAID fs, 82 for swap, type fd in the case of RAID (all partitions).  Flag boot partition as bootable. </p>
<p>In the case of SSD, add -S 32 -H 32 to the fdisk command and start the first partition on sector 2 for proper alignment.</p>
<p>If using RAID, duplicate the partition table after creating it on the first disk:</p>
<pre><code>dd if=/dev/sda of=/dev/sdb bs=1 count=64 skip=446 seek=446</code></pre>
<p>2.  Create RAID array (if applicable).</p>
<pre><code># For SSD, add: --chunk=128
mdadm --create /dev/md0 -e 0.90 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1  ## /boot
mdadm --create /dev/md1 -e 0.90 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2  ## Swap
mdadm --create /dev/md2 -e 0.90 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3  ## /</code></pre>
<p>3.  Create filesystems</p>
<p>For spin disk:</p>
<pre><code>mkfs.ext3 /dev/md0 # /dev/sda1 for non-RAID
mkfs.ext3 /dev/md2 # /dev/sda3 for non-RAID</code></pre>
<p>For SSD (non RAID):</p>
<pre><code>mkfs.ext3 -b 1024 -E stride=128,stripe-width=128 -O ^has_journal /dev/sda1
mkfs.ext3 -b 1024 -E stride=128,stripe-width=128 -O ^has_journal /dev/sda3</code></pre>
<p>For SSD (RAID):</p>
<pre><code>mkfs.ext3 -b 1024 -E stride=128,stripe-width=256 -O ^has_journal /dev/md0 ## stripe-width = stride x N disks
mkfs.ext3 -b 1024 -E stride=128,stripe-width=256 -O ^has_journal /dev/md2 ## stripe-width = stride x N disks</code></pre>
<p>4.  Mount filesystems</p>
<pre><code>mkdir /mount
mount /dev/md2 /mount  ## /dev/sda3 for non-RAID
mkdir {/mount/boot,/mount/dev,/mount/sys,/mount/proc,/mount/tmp}  
mount /dev/md0 /mount/boot ## /dev/sda1 for non-RAID</code></pre>
<p>5.  Sync filesystems with Rsync over SSH (Ex: 1.2.3.4 is source machine)</p>
<pre><code>rsync -aHxv root@1.2.3.4:/* /mount --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp
rsync -aHxv root@1.2.3.4:/boot/* /mount/boot --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp  ## Only if /boot is on separate partition in source machine</code></pre>
<p>If applicable: stop mysql on the source machine and resync the databases to prevent corruption:</p>
<pre><code>rsync -aHxv root@1.2.3.4:/var/lib/mysql/* /mount/var/lib/mysql</code></pre>
<p>6.  Update mdadm.conf</p>
<pre><code>mdadm --examine --scan &gt; /mount/etc/mdadm.conf</code></pre>
<p>7.  Update fstab (if needed)</p>
<pre><code>vi /mount/etc/fstab</code></pre>
<p>8.  Install bootloader</p>
<pre><code>grub
root (hd0,0)
setup (hd0)
root (hd1,0)  ## for RAID
setup (hd1)  ## for RAID
exit</code></pre>
<p>9.  Optional: change IP address if both machines need to be online</p>
<pre><code>vi /mount/etc/sysconfig/network-scripts/ifcfg-eth0</code></pre>
<p>10.  Cross fingers, reboot</p>
<pre><code>reboot</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://djlab.com/2013/02/cloning-a-live-linux-system-with-rsync-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.164 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-05-25 08:01:49 -->
