<?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>[ t h e f r a g g l e . c o m ] &#187; Linux</title>
	<atom:link href="http://www.thefraggle.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thefraggle.com</link>
	<description>technology, photography and anything else that springs to mind.</description>
	<lastBuildDate>Tue, 13 Sep 2011 09:37:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>xen vcpu pinning defaults aren&#8217;t ideal</title>
		<link>http://www.thefraggle.com/2009/09/01/xen-vcpu-pinning-defaults-arent-ideal/</link>
		<comments>http://www.thefraggle.com/2009/09/01/xen-vcpu-pinning-defaults-arent-ideal/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 23:11:52 +0000</pubDate>
		<dc:creator>Chris Ganderton</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.thefraggle.com/2009/09/01/xen-vcpu-pinning-defaults-arent-ideal/</guid>
		<description><![CDATA[I noticed an oddity the other day with a xen Domain0 host we have. There&#8217;s a cron scripted job that verifies the RPM database and the RPM&#8217;s that are installed on the system, for some reason this job failed, but kept the process open, and kept spinning around trying to do it&#8217;s job. Now, I [...]]]></description>
			<content:encoded><![CDATA[<p>I noticed an oddity the other day with a xen Domain0 host we have. There&#8217;s a cron scripted job that verifies the RPM database and the RPM&#8217;s that are installed on the system, for some reason this job failed, but kept the process open, and kept spinning around trying to do it&#8217;s job. Now, I really ought to have set up a &#8220;process count&#8221; check on the nagios monitoring we have here, but I didn&#8217;t have this at the time, so didn&#8217;t pick it up for a few days. Whilst this was all going on, the Domain0 got pretty busy and started having to use time on the other CPU&#8217;s as well as the main VCPU that wasn&#8217;t pinned to anything but the Domain0.</p>
<p>You can see this from the list below of the vcpu resources used by a xen server currently:</p>
<p>[root@somedomain0 ~]# xm vcpu-list<br />
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity<br />
Domain-0                           0     0     0   -b-  1535018.3 0<br />
Domain-0                           0     1     1   -b-  139549.6 1<br />
Domain-0                           0     2     2   -b-  943651.0 2<br />
Domain-0                           0     3     3   -b-   53883.4 3<br />
Domain-0                           0     4     4   -b-  336268.9 4<br />
Domain-0                           0     5     5   -b-   65240.1 5<br />
Domain-0                           0     6     6   -b-   42854.6 6<br />
Domain-0                           0     7     7   r&#8211;   67960.9 7<br />
domain1                           4     0     2   r&#8211;  1791844.4 1-2<br />
domain1                           4     1     1   r&#8211;  1619120.1 1-2<br />
domain2                       5     0     3   -b-  511300.0 3-5<br />
domain2                       5     1     3   -b-  456253.1 3-5<br />
domain2                       5     2     5   -b-  456516.1 3-5<br />
domain3                     6     0     6   -b-  166344.6 6-7<br />
domain3                     6     1     7   -b-  137435.2 6-7</p>
<p>You’ll see Domain-0 which is the control domain, is pinned to all the other cpu’s that should only be used by the guests.</p>
<p>This isn&#8217;t ideal, and as a result you find that usually instead of a vmstat looking quite healthy and the &#8220;steal %&#8221; value that shows up being at 0, it&#8217;ll start to creep up. This means that the scheduler on the Domain0 side is interrupting the VCPU and requires CPU time from it, interrupting whatever is happening on the DomainU side.</p>
<p>There is a vcpu-pin action available within the xm command, which isn&#8217;t ideal to be used when you have the server live. What I found best, was to change the boot configuration for the Domain0 from the following:</p>
<p>title Enterprise Linux (2.6.18-128.el5xen)<br />
root (hd0,0)<br />
kernel /xen.gz-2.6.18-128.el5<br />
module /vmlinuz-2.6.18-128.el5xen ro root=/dev/vg01/root console=tty0 rhgb quiet<br />
module /initrd-2.6.18-128.el5xen.img</p>
<p>To the following:</p>
<p>title Enterprise Linux (2.6.18-128.el5xen)<br />
root (hd0,0)<br />
kernel /xen.gz-2.6.18-128.el5 <strong>dom0_max_vcpus=1</strong><br />
module /vmlinuz-2.6.18-128.el5xen ro root=/dev/vg01/root console=tty0 rhgb quiet<br />
module /initrd-2.6.18-128.el5xen.img</p>
<p>You&#8217;ll notice the option <strong>dom0_max_vcpus=1</strong>, this tells the Domain0 to pin to only one available VCPU, the one it&#8217;ll choose should be the first one.</p>
<p>You’ll see a difference in the vcpu-list afterwards like this:</p>
<p>[root@somedomain0 ~]# xm vcpu-list<br />
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity<br />
Domain-0                           0     0     0   r&#8211;      54.0 0<br />
domain1                           3     0     7   -b-       3.2 6-7<br />
domain1                           3     1     6   -b-       3.0 6-7<br />
domain2                          1     0     1   -b-      10.3 1-2<br />
domain2                           1     1     2   -b-       2.9 1-2<br />
domain3                          2     0     3   -b-       3.7 3-5<br />
domain3                          2     1     4   -b-       2.5 3-5<br />
domain3                          2     2     5   -b-       0.9 3-5</p>
<p>It&#8217;s worth noting that you can also limit this on the fly, by using the following command:</p>
<p>xm vcpu-pin Domain0 0 0</p>
<p>Which can be useful if you can&#8217;t get the down time for a box and it&#8217;s guests.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefraggle.com/2009/09/01/xen-vcpu-pinning-defaults-arent-ideal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>removing blank newlines using sed.</title>
		<link>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/</link>
		<comments>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 21:47:07 +0000</pubDate>
		<dc:creator>Chris Ganderton</dc:creator>
				<category><![CDATA[General Life]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[stuff]]></category>

		<guid isPermaLink="false">http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/</guid>
		<description><![CDATA[Most people won&#8217;t find this paticularly useful, but as I&#8217;m prone to forget things: sed -e '/^$/d' will delete blank newlines from whatever it&#8217;s input is.]]></description>
			<content:encoded><![CDATA[<p>Most people won&#8217;t find this paticularly useful, but as I&#8217;m prone to forget things:</p>
<p><code>sed -e '/^$/d'</code></p>
<p>will delete blank newlines from whatever it&#8217;s input is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>the number of servers you run &#8230;</title>
		<link>http://www.thefraggle.com/2007/04/13/the-number-of-servers-you-run/</link>
		<comments>http://www.thefraggle.com/2007/04/13/the-number-of-servers-you-run/#comments</comments>
		<pubDate>Fri, 13 Apr 2007 17:34:32 +0000</pubDate>
		<dc:creator>Chris Ganderton</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[General Life]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://www.thefraggle.com/2007/04/13/the-number-of-servers-you-run/</guid>
		<description><![CDATA[Well reading popeys blog entry on how many servers he has, and what he uses them for made me feel a bit better than I did previously, about running more than one server of my own for personal use. I only have three servers, and a workstation and a laptop; maybe I don&#8217;t waste as [...]]]></description>
			<content:encoded><![CDATA[<p>Well reading <a href="http://www.popey.com" title="www.popey.com" target="_blank">popeys</a> blog entry on <a href="http://popey.com/What_are_you_using_machines_for" title="http://popey.com/What_are_you_using_machines_for" target="_blank">how many servers he has, and what he uses them for</a> made me feel a bit better than I did previously, about running more than one server of my own for personal use. I only have three servers, and a workstation and a laptop; maybe I don&#8217;t waste as much electricity as I thought I did <img src='http://www.thefraggle.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li>etch.thefraggle.com &#8211; Debian etch, xen vps from <a href="http://www.bitfolk.com">bitfolk</a>; general webserver for www.thefraggle.com, and master mail server.</li>
<li>sarge.thefraggle.com &#8211; Debian etch, xen vps from <a href="http://www.bitfolk.com">bitfolk</a>; run&#8217;s IRCd&#8217;s for <a href="http://www.blitzed.org/" title="Blitzed IRC Network">blitzed.org</a> and nixhelp.org and tertiary mail exchanger.</li>
<li>beastie.thefraggle.com &#8211; FreeBSD-6.2-stable on an old p2 400mhz 128mb ram; used to run an ircd for nixhelp, and thefraggle.com website, but now has been retired to being a development machine and tertiary mail exchanger.</li>
<li>laptop &#8211; centrino duo 1.7ghz 1gb ram; work laptop with winxp / debian etch for work stuff</li>
</ul>
<p>There&#8217;s actually another box there, my dads p4 3ghz, that I have pretty much nicked off him for day to day internetting <img src='http://www.thefraggle.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I suppose the fact that I have three servers kind of means I am pretty geeky?</p>
<p>Would be interesting if anyone reading this also commented with what they use <img src='http://www.thefraggle.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefraggle.com/2007/04/13/the-number-of-servers-you-run/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cat can have some handy features too.</title>
		<link>http://www.thefraggle.com/2007/04/03/cat-can-have-some-handy-features-too/</link>
		<comments>http://www.thefraggle.com/2007/04/03/cat-can-have-some-handy-features-too/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 21:56:11 +0000</pubDate>
		<dc:creator>Chris Ganderton</dc:creator>
				<category><![CDATA[General Life]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.thefraggle.com/wordpress/?p=34</guid>
		<description><![CDATA[Another nifty thing I figured out a while ago, whilst having to upload a script written by one of the guys we support, in a windows editor, was how to check quickley and easily with cat(1)whether it had silly windows CR/LF&#8217;s : cat -ev /path/to/file Would output something like the following if the file had [...]]]></description>
			<content:encoded><![CDATA[<p>Another nifty thing I figured out a while ago, whilst having to upload a script written by one of the guys we support, in a windows editor, was how to check quickley and easily with cat(1)whether it had silly windows CR/LF&#8217;s :</p>
<pre>cat -ev /path/to/file</pre>
<p>Would output something like the following if the file had silly line endings&#8230;</p>
<pre>
This is some text written in windaz^M$
And another line edited in windaz, woo^M$</pre>
<p>cat suffixes the end of line with a $ and shows any special characters that have been inserted, in our case here ^M is the windows special character for new line, so all you need to do is remove that, which is again pretty easy:</p>
<pre>sed -i.bak -sed -e "s/r//g" /path/to/file</pre>
<p>Should remove the windaz file endings from the file, copying the file with a .bak suffi as a backup.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefraggle.com/2007/04/03/cat-can-have-some-handy-features-too/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sfdisk is quite handy</title>
		<link>http://www.thefraggle.com/2007/04/03/sfdisk-is-quite-handy/</link>
		<comments>http://www.thefraggle.com/2007/04/03/sfdisk-is-quite-handy/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 21:41:49 +0000</pubDate>
		<dc:creator>Chris Ganderton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.thefraggle.com/wordpress/?p=33</guid>
		<description><![CDATA[So today I had to basically clone a hard disk from a failing disk, to a new disk Sun had sent for one of the v20z&#8217;s at work&#8230; Haven&#8217;t not had to mess about with partition tables and other such things outside of the installer in linux for some time (last time I did this [...]]]></description>
			<content:encoded><![CDATA[<p>So today I had to basically clone a hard disk from a failing disk, to a new disk Sun had sent for one of the v20z&#8217;s at work&#8230;  Haven&#8217;t not had to mess about with partition tables and other such things outside of the installer in linux for some time (last time I did this kind of messing about was with freebsd which uses slices-&gt;partitions, unlike linux and it&#8217;s mad idea of partitions and extended partitions), so I had to take stock for a short while while I figured out the best way to go ahead.  Here&#8217;s what I started with :</p>
<blockquote><p>
/dev/sda &#8211; main scsi hard disk at scsi id 0<br />
/dev/sdb &#8211; new replacement disk at scsi id 1
</p></blockquote>
<p>Saving and restorring the partition table to the sdb was as easy as:  </p>
<p><code>sfdisk -d /dev/sda &gt; /tmp/sda-parttable.out</code>  </p>
<p>and then:  </p>
<p><code>cat /tmp/sda-parttable.out | sdisk /dev/sdb </code>  </p>
<p>I&#8217;d never realised sfdisk could do easy things like that, which saved me some time having to input partition boundries by hand <img src='http://www.thefraggle.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   What next was a bit of a pain was getting files over to the new filesystems (obviously once I had created new filesystems on them and mounted them somewhere easy to use &#8211; /mnt/newroot). I had looked at possibly using cpio to do this, and considered dd.  </p>
<p>It seemed the best in the end, to create tar archives of the data, so that if I made a mess of the new disk I could at least quickly extract the backups again without too much faff, to do this I simply archived up each partition using something along the lines of:  </p>
<p><code>tar --preserve --one-file-system -vcf /mnt/newroot/root.tar /</code></p>
<p>this archived the root into /mnt/newroot/root.tar, but diddn&#8217;t traverse into new directories, &#8211;one-file-system is a pretty handy feature of tar and I&#8217;m sure it&#8217;ll come in useful again sometime in the future.  Tomorrow I&#8217;ll update with how easy it was to install the new mbr to sdb and how removing the origional disk and moving sdb to sda&#8217;s slot, goes <img src='http://www.thefraggle.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefraggle.com/2007/04/03/sfdisk-is-quite-handy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

