<?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>pixelchaos.net</title>
	<atom:link href="http://www.pixelchaos.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pixelchaos.net</link>
	<description>random bits for your terminal</description>
	<lastBuildDate>Sat, 17 Mar 2012 06:38:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Scalable DNS with AnyCast</title>
		<link>http://www.pixelchaos.net/2012/03/17/scalable-dns-with-anycast/</link>
		<comments>http://www.pixelchaos.net/2012/03/17/scalable-dns-with-anycast/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 05:59:25 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=212</guid>
		<description><![CDATA[A while back I was faced with a problem. The existing recursive DNS infrastructure in the datacenters were built on a traditional, common scaling design. We had a handful of DNS servers that were spread across the datacenters and stuck behind different flavors of load balancing. There were six or seven different resolver IP&#8217;s that [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I was faced with a problem. The existing recursive DNS infrastructure in the datacenters were built on a traditional, common scaling design. We had a handful of DNS servers that were spread across the datacenters and stuck behind different flavors of load balancing. There were six or seven different resolver IP&#8217;s that hosts were pointed at depending on various factors. They all ran <a href="http://www.isc.org/software/bind" target="_blank">ISC BIND</a>. Some used Cisco load balancers, some <a href="http://www.riverbed.com/us/products/stingray/stingray_tm.php" target="_blank">Zeus</a>, some <a href="http://horms.net/projects/ldirectord/" target="_blank">ldirectord</a>. These aren&#8217;t necessarily bad solutions to the problem of scaling and high availability but we were running into problems when reaching the 40,000 query per second range. Interrupt driven kernels will experience live locking without some kind of trickery to avoid it. Load balancers are expensive and can be a single point of failure if you don&#8217;t double up hardware and so forth. This whole setup was complicated, expensive, and didn&#8217;t scale as easily as it could.</p>
<p>There had to be a better way.</p>
<p>After some research and design discussions I came up with a pretty elegant solution that solved all the above problems and was radically cheaper and simpler.</p>
<p><strong>The Solution</strong><br />
The final implementation used a simple, and at this point well proven, technology: <a href="http://en.wikipedia.org/wiki/Anycast" target="_blank">AnyCast</a>. At the time AnyCast was fairly new on the infrastructure scene but it had a number of advantages. First of all it&#8217;s simple. You need no special hardware beyond the layer 3 switches you probably already have. The implementation is just a few lines in IOS and you&#8217;re up and running with a route and SLA check. Since the switches handle all the load balancing you can get rid of all that expensive load balancing gear with its added complexity.</p>
<p>Now that you have no load balancers to worry about you can just throw cheap, entry level nodes around every datacenter and point the AnyCast routes to them. In our case we just used cheap dual core boxes with 2GB of RAM each. Nothing special. This is horizontal scaling at it&#8217;s finest.</p>
<p>The final trick was to get rid of ISC BIND and replace it with <a href="http://unbound.net/" target="_blank">unbound</a>. Now, don&#8217;t get me wrong, ISC BIND works great and we could have continued to use it. There were a couple considerations that drove the decision for unbound however. First of all it performs nearly an order of magnitude better on the same hardware. Second, it does one thing and does it well &#8211; recursive queries and caching. Because of that its configuration is much simpler as well.</p>
<p>The deployment today consists of 16 AnyCast endpoints that are servicing an aggregate load of about 80,000 queries per second and could easily support much more than that. Initial performance testing showed that those cheap dual core hosts can support a query load of about 20,000 queries per second each.</p>
<p>A nice, clean setup that is simple and cheap. Perfect.</p>
<p><strong>Design Considerations</strong><br />
There are a few things to be aware of when designing a system like this however.</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Cisco_Express_Forwarding" target="_blank">CEF</a> and <a href="http://en.wikipedia.org/wiki/Exclusive_or" target="_blank">XOR</a> : Cisco gear has to make a decision on where to route inbound queries when there are multiple endpoints that have identical route distances. This ends up being a pseudo-load balancing in practice because it is not round robin. The switch decides where to route packets by XOR&#8217;ing the last two octets of the source and destination IP&#8217;s. The balance of traffic across a pool of endpoints ends up being pretty close to even but it&#8217;s not perfect. You have to be aware of this slight traffic imbalance when capacity planning.</li>
<li>Number of endpoints : CEF on Cisco devices currently only supports a maximum of 16 endpoints per device. In practice this isnt a practical problem though. It&#8217;s just something to be aware of.</li>
<li>More general capacity planning : If you were to ever lose the route to a switch, however unlikely, AnyCast will fail ALL the traffic destined to those endpoints to the next lowest cost route. If you dont plan for that you&#8217;ll send too much traffic to the next cluster of nodes which will DoS it and make the SLA checks fail. AnyCast will then send all the original traffic, and all the traffic for cluster number 2, on to the third cluster and so forth. Cascading failure of your whole infrastructure can happen.</li>
<li>Troubleshooting : It&#8217;s somewhat more complicated to know where traffic from a given DNS query is being routed. You have to dig around a lot to figure this out if there is a problem. It&#8217;s not impossible&#8230; just not as straightforward as designs that have a single cluster with a single virtual IP taking in all the inbound queries.</li>
</ul>
<p>Beyond those few considerations though, a setup like this is quite reliable, endlessly scalable, and offers the ability to have a single DNS query target for all hosts across all datacenters.</p>
<p>Pretty nice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2012/03/17/scalable-dns-with-anycast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building scalable metric collection</title>
		<link>http://www.pixelchaos.net/2012/02/26/building-scalable-metric-collection/</link>
		<comments>http://www.pixelchaos.net/2012/02/26/building-scalable-metric-collection/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 22:55:13 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=179</guid>
		<description><![CDATA[The Problem Say you have thousands of hosts and want to collect tens of metrics from each one for analysis and alerting. Tools like cacti and munin simply dont scale up these levels. The very paradigm they operate under (a centralized database and data pull) is inherently flawed when working with these kinds of data [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Problem</strong></p>
<p>Say you have thousands of hosts and want to collect tens of metrics from each one for analysis and alerting. Tools like <a href="http://www.cacti.net/" target="_blank">cacti</a> and <a href="http://munin-monitoring.org/" target="_blank">munin</a> simply dont scale up these levels. The very paradigm they operate under (a centralized database and data pull) is inherently flawed when working with these kinds of data sets. Furthermore, they are fairly inflexible when considering the almost daily changing requirements of engineers and developers. Generating customized graphs for one-off views of interesting metrics is difficult at best.</p>
<p>At my employer we currently monitor about 18,000 hosts and the number is constantly growing. Centralized polling systems like cacti and munin are in use but only on subsets of hosts for the very reasons already stated. Try plugging 10,000 devices into cacti and it will die in a fire pretty quickly no matter how good the hardware is. Some modest numbers:</p>
<p><code>18000 hosts<br />
10 metrics per host<br />
10 second collection interval<br />
13 months retention<br />
------------------------------<br />
606,528,000,000 data points</code></p>
<p>Approximately six hundred billion data points to store, index, search, and somehow render on demand. Using RRD type databases (as cacti and other tools do) you can get that number way down if you want to sacrifice granularity on older data points. Lets assume that will decrease our data set by two orders of magnitude. Thats still 6,000,000,000 data points. No small challenge.</p>
<p><strong>The Goal</strong></p>
<p>The ideal statistics collection system would be completely distributed. Independent collection agents run on each host using data push, or dedicated hosts use data pull where that isnt possible (SNMP devices). Those agents send metrics into a data store that has no central controller, is distributed with no single point of failure, replicates and mirrors seamlessly, and scales linearly. To generate graphs the ideal tool would also work in a distributed fashion with no single point of failure and use a robust API to render graphs or serve up other data formats (JSON, CSV, etc.) on demand.</p>
<p><strong>The Solution</strong></p>
<p>There are many, many tools out there in the Open Source world for doing one or more of these things. Some scale, some dont, they have varying levels of maturity, and are written in a wide array and languages. You know the story.</p>
<p>All of the tools you&#8217;ll find in the Open Source world fall into one or more of the following five categories;</p>
<ul>Collection<br />
Transport<br />
Processing<br />
Storage<br />
Presentation</ul>
<p><em>Collection</em><br />
<a href="http://collectd.org/" target="_blank">collectd</a> is particularly well suited to the role of collection. It is written in quite clean and well designed C. It uses a data push model and everything is done through plugins. There are hooks for perl, python, and other languages. As an added bonus it can push <a href="http://www.nagios.org/" target="_blank">nagios</a> alerts too.</p>
<p><em>Transport</em><br />
While collectd is perfectly capable of sending data to multicast addresses or even relational databases that isnt a good fit for this problem. The primary concern is that a pool of hosts running carbon-cache may or may not receive the data. This creates consistency issues across the data store. While pushing the data into, say, <a href="http://cassandra.apache.org/" target="_blank">cassandra</a> would be pretty elegant here there is nothing readily written to do that. It&#8217;s also an open question whether the chosen front end can interface well with the cassandra DB. A more straightforward solution in this case would be to use a message queuing system like <a href="http://www.rabbitmq.com/" target="_blank">RabbitMQ</a>. All the collectd daemons push their data to RabbitMQ which then decides which carbon-cache hosts to push given metrics to. You can then make your own decisions on replication logic, datacenter boundaries, etc.</p>
<p><em>Storage</em><br />
There is a great application stack out there that handles storing and retrieving metrics from collectd called <a href="http://graphite.readthedocs.org/" target="_blank">graphite</a>. The storage part of that stack is handled by carbon and whisper. Carbon collects inbound data and writes it to whisper databases which are quite similar in structure to RRD. While carbon has mechanisms to handle replication and sharding built into it, using a message queue is a more elegant solution and offers some interesting advantages for data pool consistency.</p>
<p><em>Presentation</em><br />
Graphite is the obvious choice here. It requires no pre-existing knowledge of the data sets it is going to graph. It has a simple URL API for graph rendering or retrieving data via raw, JSON, CSV, etc. It also allows you to apply <a href="http://graphite.readthedocs.org/en/latest/functions.html" target="_blank">useful functions</a> against the rendered data set.</p>
<p><strong>Conclusions</strong></p>
<p>Using the above stack provides a linearly scaleable, cross-datacenter solution to collecting, storing, and demand-fetching very large numbers of metrics for any operational use. A pilot installation is being turned up as I write this. I will come back with updates and more detailed information if things deviate greatly.</p>
<p><strong>Other Interesting Tools</strong><br />
<a href="http://opentsdb.net/" target="_blank">OpenTSDB</a><br />
<a href="http://labs.omniti.com/labs/reconnoiter" target="_blank">reconnoiter</a><br />
<a href="http://esper.codehaus.org/" target="_blank">esper</a><br />
<a href="http://mbostock.github.com/d3/" target="_blank">d3</a><br />
<a href="https://github.com/etsy/statsd" target="_blank">statsd</a><br />
<a href="http://hadoop.apache.org/" target="_blank">hadoop</a><br />
<a href="http://hbase.apache.org/" target="_blank">hbase</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2012/02/26/building-scalable-metric-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bacula 3.0.1 for Mac OS X</title>
		<link>http://www.pixelchaos.net/2009/07/14/bacula-3-0-1-for-mac-os-x/</link>
		<comments>http://www.pixelchaos.net/2009/07/14/bacula-3-0-1-for-mac-os-x/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 12:56:55 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[Bacula]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=168</guid>
		<description><![CDATA[I wont be doing a build of Bacula for Mac OS X again any time soon, if at all, for a number of reasons; I no longer have access to Mac OS X 10.4 running on an Intel chip I am actively transitioning to BackupPC Below youll find the method I have been using to [...]]]></description>
			<content:encoded><![CDATA[<p>I wont be doing a build of Bacula for Mac OS X again any time soon, if at all, for a number of reasons;</p>
<ol>
<li>I no longer have access to Mac OS X 10.4 running on an Intel chip</li>
<li>I am actively transitioning to BackupPC</li>
</ol>
<p>Below youll find the method I have been using to construct all the .pkg installers youll find on this site. If you have any questions about the process please post them in the comments.</p>
<p><span id="more-168"></span></p>
<p>You will need at least three installations of Mac OS X &#8211; one 10.4 on PPC, one 10.4 on Intel, and one 10.5 on any architecture. On each 10.4 installation, download the bacula source code, decompress it, and run the following command to compile it in a way that plays nice with the rest of Mac OS X</p>
<pre class="brush: plain; title: ; notranslate">
./configure --prefix=/usr/local --sysconfdir=/usr/local/etc \
--mandir=/usr/local/share/man --enable-client-only \
--with-openssl --with-tcp-wrappers --disable-dependency-tracking \
--with-working-dir=/var/bacula/working
make
</pre>
<p>With that done, copy the compiled binaries from each architecture to your Mac OS X 10.5 installation to build the pkg installer. The files in question are;</p>
<ul>
<li>src/filed/bacula-fd</li>
<li>src/filed/bacula-fd.conf</li>
<li>src/console/bconsole</li>
<li>src/console/bconsole.conf</li>
</ul>
<p>I use the architecture type to give them unique names&#8230; bacula-fd-ppc and bacula-fd-intel for example. After thats done, use lipo to combine the two binaries into one fat multi-arch binary</p>
<pre class="brush: plain; title: ; notranslate">
lipo -create bacula-fd-intel bacula-fd-ppc -output bacula-fd
</pre>
<p>Now do the same for bconsole</p>
<pre class="brush: plain; title: ; notranslate">
lipo -create bconsole-intel bconsole-ppc -output bconsole
</pre>
<p>Having done that you now need to set up a mock directory structure to place the binaries into. You can then use PackageMaker on Mac OS X to build the pkg installer from that mock directory. My directory looks like this;</p>
<pre class="brush: plain; title: ; notranslate">
Library
Library/LaunchDaemons
Library/LaunchDaemons/bacula-fd.plist
usr
usr/local
usr/local/bin
usr/local/bin/bconsole
usr/local/etc
usr/local/etc/bacula-fd.conf
usr/local/etc/bconsole.conf
usr/local/sbin
usr/local/sbin/bacula-fd
usr/local/share
usr/local/share/man
usr/local/share/man/man8
usr/local/share/man/man8/bacula-fd.8.gz
usr/local/share/man/man8/bconsole.8.gz
var
var/bacula
var/bacula/working
</pre>
<p>You can see where I&#8217;ve placed bacula-fd and bconsole as well as their conf files. There are some gzipped man pages in there too, which you can grab out of the compiled source tree and gzip manually. Finally there is a .plist file which is required to make auto startup/shutdown of bacula-fd happen on Mac OS X.</p>
<p>The last important bit to note is that I use some modified .conf files which have special placeholders for host names. I then use pre-inst and post-inst scripts in PackageMaker to look for previous versions of packages, insert the current hostname into the .conf files, etc. I have included my source tree and PackageMaker files and scripts below for the last version I released (2.4.4) for your reference.</p>
<p>After all the above is done and the directory structure is all set up you should be able to just fire up PackageMaker, change a few variables in it (set permissions, set version numbers, make sure proper pre and post-inst scripts are being used, etc.) and then build the pkg installer.</p>
<p>Enjoy :)</p>
<p><a href='http://www.pixelchaos.net/wp-content/uploads/2009/07/bacula_244_macosx_source.zip' >bacula_244_macosx_source.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/07/14/bacula-3-0-1-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>list all files with resource forks on Mac OS X</title>
		<link>http://www.pixelchaos.net/2009/06/06/list-all-files-with-resource-forks-on-mac-os-x/</link>
		<comments>http://www.pixelchaos.net/2009/06/06/list-all-files-with-resource-forks-on-mac-os-x/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 11:01:53 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=166</guid>
		<description><![CDATA[This is mostly just a note to myself. If you ever have the need to find all files that contain HFS resource forks on Mac OS X, just use this bit of find magic:]]></description>
			<content:encoded><![CDATA[<p>This is mostly just a note to myself. If you ever have the need to find all files that contain HFS resource forks on Mac OS X, just use this bit of find magic:</p>
<pre class="brush: bash; title: ; notranslate">find . -type f -exec test -s {}/..namedfork/rsrc \; -print</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/06/06/list-all-files-with-resource-forks-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>working with initrd.img files</title>
		<link>http://www.pixelchaos.net/2009/05/28/working-with-initrdimg-files/</link>
		<comments>http://www.pixelchaos.net/2009/05/28/working-with-initrdimg-files/#comments</comments>
		<pubDate>Thu, 28 May 2009 13:41:56 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=104</guid>
		<description><![CDATA[You may have occasion to edit the contents of an initrd.img file. If so, here is how: Extract the contents of the image Now make your edits and then repackage the initrd]]></description>
			<content:encoded><![CDATA[<p>You may have occasion to edit the contents of an initrd.img file. If so, here is how:</p>
<p>Extract the contents of the image</p>
<pre class="brush: plain; title: ; notranslate">gunzip &lt; your-initrd.img | cpio -i --make-directories</pre>
<p>Now make your edits and then repackage the initrd</p>
<pre class="brush: plain; title: ; notranslate">find . | cpio -o -H newc | gzip -9 &gt; your-new-initrd.img</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/05/28/working-with-initrdimg-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>install debian directly onto an AoE root filesystem</title>
		<link>http://www.pixelchaos.net/2009/05/25/install-debian-directly-onto-an-aoe-root-filesystem/</link>
		<comments>http://www.pixelchaos.net/2009/05/25/install-debian-directly-onto-an-aoe-root-filesystem/#comments</comments>
		<pubDate>Tue, 26 May 2009 02:23:16 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[AoE]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HowTo]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=131</guid>
		<description><![CDATA[Something that just about no one out there seems to be doing (yet) is trying to install Debian directly onto network block devices. The Debian installer doesnt support it (yet), grub doesnt support it (usually), and its just generally not an easy thing to do. Now, there are quite a few ways around this problem. [...]]]></description>
			<content:encoded><![CDATA[<p>Something that just about no one out there seems to be doing (yet) is trying to install Debian directly onto network block devices. The Debian installer doesnt support it (yet), grub doesnt support it (usually), and its just generally not an easy thing to do.</p>
<p>Now, there are quite a few ways around this problem. You can install to a &#8216;real&#8217; computer and migrate the installation to a network block device. You can use debootstrap in place of the actual Debian installation system. You can use a combination of these two methods, NFS root filesystems, TFTP hacks, etc. All of these solutions are lacking in my opinion. I want to run the &#8216;real&#8217; debian installer against a network block device and boot my physical hardware using only the built in PXE booting capability of the BIOS.</p>
<p>Taking all these issues as a personal challenge, I&#8217;ve outlined below how to go about using the regular old Debian Lenny installer directly against an AoE block device.<br />
<span id="more-131"></span></p>
<p>First of all, youll need the full installer disc 1 for Lenny. We need one of the .deb&#8217;s thats on that CD. The netinst or businesscard installers will not work with the steps below. (NOTE: If you want to be really creative, I suppose you could download the .deb from within the installer system via wget or even get it before hand and put it on a thumb drive or something&#8230;)</p>
<p>1. Boot the lenny install cd just to the point that /cdrom is mounted. For me, that was the &#8220;Configure the network&#8221; prompt.</p>
<p>2. Switch to a virtual terminal by hitting alt-f2.</p>
<p>3. Unpack the .deb that contains the aoe kernel module</p>
<pre class="brush: plain; title: ; notranslate">udpkg --unpack /cdrom/pool/main/l/linux-2.6/linux-image-2.6.26-2-486_2.6.26-15_i386.deb</pre>
<p>4. Now load the kernel module we just unpacked</p>
<pre class="brush: plain; title: ; notranslate">insmod /lib/modules/2.6.26-2-486/kernel/drivers/block/aoe/aoe.ko</pre>
<p>5. Now we create a symlink to the AoE block device. Its important that we use a symlink at this point in the process since it will cause the installer to set up a lot of paths in the correct fashion.</p>
<pre class="brush: plain; title: ; notranslate">ln -s /dev/etherd/eX.X /dev/sda</pre>
<p>6. Hit alt-f1 and continue with installation until the point that grub fails to install, then switch back to terminal 2.</p>
<p>7. Now chroot into the mostly installed system</p>
<pre class="brush: plain; title: ; notranslate">chroot /target</pre>
<p>8. Install the aoetools package</p>
<pre class="brush: plain; title: ; notranslate">apt-get -y install aoetools</pre>
<p>9. Listed below are two scripts that youll need to get into your chroot environment. They are used to build a new custom initrd image. I find it easiest to put them on a webserver somewhere and wget them.</p>
<pre class="brush: plain; title: ; notranslate">wget http://www.pixelchaos.net/stuff/aoe/hooks/aoetools -O /etc/initramfs-tools/hooks/aoetools
chmod 755 /etc/initramfs-tools/hooks/aoetools
wget http://www.pixelchaos.net/stuff/aoe/scripts/local-top/aoetools -O /etc/initramfs-tools/scripts/local-top/aoetools
chmod 755 /etc/initramfs-tools/scripts/local-top/aoetools</pre>
<p>10. Now we regenerate the initrd image</p>
<pre class="brush: plain; title: ; notranslate">update-initramfs -u -k all</pre>
<p>11. Now that all the above is done, we can manually install grub &#8211; which the debian installer was unable to do.</p>
<pre class="brush: plain; title: ; notranslate">apt-get -y install grub
mkdir /boot/grub
cp -r /usr/lib/grub/i386-pc/. /boot/grub</pre>
<p>12. Now we can remove our old symlink and create some hard links instead. This is required to allow grub to modify the MBR of our block device.</p>
<pre class="brush: plain; title: ; notranslate">rm /dev/sda
ln /dev/etherd/eX.X /dev/sda
ln /dev/etherd/eX.Xp1 /dev/sda1
ln /dev/etherd/eX.Xp5 /dev/sda5</pre>
<p>13. Now update grubs device.map</p>
<pre class="brush: plain; title: ; notranslate">echo &quot;(hd0) /dev/sda&quot; &gt; /boot/grub/device.map</pre>
<p>14. Now run &#8220;grub&#8221; and issue the following commands</p>
<pre class="brush: plain; title: ; notranslate">device (hd0) /dev/sda
root (hd0,0)
setup (hd0)</pre>
<p>15. Now issue the &#8220;update-grub&#8221; command which will generate /boot/grub/menu.lst for the first time</p>
<p>16. Remember that grub has been using the hard link to /dev/sda this whole time. Change the root=/dev/sda1 line in /boot/grub/menu.lst to root=/dev/etherd/eX.Xp1, then issue the &#8220;update-grub&#8221; command again to commit the change to the boot stanzas.</p>
<p>17. For the sake of completeness, lets change grubs device.map back to its original contents.</p>
<pre class="brush: plain; title: ; notranslate">echo &quot;(hd0) /dev/etherd/eX.X&quot; &gt; /boot/grub/device.map</pre>
<p>18. Get out of the chroot environment by issuing the &#8220;exit&#8221; command.</p>
<p>19. Go back to installer and choose &#8220;Continue without boot loader&#8221; to finish the installation and reboot the computer.</p>
<p>Thats it! Assuming you have properly set up a gPXE boot environment everything should &#8220;just work&#8221;. Setting up gPXE is outside the scope of this document but some good notes are available on the etherboot web site (see the links below).</p>
<p>Please note that there is one caveat to this whole process. Grub does not support installation onto AoE block devices. There very well may be some issues the next time you try to upgrade your kernel if some post-inst script calls grub-install against your root device. Keep that in mind.</p>
<p><strong>aoe-hooks script</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh

set  -e

PREREQ=&quot;&quot;

prereqs()
{
echo &quot;$PREREQ&quot;
}

case $1 in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

[ -x /sbin/aoe-discover ] &amp;&amp; copy_exec /sbin/aoe-discover /sbin
manual_add_modules aoe
</pre>
<p><strong>aoe-local-top script</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh

set -e

PREREQ=&quot;udev&quot;

prereqs()
{
echo &quot;$PREREQ&quot;
}

case $1 in
prereqs)
prereqs
exit 0
;;
esac

case $ROOT in
/dev/etherd/e*)
INTERFACES=`sed -ne '/eth.*:/{s/:.*$//;p;}' &lt; /proc/net/dev`
for i in $INTERFACES; do
echo Bringing up interface $i for AoE
ifconfig $i up
done
# Make sure udev has processed all events from adding the NIC
# modules before loading aoe
[ -x /sbin/udevsettle ] &amp;&amp; /sbin/udevsettle --timeout=30
modprobe aoe
# Wait until aoe device files have been generated.
[ -x /sbin/udevsettle ] &amp;&amp; /sbin/udevsettle --timeout=30
aoe-discover
;;
esac
</pre>
<p><strong>references</strong><br />
<a href="http://maht0x0r.blogspot.com/2009/03/installing-debian-5-for-migration-to.html" target="_blank">http://maht0x0r.blogspot.com/2009/03/installing-debian-5-for-migration-to.html</a><br />
<a href="http://www.etherboot.org/wiki/sanboot/debian_and_ubuntu" target="_blank">http://www.etherboot.org/wiki/sanboot/debian_and_ubuntu</a><br />
<a href="http://mike.neir.org/wiki/articles/AoE_Root_Fedora" target="_blank">http://mike.neir.org/wiki/articles/AoE_Root_Fedora</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/05/25/install-debian-directly-onto-an-aoe-root-filesystem/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>openais: an alternative to clvm with cman</title>
		<link>http://www.pixelchaos.net/2009/04/23/openais-an-alternative-to-clvm-with-cman/</link>
		<comments>http://www.pixelchaos.net/2009/04/23/openais-an-alternative-to-clvm-with-cman/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 17:24:29 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=106</guid>
		<description><![CDATA[I&#8217;ve been battling lately with a lot of problems with cman, part of Red Hat Cluster Suite. Specifically, the fencing tool (fenced) is pretty much junk when you try to start using it with Xen dom0&#8242;s. After much searching and gnashing of teeth I happened upon this mailing list post. The promise there is that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been battling lately with a lot of problems with cman, part of Red Hat Cluster Suite. Specifically, the fencing tool (fenced) is pretty much junk when you try to start using it with Xen dom0&#8242;s. After much searching and gnashing of teeth I happened upon <a href="http://xen.markmail.org/message/xrrvmcl7bq6p4pvk?q=clvm+openais">this</a> mailing list post. The promise there is that you could take clvm and compile it against openais and get a cluster aware LVM which doesnt require the rest of Red Hat Cluster Suite (and its crappy documentation, crappy fencing, and general all around crappiness). A little more searching turned up <a href="http://h2o.glou.fr/post/2009/04/20/clvm-openais-on-Debian/Lenny">this</a> web site from Olivier Le Cam which pretty much did 90% of the work for me.</p>
<p>After some testing I&#8217;m happy to say it appears to work smashingly. What follows is a somewhat more complete version of how to achieve the same results on Debian Lenny. Enjoy :)</p>
<p><span id="more-106"></span><br />
The first thing that needs to be done is to get the debian sources for clvm and modify then to use openais. After that we will recompile new packages from that source, then set up openais on our cluster nodes.</p>
<p>Install all the dependencies we need to compile clvm</p>
<pre class="brush: plain; title: ; notranslate">
root@host:~# apt-get build-dep clvm
root@host:~# apt-get install libopenais-dev
</pre>
<p>Now download the source files and cd into our working directory</p>
<pre class="brush: plain; title: ; notranslate">
root@host:~# cd /usr/src/
root@host:/usr/src# apt-get source clvm
root@host:/usr/src# cd lvm2-2.02.39
</pre>
<p>Now we&#8217;ll modify a few files in the source:</p>
<ul>
<li> The first is debian/clvm.init. You&#8217;ll need to remove any references to cman or cluster.conf. You can download an already edited version <a href='http://www.pixelchaos.net/wp-content/uploads/2009/04/clvm.init'>here</a>.</li>
<li>The next is debian/control. Modify the dependies (lvm2 without the version number, openais in place of cman) and modify the comments accordingly. A pre-edited version is <a href='http://www.pixelchaos.net/wp-content/uploads/2009/04/control'>here</a>.</li>
<li> The last file is debian/rules. Replace cman by openais in the configure options, and add the PATH where to find the openais libs. Again, a pre-made version is <a href='http://www.pixelchaos.net/wp-content/uploads/2009/04/rules'>here</a>.</li>
</ul>
<p>For clarities sake, here is the actual code block from debian/rules:</p>
<pre class="brush: plain; title: ; notranslate">
$(STAMPS_DIR)/setup-deb: SOURCE_DIR = $(BUILD_DIR)/source
$(STAMPS_DIR)/setup-deb: DIR = $(BUILD_DIR)/build-deb
$(STAMPS_DIR)/setup-deb: $(STAMPS_DIR)/source
        rm -rf $(DIR)
        cp -al $(SOURCE_DIR) $(DIR)
        cd $(DIR); \
        ./configure CFLAGS=&quot;$(CFLAGS)&quot; \
		LDFLAGS=&quot;-L/usr/lib/openais&quot; \
                $(CONFIGURE_FLAGS) \
                --with-optimisation=&quot;&quot; \
                --with-clvmd=openais \
                --enable-readline
        touch $@
</pre>
<p>The last thing to do is update the internal version number of the clvm package and add some comments to the changelog:</p>
<pre class="brush: plain; title: ; notranslate">
root@host:/usr/src/lm2-2.02.39# dch -i
</pre>
<p>Now go ahead and compile the package:</p>
<pre class="brush: plain; title: ; notranslate">
root@host:/usr/src/lm2-2.02.39# dpkg-buildpackage -rfakeroot -uc -b
</pre>
<p>After the compliation completes you should have some shiny new .deb files in /usr/src. The one we are interested in is clvm_2.02.39-7.1_i386.deb (the actual version of yours may vary depending on what you put in the debian changelog in the previous step).</p>
<p>So now that weve got our custom version of clvm compiled, its time to move on the cluster nodes. On each node in the cluster, do the following&#8230;</p>
<p>Install openais and add a user for it:</p>
<pre class="brush: plain; title: ; notranslate">
root@node:~# apt-get install openais
root@node:~# mkdir -p /etc/ais
root@node:~# adduser --no-create-home --disabled-password --disabled-login --gecos openAIS ais
</pre>
<p>Now create the following config in /etc/ais/openais.conf. This is the most basic config you can have. All you need to do is set 192.168.1.0 to be your actual network address.</p>
<pre class="brush: plain; title: ; notranslate">
totem {
        version: 2
        secauth: off
        threads: 0
        interface {
                ringnumber: 0
                bindnetaddr: 192.168.1.0
                mcastaddr: 226.94.1.1
                mcastport: 5405
        }
}
</pre>
<p>openais does not include a proper debian init sript so you can download one <a href="http://www.pixelchaos.net/wp-content/uploads/2009/04/openais.init">here</a> and save it as /etc/init.d/openais. After that is done, add it to the proper runlevels by issuing:</p>
<pre class="brush: plain; title: ; notranslate">
root@node:~# update-rc.d openais start 62 S . start 50 0 6 .
</pre>
<p>Now we can install our custom deb and turn on LVM clustering</p>
<pre class="brush: plain; title: ; notranslate">
root@node:~# dpkg -i clvm_2.02.39-7.1_i386.deb
root@node:~# sed -i 's/^    locking_type = 1$/    locking_type = 3/' /etc/lvm/lvm.conf
</pre>
<p>Thats it! Reboot your cluster nodes and they should all be cluster aware now :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/04/23/openais-an-alternative-to-clvm-with-cman/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>sata_mv timeouts fixed</title>
		<link>http://www.pixelchaos.net/2009/04/08/sata_mv-timeouts-fixed/</link>
		<comments>http://www.pixelchaos.net/2009/04/08/sata_mv-timeouts-fixed/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 14:33:32 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=101</guid>
		<description><![CDATA[Well isnt this a happy day for owners of the Supermicro 8-Port SATA Card AOC-SAT2-MV8. It appears a long standing issue with port timeouts has been fixed. See the lkml.org mailing list post here &#8230; and the townspeople rejoiced :)]]></description>
			<content:encoded><![CDATA[<p>Well isnt this a happy day for owners of the Supermicro 8-Port SATA Card AOC-SAT2-MV8. It appears a long standing issue with port timeouts has been fixed.</p>
<p>See the lkml.org mailing list post <a href="http://lkml.org/lkml/2009/1/30/462">here</a></p>
<p>&#8230; and the townspeople rejoiced :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/04/08/sata_mv-timeouts-fixed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>diskless booting with PXE and NFS</title>
		<link>http://www.pixelchaos.net/2009/02/15/diskless-booting-with-pxe-and-nfs/</link>
		<comments>http://www.pixelchaos.net/2009/02/15/diskless-booting-with-pxe-and-nfs/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 15:10:42 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=89</guid>
		<description><![CDATA[For a long time now I&#8217;ve wanted to set up all my mythfrontends to be diskless nodes that boot via PXE using an NFS share as their root filesystem. I finally got around to doing this. I was even able to just migrate my existing installations directly into the PXE boot environment. Here is how [...]]]></description>
			<content:encoded><![CDATA[<p>For a long time now I&#8217;ve wanted to set up all my mythfrontends to be diskless nodes that boot via PXE using an NFS share as their root filesystem. I finally got around to doing this. I was even able to just migrate my existing installations directly into the PXE boot environment. Here is how I accomplished it&#8230;</p>
<p><span id="more-89"></span></p>
<p>The first thing youll need is a TFTP server. This will serve out the kernel and initrd images to clients on the network.</p>
<pre class="brush: plain; title: ; notranslate">
root@pxe:~$ apt-get install tftpd-hpa
</pre>
<p>That will install a good tftp server daemon and create the tftp root for you in /var/lib/tftpboot. Some HOWTO&#8217;s on the Internet suggest installing the syslinux package as well which provides a needed file (pxelinux.0). I prefer to download the entire netboot environment for debian since this will also provide a network bootable installer for Debian on top of the other goodness we are creating today.</p>
<pre class="brush: plain; title: ; notranslate">
root@pxe:~$ cd /var/lib/tftpboot
root@pxe:~$ wget http://ftp.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/netboot.tar.gz
root@pxe:~$ tar xzvf netboot.tar.gz
</pre>
<p>The kernel and initrd you are going to use to boot the mythbox must reside on the TFTP server. Furthermore, the initrd must be updated to support NFS root. On the mythbox I was migrating to the NFS root, it looked like this:</p>
<pre class="brush: plain; title: ; notranslate">
root@mythbox:~$ sed -i 's/BOOT=local/BOOT=nfs/'  /etc/initramfs-tools/initramfs.conf
root@mythbox:~$ /usr/sbin/mkinitramfs -o /boot/initrd.img-2.6.26-1-686_netboot
</pre>
<p>Now just copy the /boot/vmlinuz-2.6.26-1-686 and /boot/initrd.img-2.6.26-1-686_netboot to /var/lib/tftpboot/ on the TFTP server.</p>
<p>Last step for the TFTP server is to create a config file for our mythbox. If you dont create one specifically for it, it will instead boot the network installer as mentioned above. Create the file /var/lib/tftpboot/pxelinux.cfg/01-$(hardware ethernet address). Including the hardware address in the file name binds that config to the particular workstation we are working on today. In my case, the file name is 01-00-19-db-4a-6a-0e.</p>
<pre class="brush: plain; title: ; notranslate">
LABEL linux
KERNEL vmlinuz-2.6.26-1-686
APPEND root=/dev/nfs initrd=initrd.img-2.6.26-1-686_netboot nfsroot=192.168.1.108:/srv/nfs/mythbox.pixelchaos.net ip=dhcp rw
</pre>
<p>Now that our TFTP server is up and running we will next need to configure a DHCP server to provide IP addresses to netboot clients, as well as point them to the TFTP server to continue the boot process.</p>
<pre class="brush: plain; title: ; notranslate">
root@dhcp:~$ apt-get install dhcp3-server
</pre>
<p>That will install the DHCP service for you. Now we just need to add one little section to /etc/dhcp3/dhcpd.conf for the workstation we are going to netboot.</p>
<pre class="brush: plain; title: ; notranslate">
host mythbox {
hardware ethernet 00:19:db:4a:6a:0e;
fixed-address mythbox.pixelchaos.net;
filename &quot;pxelinux.0&quot;;
next-server 192.168.1.115;
}
</pre>
<p>host mythbox: mythbox is just the descriptive name for this configuration block .You can use any name you like.<br />
hardware ethernet 00:19:db:4a:6a:0e: This is the hardware ethernet address of the workstation we are netbooting.<br />
fixed-address mythbox.pixelchaos.net: This tells the DHCP server what address to assign the mythbox. You can use a FQDN (if its resolvable!) or an IP address.<br />
filename &#8220;pxelinux.0&#8243;: This is the PXE boot loader file that we installed onto our TFTP server earlier.<br />
next-server 192.168.1.115: This is the IP address of our TFTP server. It tells the mythbox where the &#8220;next server&#8221; is after it gets its IP address from the DHCP server. The &#8220;next server&#8221; can be any machine on the network. It can even be the same one running DHCP.</p>
<p>Once all that is done, restart your DHCP server.</p>
<pre class="brush: plain; title: ; notranslate">
root@dhcp:~$ /etc/init.d/dhcp3-server restart
</pre>
<p>Now for the third piece of the puzzle, our NFS root filesystem. You&#8217;ll first need to create a directory to share.</p>
<pre class="brush: plain; title: ; notranslate">
root@nfs:~$ mkdir /srv/nfs/mythbox.pixelchaos.net
</pre>
<p>Now add that directory to /etc/exports so that it gets shared via NFS with this line:</p>
<pre class="brush: plain; title: ; notranslate">
/srv/nfs/mythbox.pixelchaos.net mythbox(rw,async,no_root_squash)
</pre>
<p>The rw, async, and no_root_squash options are important. Dont omit them. At this point we can reload all our NFS exports to active this new share point.</p>
<pre class="brush: plain; title: ; notranslate">
root@nfs:~$ exportfs -rv
</pre>
<p>At this point the entire TFTP, DHCP, and NFS parts of the environment are ready to go. Now we will migrate our existing installation of Linux from the mythbox onto its new nfsroot. First we make a directory to mount the NFS share on and then mount it.</p>
<pre class="brush: plain; title: ; notranslate">
root@mythbox:~$ mkdir /mnt/nfs
root@mythbox:~$ mount -t nfs -o nolock 192.168.1.108:/srv/nfs/mythbox.pixelchaos.net /mnt/nfs
</pre>
<p>Now we run a cp command on every locally mounted partition, as well as /dev. On my mythbox it looked like this:</p>
<pre class="brush: plain; title: ; notranslate">
root@mythbox:~$ cp -axv /. /mnt/nfs/.
root@mythbox:~$ cp -axv /boot/. /mnt/nfs/boot/.
root@mythbox:~$ cp -axv /home/. /mnt/nfs/home/.
root@mythbox:~$ cp -axv /dev/. /mnt/nfs/dev/.
</pre>
<p>The last thing to do is edit two files that we copied up to /mnt/nfs. The first is /mnt/nfs/etc/network/interfaces. You&#8217;ll need to remove any lines that bring the interface up automatically. You want to remove anything like &#8220;allow-hotplug eth0&#8243; and just leave a single line like &#8220;iface eth0 inet dhcp&#8221;. The network interface will have already been brought up by netboot normally and leaving in any &#8220;hotplug&#8221; or &#8220;auto&#8221; lines will bring it up again, which has the effect of destroying it.</p>
<p>Now we remove all the old filesystems from /mnt/nfs/etc/fstab so that it looks like this:</p>
<pre class="brush: plain; title: ; notranslate">
# /etc/fstab: static file system information.
#
# &lt;file system&gt; 		&lt;mount point&gt;   	&lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt;
/dev/nfs        /               nfs     defaults 0 0
none            /tmp            tmpfs   defaults 0 0
none            /var/run        tmpfs   defaults 0 0
none            /var/lock       tmpfs   defaults 0 0
none            /var/tmp        tmpfs   defaults 0 0
none            /media          tmpfs   defaults 0 0
</pre>
<p>That should be it. Now just set the mythbox to use network booting in its BIOS and reboot.</p>
<p>Cool, huh? :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/02/15/diskless-booting-with-pxe-and-nfs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bacula 2.4.4 for Mac OS X</title>
		<link>http://www.pixelchaos.net/2009/01/20/bacula-244-for-mac-os-x/</link>
		<comments>http://www.pixelchaos.net/2009/01/20/bacula-244-for-mac-os-x/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 16:15:11 +0000</pubDate>
		<dc:creator>jlott</dc:creator>
				<category><![CDATA[Bacula]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.pixelchaos.net/?p=83</guid>
		<description><![CDATA[Another update to the bacula client and bconsole for Mac OS X. This should install and run properly on (at least) Mac OS X 10.4 and 10.5 for both Intel and PowerPC. Upgrades from old versions are handled in an intelligent fashion as well. Enjoy! bacula-client-244-1]]></description>
			<content:encoded><![CDATA[<p>Another update to the bacula client and bconsole for Mac OS X. This should install and run properly on (at least) Mac OS X 10.4 and 10.5 for both Intel and PowerPC. Upgrades from old versions are handled in an intelligent fashion as well.</p>
<p>Enjoy!<br />
<a href='http://www.pixelchaos.net/wp-content/uploads/2009/01/bacula-client-244-1.zip'>bacula-client-244-1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelchaos.net/2009/01/20/bacula-244-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

