<?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>AdmiNirvana &#187; Computers</title>
	<atom:link href="http://www.briandowney.net/blog/category/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.briandowney.net/blog</link>
	<description>Technical musings of an entrepreneur.</description>
	<lastBuildDate>Fri, 20 Jan 2012 02:55:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Announcing the NorCal LUG</title>
		<link>http://www.briandowney.net/blog/2011/02/22/announcing-the-norcal-lug/</link>
		<comments>http://www.briandowney.net/blog/2011/02/22/announcing-the-norcal-lug/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 18:04:35 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[california]]></category>
		<category><![CDATA[redding]]></category>
		<category><![CDATA[user group]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=148</guid>
		<description><![CDATA[Today we&#8217;re launching the Northern California Linux User Group.   As far as I can tell, the closest LUG to Redding is the Sacramento LUG, and that&#8217;s just too far away!   This LUG will be based in Redding, of course, and for now we plan on holding monthly meetings when the group achieves a [...]]]></description>
			<content:encoded><![CDATA[<p>Today we&#8217;re launching the <a href="http://www.norcallug.org">Northern California Linux User Group</a>.   As far as I can tell, the closest LUG to Redding is the <a href="http://www.saclug.org/">Sacramento LUG</a>, and that&#8217;s just too far away!   This LUG will be based in Redding, of course, and for now we plan on holding monthly meetings when the group achieves a large enough membership base.</p>
<p>For now, visit the site and sign up for the mailing lists!   We&#8217;re still in the early phases, so be sure to suggest ideas and comments for the focus of the group.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/02/22/announcing-the-norcal-lug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software And Carburetors</title>
		<link>http://www.briandowney.net/blog/2011/02/04/software-and-carburetors/</link>
		<comments>http://www.briandowney.net/blog/2011/02/04/software-and-carburetors/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 06:29:33 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Cars]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Philosophy]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=133</guid>
		<description><![CDATA[Anyone that&#8217;s followed my blog for a while or knows me personally has probably deduced something curious:  I&#8217;m a odd set of contradictions. One side of the coin, I&#8217;m an avid technologist.    I own an obscene number of computers, both Mac and PC.   I&#8217;ve got an iPhone, and owned one of each generation. [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone that&#8217;s followed my blog for a while or knows me personally has probably deduced something curious:  I&#8217;m a odd set of contradictions.</p>
<p>One side of the coin, I&#8217;m an avid technologist.    I own an obscene number of computers, both Mac and PC.   I&#8217;ve got an iPhone, and owned one of each generation.   I cancelled my cable nearly a year ago and stream Netflix and local channels via Windows Media Center on a computer hooked up to my television.   I don&#8217;t own a landline; all my telephone service is wireless or VoIP.    Even my business is completely done on the web with Quickbooks Online and Google Sites, Gmail, and Docs.</p>
<p>Now flip that coin over:    I have three, <em>yes three</em>, apps on my iPhone.   I don&#8217;t use LinkedIn, Twitter, or Facebook.   I have no desire whatsoever for a tablet PC or an iPad.   I&#8217;m seriously considering purchasing an older (pre-1975) car to re-build as a daily driver and dumping my 2007 Aveo.   I still write checks, fill out forms with a ball point pen,  and do my bills via snail mail.    I&#8217;ll call someone instead of texting them.</p>
<p>So what gives?  Why the dual personalities?</p>
<p>I&#8217;ve been wondering that myself lately, and started keeping track of <em>why</em> I tend to do things a certain way versus another.   For instance, I&#8217;ll not think twice  in allowing Quickbooks Online (which is great, by the way) automatically post transactions in our business account directly from Chase, but minutes later I&#8217;ll be writing a check and affixing postage to an envelope addressed to the office insurance company.   Insanity perhaps?</p>
<p>Well, no, as a matter of fact.   You see my moment of clarification resulted from an airbag light and an accelerator pump.   Let&#8217;s back up six months, and put our gearhead hat (or welding visor, for you true hardcore grease monkeys) on for a few moments.</p>
<p>I&#8217;ve had a lingering problem with the Camaro that anyone with old-car experience has probably felt before.   When dropping the gas pedal to the floor, the car would stutter and hesitate for a moment (kind of embarassing in a muscle car!) and then finally pick up steam and roar ahead.   The reason for this is due to the carburetor&#8217;s throttle plates suddenly opening all the way, and all the vacuum in the engine&#8217;s intake system disappearing for a moment while the engine&#8217;s RPMs spool up.  For those not-quite-car-savvy readers out there, vacuum in the engine is what pulls the gas/air mix in and allows it to go &#8216;vroom&#8217;!  No vacuum, no vroom.</p>
<p>Over the decades carburetor designers figured out that if a small syringe-like pump&#8211;called an <em>accelerator pump&#8211;</em>was physically hooked up to the cabling coming from the gas pedal, they could preempt this pause with a small squirt of straight gasoline into the throat of the engine. This provided some temporary &#8220;oomph&#8221; for a few seconds while the vacuum caught up with the driver&#8217;s right foot.  Clever thinking, to be sure.</p>
<p>Now, let&#8217;s fast forward back to modern-day.   My 2007 Aveo has an Airbag light on.   Much to my chagrin, it is completely undiagnosable sitting in my garage.  You <em>must</em> take it to a service center with the appropriate code scanners to even know what&#8217;s wrong.</p>
<p>So here comes my epiphany.</p>
<p>As an engineer and a tinkerer, I want control.   However, I&#8217;m also lazy.  What I&#8217;ve found is that if something  <em>just works</em>, I&#8217;m willing to allow it to work behind a set of curtains&#8211;even if that means raising an eyebrow and surrendering a bit of control.   However,  if something is problematic nothing angers me more than not being able to fix it myself.  In fact, I&#8217;ll even stop using it or throw it away.</p>
<p>I own the 2007 Aveo.  I have the title, and it is lien-free.   However, I couldn&#8217;t even obtain the specifications on how to diagnose the airbag system on the car even if I wanted to.   Chevrolet doesn&#8217;t make them available, I&#8217;m sure because they&#8217;re afraid someone will set the airbags off by accident.    So the question is, do I really own it?   I&#8217;m still subservient to the manufacturer, even though I&#8217;ve paid for the product.</p>
<p>I also own my Camaro, and last weekend I finally fixed the hesitation problem by bending a piece of wire on the carburetor with a pair of pliers.</p>
<p>I&#8217;ve realized that this same disparity lack of control and trust is my issue with software and technology in general.   As software is getting more and more complex, and nearly everything is online 100% of the time, quality and control  is seemingly going south along with it.  I doubt this is intentional by software developers;  more likely its just the vast task of maintaining and QA&#8217;ing gigantic amount of source code.   I&#8217;ve recently noted that when software or a piece of digital tech fails me, I get very bitter and don&#8217;t often go back and use it again.   The same thing is happening with my 2007 Aveo, and I&#8217;m once again behaving irrationally about it.</p>
<p>So for all you software developers out there:   Take a lesson from the carburetor designers of an era past.   It&#8217;s cute to be clever, but simplicity and reliability are true genius. <em> </em>It seems software is going the wrong direction&#8211;placing features higher in importance over function and reliably.</p>
<p>Get back to to basics, and just write damn tight code.   Your user base will thank you.</p>
<p>I&#8217;ll keep the <a href="http://www.haynes.com/">Haynes </a>manual handy, if you need to borrow it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/02/04/software-and-carburetors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firewalling brute force attempts with IPTables</title>
		<link>http://www.briandowney.net/blog/2009/08/20/firewalling-brute-force-attempts-with-iptables/</link>
		<comments>http://www.briandowney.net/blog/2009/08/20/firewalling-brute-force-attempts-with-iptables/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 17:53:14 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tlf]]></category>
		<category><![CDATA[attack]]></category>
		<category><![CDATA[brute]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[force]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=124</guid>
		<description><![CDATA[Almost 24 hours per day, The Linux Fix is inundated with FTP and SSH brute force attempts to our server farm.   This has compromised a few our our customer&#8217;s accounts from time to time, and I decided it was time to come up with a solution. The problem is tricky&#8211;we must leave FTP and SSH [...]]]></description>
			<content:encoded><![CDATA[<p>Almost 24 hours per day, The Linux Fix is inundated with FTP and SSH brute force attempts to our server farm.   This has compromised a few our our customer&#8217;s accounts from time to time, and I decided it was time to come up with a solution.</p>
<p>The problem is tricky&#8211;we must leave FTP and SSH open to the entire world, but at the same time be selective on what we black list.   How do you make that determination?  Strictly on bad login credentials?</p>
<p>We could, but that would mean that we&#8217;d inadvertently lock out real users.  A better solution we found has to do with timing connection attempts.   With IPTables, we can keep a counter based upon source IP&#8211;and track how many new socket attempts are made within a certain span of time.     For instance, if we detect the IP address 1.2.3.4 making 5 connection attempts within 60 seconds, there is a darn good chance it isn&#8217;t someone mistyping a password.</p>
<p>Here is how we did it, based upon another script we found out in the Internets:</p>
<pre>#!/bin/bash
/sbin/iptables -N SSH
/sbin/iptables -N SSH_BLACKLIST
/sbin/iptables -A SSH_BLACKLIST -m recent --name SSH_COUNTER --set -j LOG --log-level warn --log-prefix "Blocked: "
/sbin/iptables -A SSH_BLACKLIST -j REJECT
/sbin/iptables -A SSH -m recent --name SSH_COUNTER --update --seconds 300 -j REJECT
/sbin/iptables -A SSH -m recent --name SSH --rcheck --seconds 60 --hitcount 5 -j SSH_BLACKLIST
/sbin/iptables -A SSH -m recent --name SSH --rcheck --seconds 2 -j LOG --log-level warn --log-prefix "Added: "
/sbin/iptables -A SSH -m recent --name SSH --update --seconds 2 -j REJECT
/sbin/iptables -A SSH -m recent --name SSH_COUNTER --remove -j LOG --log-level warn --log-prefix "Removed: "
/sbin/iptables -A SSH -m recent --name SSH --set -j ACCEPT
/sbin/iptables -A INPUT -m state --state NEW -p tcp -m tcp --dport 22 -j SSH</pre>
<p>This creates two new tables, SSH and SSH_BLACKLIST.   Upon the intial connection attempt, the IP is added to the SSH_COUNTER counter.   If the same IP address is seen again within 60 seconds, it is duly noted&#8211;however no action is taken until the hitcount reaches 5.   In that case, the rules jump to the SSH_BLACKLIST table, it is logged, and subsequent connections from that IP are dropped for 5 minutes until things calm down.   In order to do this for FTP, just rename the targets as appropriate and change the target port to 21 on the last line.</p>
<p>The nice thing about this set up is that it is auto-cleaning.  After 5 minutes of no activity, the counter forgets about the IP address and things return to normal.   We&#8217;ve found that this is just enough protection to drastically reduce bruteforce attempts, yet not get in the way of normal usage by our customers.  Over time, this has become our favorite technique and we&#8217;ve begun to implement it on any Internet-facing machine with open SSH ports.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2009/08/20/firewalling-brute-force-attempts-with-iptables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Disk problems?  Your DC is too noisy&#8230;</title>
		<link>http://www.briandowney.net/blog/2009/01/02/disk-problems-your-dc-is-too-noisy/</link>
		<comments>http://www.briandowney.net/blog/2009/01/02/disk-problems-your-dc-is-too-noisy/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 16:32:39 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[latency]]></category>
		<category><![CDATA[noise]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[sun]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=118</guid>
		<description><![CDATA[This is one of those &#8220;no way, that can&#8217;t be true&#8221; type of events. Using Solaris&#8217; Dtrace functionality a systems engineer determines that noise is responsible for his intermittent disk latency problems.   Just wait for the last part of the video, it&#8217;s worth it. http://blogs.sun.com/brendan/entry/unusual_disk_latency Thanks to Greg for pointing that one out to me.]]></description>
			<content:encoded><![CDATA[<p>This is one of those &#8220;no way, that can&#8217;t be true&#8221; type of events.</p>
<p>Using Solaris&#8217; Dtrace functionality a systems engineer determines that <em>noise</em> is responsible for his intermittent disk latency problems.   Just wait for the last part of the video, it&#8217;s worth it.</p>
<p><a href="http://blogs.sun.com/brendan/entry/unusual_disk_latency">http://blogs.sun.com/brendan/entry/unusual_disk_latency</a></p>
<p>Thanks to <a href="http://www.yesthatsright.net">Greg</a> for pointing that one out to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2009/01/02/disk-problems-your-dc-is-too-noisy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling SSH on ESXi</title>
		<link>http://www.briandowney.net/blog/2008/10/16/enabling-ssh-on-esxi/</link>
		<comments>http://www.briandowney.net/blog/2008/10/16/enabling-ssh-on-esxi/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 13:03:29 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[enable ssh]]></category>
		<category><![CDATA[esxi]]></category>
		<category><![CDATA[remote administration]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=114</guid>
		<description><![CDATA[So, I finally had a chance to play with VMware ESXi.   It&#8217;s pretty much what I expected, a straight-up version of ESX.  Very, very nice&#8230; I&#8217;ll start moving more servers over from VMware Server 1.x and report back on my progress. One of the things that annoyed me out of the gate is the lack [...]]]></description>
			<content:encoded><![CDATA[<p>So, I finally had a chance to play with VMware ESXi.   It&#8217;s pretty much what I expected, a straight-up version of ESX.  Very, very nice&#8230; I&#8217;ll start moving more servers over from VMware Server 1.x and report back on my progress.</p>
<p>One of the things that annoyed me out of the gate is the lack of SSH support.   It&#8217;s there in the underlying operating system, just not enabled.   Here&#8217;s how to turn it on:</p>
<ol>
<li>Get on the console of the ESXi server.</li>
<li>Press ALT-F1 to get to the OS system console</li>
<li>Type &#8220;unsupported&#8221;</li>
<li>Enter the root password at the password prompt.</li>
<li>Edit /etc/inetd.conf with vi, and uncomment the SSH line</li>
<li>Run:  kill -1 $(cat /var/run/inetd.pid)</li>
</ol>
<p>And viola!  SSH to your ESX box.   Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/10/16/enabling-ssh-on-esxi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Time Machine via AFP</title>
		<link>http://www.briandowney.net/blog/2008/07/01/time-machine-via-afp/</link>
		<comments>http://www.briandowney.net/blog/2008/07/01/time-machine-via-afp/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 20:55:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[network share]]></category>
		<category><![CDATA[time machine]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=109</guid>
		<description><![CDATA[I have been itching to get Time Machine to work over a (unsupported) network-shared volume since we&#8217;re unwilling to drop the cash for a Time Capsule.  I&#8217;ve seen quite a few different posts on how to get it done, including the terminal trick to tell Time Machine to use unsupported volumes, but none of them [...]]]></description>
			<content:encoded><![CDATA[<p>I have been itching to get Time Machine to work over a (unsupported) network-shared volume since we&#8217;re unwilling to drop the cash for a Time Capsule.  I&#8217;ve seen quite a few different posts on how to get it done, including the terminal trick to tell Time Machine to use unsupported volumes, but none of them quite worked.</p>
<p>The best I could get was Time Machine to begin to write the files to the share, but after a few seconds die with a vague &#8220;Backup disk could not be created error&#8221;.  This stumped me for a bit until I came <a title="TimeMachine via AFP" href="http://pastebin.com/f47499d34">across this</a>.  Apparently sometime around 10.5.2, Apple introduced a new, undocumented &#8220;feature&#8221; to Time Machine that causes it to fail over network volumes when doing the initial backup.   However, once the files are created it will work fine.</p>
<p>So, the magical combination is as follows:</p>
<ul>
<li>CentOS 5 with <a title="Netatalk" href="http://netatalk.sourceforge.net/">Netatalk-2.0.3</a> compiled, installed, and configured per <a title="Netatalk on CentOS 5" href="http://www.sharedknowhow.com/2008/05/installing-netatalk-under-centos-5-with-leopard-support/">this post</a>.  Note: I also had to modify etc/cnid_dbd/dbif.c with the same code change as specified there, but YMMV.</li>
<li>OS X Leopard, patched to 10.5.4.</li>
<li>Changes to Netatalk&#8217;s netatalk.conf file per <a title="Gentoo Wiki" href="http://gentoo-wiki.com/HOWTO_Share_Directories_via_AFP">this post</a> at the Gentoo Wiki.</li>
<li>Following the <a href="http://pastebin.com/f47499d34">post linked above</a> <strong>precisely</strong>.</li>
</ul>
<p>Once that happened, Time Machine has begun to work great over AFP to our backup volume&#8211;even for multiple Macs connecting to the same share. Behold!</p>
<p><a href="http://www.briandowney.net/blog/wp-content/uploads/2008/07/timemachine.jpg"><img class="aligncenter size-medium wp-image-110" title="timemachine" src="http://www.briandowney.net/blog/wp-content/uploads/2008/07/timemachine-300x199.jpg" alt="Time Machine working over a Net Share" width="300" height="199" /></a></p>
<p>It probably doesn&#8217;t need saying; but this is clearly an unsupported way to use Time Machine.  It has been running this way for me only about a day.    If you&#8217;re concerned about having to troubleshoot problems that may pop up down the road, especially regarding backups; picking up a <a href="http://www.apple.com/timecapsule/">Time Capsule</a> is probably a far better idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/07/01/time-machine-via-afp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BASH Pipeline Exit Codes</title>
		<link>http://www.briandowney.net/blog/2008/05/05/bash-pipeline-exit-codes/</link>
		<comments>http://www.briandowney.net/blog/2008/05/05/bash-pipeline-exit-codes/#comments</comments>
		<pubDate>Mon, 05 May 2008 14:49:52 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=99</guid>
		<description><![CDATA[I think I&#8217;ve mentioned many times on this blog, but one of the most satisfying things regarding Linux and Unix are that you&#8217;re never done learning about it. A never-ending lesson in operating systems! Well, chalk up another lightbulb moment for me this morning. Imagine a script wherein a process needs to be checked for [...]]]></description>
			<content:encoded><![CDATA[<p>I think I&#8217;ve mentioned many times on this blog, but one of the most satisfying things regarding Linux and Unix are that you&#8217;re never done learning about it.  A never-ending lesson in operating systems! Well, chalk up another lightbulb moment for me this morning.</p>
<p>Imagine a script wherein a process needs to be checked for proper exit.   Let&#8217;s say &#8220;mysqldump&#8221;.   Typically I&#8217;d do something like this, for example:</p>
<p><code><br />
#!/bin/bash<br />
STATUS=1<br />
while [ ${STATUS} -ne 0 ]<br />
do<br />
mysqldump -uroot -psomepass --all-databases &gt; sql-backup.sql<br />
STATUS=${?}<br />
done<br />
</code></p>
<p><code>exit 0<br />
</code></p>
<p>That&#8217;ll work just fine&#8211;the special reserved variable ${?} contains the exit code of the last run command.  Mysqldump is kind enough to use non-zero ones on any kind of error, so if it doesn&#8217;t work in our script we&#8217;ll retry.</p>
<p>But for instance, let&#8217;s say our script looks like this:</p>
<p><code><br />
#!/bin/bash<br />
STATUS=1<br />
while [ ${STATUS} -ne 0 ]<br />
do<br />
mysqldump -uroot -psomepass --all-databases | gzip  &gt; sql-backup.sql<br />
STATUS=${?}<br />
done<br />
</code></p>
<p><code>exit 0<br />
</code></p>
<p>The problem here is that ${?} now contains the exit code for gzip, not mysqldump!   Will gzip respond properly if mysqldump doesn&#8217;t provide an input stream from the pipe?  Maybe, maybe not.  Bottom line is that it isn&#8217;t reliable, and not what I&#8217;d consider good shell programming.</p>
<p>Instead, check out this solution:</p>
<p><code><br />
#!/bin/bash</code></p>
<p><code><br />
STATUS=1<br />
while [ ${STATUS} -ne 0 ]<br />
do<br />
mysqldump -uroot -psomepass --all-databases | gzip &gt; sql-backup.sql<br />
STATUS=${PIPESTATUS[0]}<br />
done<br />
</code></p>
<p><code> exit 0<br />
</code></p>
<p>The BASH reserved array ${PIPESTAUTUS[x]} contains the exit codes for all programs in the array. In this example, ${PIPESTATUS[0]} is mysqldump, and ${PIPESTATUS[1]} is gzip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/05/05/bash-pipeline-exit-codes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>VMware Server Tips &#8216;n Tricks</title>
		<link>http://www.briandowney.net/blog/2008/04/08/vmware-server-tips-n-tricks/</link>
		<comments>http://www.briandowney.net/blog/2008/04/08/vmware-server-tips-n-tricks/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 15:05:41 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[hints]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[vmware server]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=74</guid>
		<description><![CDATA[As anyone whom reads this blog regularly knows, I&#8217;m a happy VMware Server user. In using it, I&#8217;ve come across some handy methods in administrating it and the virtual machines created with it. Without further ado, here they are! Tip #1 &#8211; Start and stop your VMs from the command line If your VMware server [...]]]></description>
			<content:encoded><![CDATA[<p>As anyone whom reads this blog regularly knows, I&#8217;m a happy VMware Server user.  In using it, I&#8217;ve come across some handy methods in administrating it and the virtual machines created with it.  Without further ado, here they are!</p>
<h3>Tip #1 &#8211; Start and stop your VMs from the command line</h3>
<p>If your VMware server is headless and gui-less (you didn&#8217;t install a GUI did you?) it&#8217;s handy to be able to start and stop your VM processes with a command line tool over ssh.  Use the vmware-cmd tool for this:</p>
<pre>vmware-cmd /path/to/vmxfile.vmx stop &lt;hard|soft&gt;</pre>
<p>or</p>
<pre>vmware-cmd /path/to/vmxfile.vmx start</pre>
<p>The third option is the powerop mode.  &#8216;soft&#8217; uses the VMware tools within the guest OS, while &#8216;hard&#8217; simply powers on and off the VM without the tools.</p>
<h3>Tip #2 &#8211; Re-install your VM Tools quickly</h3>
<p>After upgrading your kernel on Linux-based virtual machines, you&#8217;ll also have to re-compile  vmware tools&#8217;  kernel modules.   Upon initial installation,  you probably executed the usual:</p>
<pre>/usr/bin/vmware-config-tools.pl</pre>
<p>But did you know you can speed up the process and make it automatic by using the default options?   The next time you need to recompile your tools, use this instead</p>
<pre>/usr/bin/vmware-config-tools.pl -default</pre>
<h3>Tip #3 &#8211; Fine-grain your VM&#8217;s priority</h3>
<p>VMware Server does not provide the flexibility of ESX, but you can get it part-way there by using the Linux scheduler to prioritize your  virtual machines.  By default, VS gives all vmware-vmx processes a nice value of &#8220;-10&#8243;.   In Linux, processes with &#8220;-20&#8243; have the highest priority for system resources, and &#8220;20&#8243; have the lowest.   By adjusting your busy VMs to a higher negative number (e.g. -15) and your less-intensive VMs to a higher positive number (e.g 0) you can more finely tune your server&#8217;s performance and ensure timeslices on the host are more accurately granted.</p>
<p>To do this, use the `renice&#8217; command.   First, find the PIDs of your vmware-vmx processes, by using `ps&#8217;:</p>
<pre>[root@tlfvm5 ~]# ps -ef | grep vmware-vmx</pre>
<pre>root      3374     1 13 Mar18 ?        2-20:03:36 /usr/lib/vmware/bin/vmware-vmx -C /vmware/tlfmonitor/tlfmonitor.vmx -@ ""</pre>
<pre>root      4833     1 15 Mar18 ?        3-04:09:11 /usr/lib/vmware/bin/vmware-vmx -C /vmware/DellMonitor/DellMonitor.vmx -@ ""</pre>
<p>Then renice the appropriate PID.  For example, to give the &#8220;tlfmonitor&#8221; a bit of a bump to &#8220;-12&#8243;:</p>
<pre>renice -12 33</pre>
<p>Like all good things, moderation is key.  Start with smaller increments and note the change, then if needed bump it again.  It should be noted that your reniced values will disappear as soon as the PID terminates.   You can also give it a default higher priority via the .vmx file in the prority.grabbed and priority.ungrabbed directives (see <a href="http://sanbarrow.com/vmx/vmx-config-ini.html" target="_blank">http://sanbarrow.com/vmx/vmx-config-ini.html</a>).</p>
<h3>Tip #4 &#8211; Manage and extend your virtual disks</h3>
<p>VMware Server comes with a tool to completely manage your .vmdk disks.  The vmware-vdiskmanager tool can create, defrag, extend, and convert vmdks from one type to another.   For example, to expand a vmdk from 10GB to 15GB, power off the VM and issue this command:</p>
<pre>vmware-vdiskmanager -x 15Gb /path/to/vmdkfile.vmdk</pre>
<p>Note that this extends the raw disk, but not the guest file system.  For instance, after doing an extend in Linux on an ext3 file system, use &#8220;resize2fs&#8221; to adjust it accordingly.   You may want to run the vmware-vdiskmanager command without arguments to see some help on the different options, as well as some examples.</p>
<h3>Tip #5 &#8211; <strong>Install VMware tools from the command line</strong></h3>
<p>You don&#8217;t need to click &#8220;VM -&gt; Install Vmware Tools&#8230;&#8221; on the Server Console to mount the virtual media.   Do it from the command line!</p>
<pre>vmrun installtools /path/to/vmxfile.vmx</pre>
<p>This does precisely what clicking in the GUI does.  Once this has been run from the host, go to your VM and mount up the /dev/cdrom device and find your tools RPM ready to go.</p>
<p>That&#8217;s it for now.  Do you have any tips that are useful for other VMware Server administrators?  If so, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/04/08/vmware-server-tips-n-tricks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Superfluous subshelling</title>
		<link>http://www.briandowney.net/blog/2008/02/14/superfluous-subshelling/</link>
		<comments>http://www.briandowney.net/blog/2008/02/14/superfluous-subshelling/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 21:07:33 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/2008/02/14/superfluous-subshelling/</guid>
		<description><![CDATA[I run across this quite a bit and sort of do a &#8220;tsk-tsk&#8221; to the perpetrator. Greg of yesthatsright.net suggested I make a post about it. Let us assume you need to perform an operation on a bunch of files. I typically see it done as so in the BASH interpretor: for I in `ls [...]]]></description>
			<content:encoded><![CDATA[<p>I run across this quite a bit and sort of do a &#8220;tsk-tsk&#8221; to the perpetrator.  Greg of <a href="http://yesthatsright.net">yesthatsright.net</a> suggested I make a post about it.</p>
<p>Let us assume you need to perform an operation on a bunch of files. I typically see it done as so in the BASH interpretor:</p>
<p><code><br />
for I in `ls *.sh`<br />
do<br />
<em>something</em><br />
done<br />
</code></p>
<p>Now,  performing the backtick (`) subshell generally causes some hard to handle data mangling issues.   Most commonly a space in the file name or special character will result in odd permutations of ${I}.   For example in a file listing such as:</p>
<p><code><br />
file1.sh<br />
file2.sh<br />
file three.sh<br />
</code></p>
<p>Your resulting loop will end up with:</p>
<p><code><br />
[bdowney@tlfmgt1 ~]$ for I in `ls *.sh`; do echo ${I}; done<br />
file1.sh<br />
file2.sh<br />
file<br />
three.sh<br />
</code></p>
<p>The subshell returns strings to `for&#8217; which interprets whitespace as a new loop iteration.  This obviously causes issues for your loop logic, and I have seen people build in some pretty elaborate methods to handle it.   But it&#8217;s all for not&#8211;since `for&#8217; is a reserved shell function, it inherently understands file globbing.  Thus:</p>
<p><code><br />
[bdowney@tlfmgt1 ~]$ for I in *.sh; do echo ${I}; done<br />
file1.sh<br />
file2.sh<br />
file three.sh<br />
</code></p>
<p>Is all you need to do and solve your problem.  But what if one has a list of filenames in a file, or needs to pass more arguments to provide a better list of said files (for example, ls -t?).    Not to worry, the BASH built-in `read&#8217; to the rescue!</p>
<p><code><br />
[bdowney@tlfmgt1 ~]$ ls -tr *.sh | while read I; do echo ${I}; done<br />
file1.sh<br />
file2.sh<br />
file three.sh<br />
</code></p>
<p>And as you&#8217;d expect, works the same when redirecting STDIN:<br />
<code><br />
[bdowney@tlfmgt1 ~]$while read I; do echo ${I}; done &lt; input.file<br />
</code></p>
<p>So stop wasting those extra shell processes!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/02/14/superfluous-subshelling/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VMWare Server on NFS &amp; RedHat Cluster Suite</title>
		<link>http://www.briandowney.net/blog/2007/08/08/vmware-server-on-nfs-redhat-cluster-suite/</link>
		<comments>http://www.briandowney.net/blog/2007/08/08/vmware-server-on-nfs-redhat-cluster-suite/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 18:31:18 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tlf]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/2007/08/08/vmware-server-on-nfs-redhat-cluster-suite/</guid>
		<description><![CDATA[Over the past few weeks I&#8217;ve managed to get a pretty darn stable NFS / VMWare Server setup running. The basic specs are as follows: VMWare Host: Dell PowerEdge 1950 (dual quad core, 8 gigs RAM) NFS Cluster: Two Dell PowerEdge 860s (single quad core, 4 gigs RAM each) Networking: Dell PowerConnect 5324 Centralized storage: [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few weeks I&#8217;ve managed to get a pretty darn stable NFS / VMWare Server setup running.</p>
<p>The basic specs are as follows:</p>
<ul>
<li>VMWare Host: Dell PowerEdge 1950 (dual quad core, 8 gigs RAM)</li>
<li>NFS Cluster: Two Dell PowerEdge 860s (single quad core, 4 gigs RAM each)</li>
<li>Networking:  Dell PowerConnect 5324</li>
<li>Centralized storage:  <a href="http://briandowney.net/blog/2007/07/16/disks-lots-of-disks/">EonStor A24F-R2224</a></li>
<li>Internal DRAC on each node for cluster fencing (not ideal, read below).</li>
<li>All the VMDKs are stored on an NFS mount from the cluster.</li>
</ul>
<p>Through quite a bit of experimentation and trial and error, I have it running pretty solid.   Some of the key points:</p>
<ol>
<li>Used RedHat EL 5 all the way around, with the related GFS/RHCS packages</li>
<li>Mounted GFS on the NFS nodes with noatime,noquota for some minor speed improvements.</li>
<li>NFS4 and TCP for everything.  Makes failover to the other node more reliable.</li>
<li> Use &#8216;hard&#8217; mounts on the VMWare server, use timeo=600,retrans=2 in your options.  This allows TCP to handle transmission delays during a failover versus NFS.</li>
<li>On the export side, craft your /etc/exports so that each has a matching &#8216;fsid=&#8217; for every export.  This gets around stale handles.</li>
<li>Use the GFS/shared storage/floating IP technique as documented in the <a href="http://sources.redhat.com/cluster/doc/nfscookbook.pdf">Cluster NFS Cookbook</a> versus managed NFS (read why below).</li>
<li>Bonded the  NICs on the  NFS nodes for  higher throughput (in our case they will be exporting to more than one server when in production, so this was necessary).</li>
<li>Spanning tree algorithm delays on the PowerConnect can get you in trouble with a <a href="http://sources.redhat.com/cluster/faq.html#two_node_correct">fencing loop</a> in a two-node setup.  During a reboot situation one of the nodes, the NICs come up quicker during Linux sysinit than they do on the switch.  Thus, Linux thinks the interface should be reachable (when it&#8217;s not) and when fenced attempts to initalize, it cannot reach the other node and consequently fences that one.  Solution is to either add &#8220;LINKDELAY&#8221; to /etc/sysconfig/network or just disable spanning tree on the switch.</li>
</ol>
<p>I intially tried the managed NFS setup in Cluster Suite (check the cookbook), however there are two major problems.   At this time, managed NFS appears to be set up to use NFSv2 and v3 only, as there is no opportunity to modify the export options via Cluster Suite.   Also, there are timing delays with how Cluster Suite manages the NFS daemons&#8230;</p>
<p>Of course, during a failover speed is of the essence.  So, when I had this rig configured for managed NFS failover, I was experiencing 12+ second delays in failover.   Why?</p>
<p>Well, it turns out RedHat has a sleep command in /usr/share/cluster/ip.sh (the virtual IP management script) that adds 10 seconds to the failver so NFSD can  clear its cache (!?).   Pretty hackish, and results in an unacceptable delay during a failovers.   Unfortunately if you&#8217;re running managed NFS, there&#8217;s no real way around this unless you want to risk corruption of NFSD going down without flushing its cache to disk.</p>
<p>I found this in the <a href="http://sources.redhat.com/cluster/faq.html#rgm_failovertime">Cluster Project FAQ</a>.  With the &#8216;sleep 10&#8242; command gone, failover is much, much quicker.  As long as you&#8217;re doing the GFS thing versus the managed NFS setup this works quite nicely and fast enough that VMWare doesn&#8217;t seem to know the better of what is going on.</p>
<p>Performance-wise, it&#8217;s pretty darn good.   I have a dedicated PowerConnect 5324 for use as an &#8220;ethernet SAN&#8221; to interconnect the NFS nodes, and VMWare Server.   That being said, 20 concurrent lightly loaded VMs results in nothing abnormal in terms of performance or reliability.   In fact, it&#8217;s hard to tell the difference from local disk&#8211;even during a failover.  The NIC being used for &#8220;front-end&#8221; access to the VMWare Server Console even seems to experience more traffic than the NFS one according to the PowerConnect&#8217;s interface reports,  though that leaves me a bit skeptical.</p>
<p>I would have been  interesting to see if the TOE (TCP Offload Engine) equipped on the 1950&#8242;s NetExtremeII NICs would have made a performance improvment, but it works in Windows 2003 only.  Bummer.</p>
<p>Another &#8220;gotcha&#8221; to watch for is using RAC cards on the servers for fencing purposes.  In most cases it works fine however when power is lost to the entire server, the DRAC goes down with it and becomes unreachable.   This leaves the surviving node stuck trying to fence the dead one, and failover never occurs.   A better option would be to use a managable PDU (which we&#8217;ll do ultimately).</p>
<p>Bottom line it seems to work very well in almost all failure situations I&#8217;ve tested it in.   The only time I was able to make it fail (badly) was to yank the power cord out of one of the cluster nodes, and have the entire cluster crunch to a halt, due to the problem I mentioned above.    I did this while installing X Windows on 50% of the VMs to simulate a lot of NFS write activity.</p>
<p>After bringing the entire cluster back up manually, the only damage was a corrupt RPM DB on one of the VMs.  The others came back up fine after a fsck on boot.  Not bad!</p>
<p>After my testing,  I&#8217;m confident this set up will work in a production environment.  If you wish to do try the same, ensure your testing plan includes every possible outage situation you can fathom.  Weird/odd stuff can come up (for example the spanning tree thing) and of course it is far better to nail those down in R&amp;D than in production!</p>
<p><strong>UPDATE 2011-02-22:</strong></p>
<p><span style="color: #000000;">I couldn&#8217;t help but notice that this post garners a lot of search traffic, even to this day.   At this point in time RedHat <em>no longer</em> supports this type of NFS/GFS configuration.   This came up in a support call a while back and was confirmed by a high-level engineer at RedHat.</span></p>
<p><span style="color: #000000;">Since CentOS is essentially just RedHat de-branded, this holds true for CentOS as well.  You may experience success with this configuration, but be warned that in recent releases you may encounter data loss if specific events occur that cause cluster nodes to end servicing the cluster abnormally.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2007/08/08/vmware-server-on-nfs-redhat-cluster-suite/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

