<?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; Linux</title>
	<atom:link href="http://www.briandowney.net/blog/category/linux/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>Careful with those BASH loops!</title>
		<link>http://www.briandowney.net/blog/2011/12/07/careful-with-those-bash-loops/</link>
		<comments>http://www.briandowney.net/blog/2011/12/07/careful-with-those-bash-loops/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 18:24:57 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=249</guid>
		<description><![CDATA[I ran into something today that seems so very basic that I&#8217;m taken aback it hasn&#8217;t bitten me before. For example, take this simple BASH &#8216;for&#8217; loop: for DERP in /dev/tty*; do echo ${DERP}; done This should return a list of all the files matching /dev/tty* since BASH&#8217;s built-in file globbing expands as the list [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into something today that seems so very basic that I&#8217;m taken aback it hasn&#8217;t bitten me before.</p>
<p>For example, take this simple BASH &#8216;for&#8217; loop:</p>
<pre>for DERP in /dev/tty*; do echo ${DERP}; done</pre>
<p>This should return a list of all the files matching /dev/tty* since BASH&#8217;s built-in file globbing expands as the list parameter of &#8216;for&#8217; .   Now, try this:</p>
<pre>[bdowney@tlfmgt1 ~]$ for DERP in /dev/heraderp*; do echo $DERP; done
/dev/heraderp*</pre>
<p>Now the ${DERP} variable expanded to &#8220;/dev/herpaderp*&#8221;, but why?   The answer is that since /dev/herpaderp* did not naturally <em>expand</em> into a list of matches (because none matched) the pattern <em>itself</em> becomes the list parameter.   Makes sense once you understand what is happening, but seems a bit counterintuitive while programming.</p>
<p>I think most shell programmers would assume (myself included) the for loop would execute zero times upon no glob match.</p>
<p>So it would seem the correct way to handle this is by executing a subshell with a command that properly handles no-match globs, namely &#8220;ls&#8221;.   In this case, it works perfectly and as expected&#8211;but we have yet another caveat:</p>
<pre>for DERP in $(ls /home/bdowney/*.mp3 2&gt;/dev/null); do echo $DERP; done</pre>
<p>If we run into a file name with a space, say something like &#8220;01 &#8211; track1.mp3&#8243;, this version of the loop will still enumerate down to three separate list items because of the spaces, namely &#8220;01&#8243;, &#8220;-&#8221;, and &#8220;track1.mp3&#8243;.    We cannot escape the subshell with double quotes, either.   So we&#8217;re back to the plain globbing again without the subshell.   So how do we resolve this?   As follows:</p>
<pre>for DERP in /dev/tty*; do
 [[ -f ${DERP} ]] || continue
 echo $DERP
 done</pre>
<p>Just test the loop iteration to see if it matches a file. Problem solved in all situations!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/12/07/careful-with-those-bash-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Network Programming with BASH</title>
		<link>http://www.briandowney.net/blog/2011/03/25/network-programming-with-bash/</link>
		<comments>http://www.briandowney.net/blog/2011/03/25/network-programming-with-bash/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 22:25:50 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Cool]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[The Interweb]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=199</guid>
		<description><![CDATA[Greg put up a pretty amazing post about reading and writing to TCP network sockets using nothing but the BASH shell and the Linux kernel pseduo-filesystem.   Go check it out here.]]></description>
			<content:encoded><![CDATA[<p>Greg put up a pretty amazing post about reading and writing to TCP network sockets using nothing but the BASH shell and the Linux kernel pseduo-filesystem.   <a title="Network Programming with BASH" href="http://www.techrockdo.com/technology/network-programming-with-bash"> Go check it out here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/03/25/network-programming-with-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No controllers found: PERC 4, 64 Bit CentOS, and OMSA 6.4</title>
		<link>http://www.briandowney.net/blog/2011/03/01/no-controllers-found-perc-4-64-bit-centos-and-omsa-6-4/</link>
		<comments>http://www.briandowney.net/blog/2011/03/01/no-controllers-found-perc-4-64-bit-centos-and-omsa-6-4/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 15:20:40 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Dell]]></category>
		<category><![CDATA[OMSA]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=187</guid>
		<description><![CDATA[Dell&#8217;s OMSA is very handy for digging into the status of hardware on your PowerEdge server, but I usually stay a version or so back for reasons like this.  The latest 64 bit OMSA on a 64 bit CentOS install won&#8217;t see the PERC.   But this post over at Steve Jenkins&#8217; blog helped sort [...]]]></description>
			<content:encoded><![CDATA[<p>Dell&#8217;s OMSA is very handy for digging into the status of hardware on your PowerEdge server, but I usually stay a version or so back for reasons like this.  The latest 64 bit OMSA on a 64 bit CentOS install won&#8217;t see the PERC.   But <a href="http://stevejenkins.com/blog/2011/01/no-controllers-found-fix-set-up-dell-omsa-6-4-32-bit-on-rhel-centos-5-5-64-bit/">this post</a> over at Steve Jenkins&#8217; blog helped sort it out.</p>
<p>Basically, install 32 bit OMSA on 64 Bit CentOS, and all will be well.   Go Dell!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/03/01/no-controllers-found-perc-4-64-bit-centos-and-omsa-6-4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<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>Time to Play the Lottery?</title>
		<link>http://www.briandowney.net/blog/2011/02/15/time-to-play-the-lottery/</link>
		<comments>http://www.briandowney.net/blog/2011/02/15/time-to-play-the-lottery/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 16:20:37 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Cool]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[deletion]]></category>
		<category><![CDATA[ext3]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=142</guid>
		<description><![CDATA[It is pretty rare, but once in a while you can catch EXT3 at work;  in the midst of removing a file, for instance.  I just ran into one this morning: I&#8217;ll be off at the liquor store buying lottery tickets!]]></description>
			<content:encoded><![CDATA[<p>It is pretty rare, but once in a while you can catch EXT3 at work;  in the midst of removing a file, for instance.  I just ran into one this morning:</p>
<p><a href="http://www.briandowney.net/blog/wp-content/uploads/2011/02/missingfile.tiff"><img class="aligncenter size-full wp-image-143" title="missingfile" src="http://www.briandowney.net/blog/wp-content/uploads/2011/02/missingfile.tiff" alt="" /></a></p>
<p>I&#8217;ll be off at the liquor store buying lottery tickets!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/02/15/time-to-play-the-lottery/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>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>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>Linux Swapping</title>
		<link>http://www.briandowney.net/blog/2008/05/02/linux-swapping/</link>
		<comments>http://www.briandowney.net/blog/2008/05/02/linux-swapping/#comments</comments>
		<pubDate>Fri, 02 May 2008 17:57:00 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=98</guid>
		<description><![CDATA[Found this interesting post over at SmugBlog.  Apparently these fellows experience the same issue with the Linux kernel swapping needlessly as we do at TLF.  At least I know we&#8217;re not alone now. I think the best part is the solution they came up with&#8230; check it out.]]></description>
			<content:encoded><![CDATA[<p>Found this <a href="http://blogs.smugmug.com/don/2008/05/01/mysql-and-the-linux-swap-problem/">interesting post</a> over at SmugBlog.  Apparently these fellows experience the same issue with the Linux kernel swapping needlessly as we do at TLF.  At least I know we&#8217;re not alone now.</p>
<p>I think the best part is the solution they came up with&#8230; check it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/05/02/linux-swapping/feed/</wfw:commentRss>
		<slash:comments>0</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>
	</channel>
</rss>

