tag:blogger.com,1999:blog-38596060871847381732024-03-13T06:51:17.796-07:00Just what do you think you're doing, Dave?Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-3859606087184738173.post-60849666226000888602014-01-16T00:32:00.000-08:002014-01-16T00:32:17.268-08:00RE Golfhttp://regex.alf.nu/ has a fabby little puzzle 'regular expression golf' which has taken up far too much of my time, but got a tidy score of 3673 and learned all about backreferences.<br />
<br />
My Answers:<br />
<br />
<ul>
<li>Plain Strings (207) - foo</li>
<li></li>
<li>Anchors (208) - k$</li>
<li>Ranges (199) - ^[abcdef]*$</li>
<li>Backrefs (195) - (.)([^a]).*\1\2</li>
<li>Abba (190) - ^((?!(.)(.)\3\2).)*$</li>
<li>A man, a plan (168) - (.)(.)(.)?.?(\3?\2\1)$</li>
<li>Prime (201) - ^x(x*)\1$</li>
<li>Four (198) - (.).\1.\1.\1</li>
<li>Order (198) - ^.....[^e]?$</li>
<li>Triples (561) - [031][0][3694]|[053][126][25]|[7][14][4]|^0*$|217|422|895|914|177|734</li>
<li>Glob (349) - err|lle|tud|ogi|ide|ris|hob|ney|orl|tef|igh|ark|tog|rom|ial|ppe|der|thw</li>
<li>Balance (267) - ^((?!<<>>>|<><>>|<<<<<<)<(<>|<<|>>|><)*>)?$</li>
<li>Powers (63) - ^(((((((x|xxxxxxxx)\7?)\6?)\5?)\4?)\3?)\2?)\1?$</li>
<li>Long count (192) - 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 111</li>
<li>Long count v2 (212) - 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 101</li>
<li>Alphabetical (265) - te [ea][aes][sr]|st ar|nt ass|rn re|at en|(ne|et|ar|ta) te|(st|er) sn|ee ta</li>
</ul>
I probably cheated on Glob, having given up with trying to match the subtleties of the semantics of a glob * on the left & right.<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-18443816969215691252014-01-01T10:21:00.001-08:002014-01-01T12:07:47.964-08:00Chicken Mulligatawny<br />
<h3>
<u>Ingredients</u></h3>
<div style="background-color: white;">
<br />
<ul>
<li><span style="color: #222222;"><span style="font-family: inherit;">couple of chicken legs</span></span></li>
<li style="color: #222222;"><span style="font-family: inherit;">olive oil</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 onion</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">3 cloves garlic</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 carrot</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 sweet pepper red (not green - sour flavour)</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 eating apple </span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 tube tomato puree</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">2 tsp curry powder</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 tsp coriander</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 tsp cumin</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">1 tin green lentils</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">handful long grain rice (easy cook is good)</span></li>
<li style="color: #222222;"><span style="font-family: inherit;">salt & pepper</span></li>
<li><span style="color: #222222;"><span style="font-family: inherit;">dash of cream to serve</span></span></li>
</ul>
</div>
<h3>
<span style="background-color: transparent;">Steps</span></h3>
<div>
<ol>
<li>Half the onion, place in a pan (with well-fitting lid) with the chicken legs. Cover with water, bring to the boil then simmer for several hours - or overnight.</li>
<li>Pour the liquid (stock) off the chicken into another container, then remove the cooked chicken legs and set aside the onion.</li>
<li>Pull the chicken apart, carefully separating the meat from the skin & bone. Slice the meat - aiming for around 5mm square pieces and place in a clean pan. Discard the skin/bones. </li>
<li>Chop the onion into similar sized pieces (5mm) and add to the chicken</li>
<li>Chop the remaining vegetables - carrot, peppers and apple to similar sized pieces and put in the pan with the chicken and onion.</li>
<li>Finely chop the garlic and add</li>
<li>Add the rest of the spices, tomato puree lentils and the handful of rice.</li>
<li>Skim the fat off the chicken stock and then add the stock back in with the chicken and other ingredients.</li>
<li>Gently stir, heat and simmer the soup for 20 minutes until the rice is cooked.</li>
<li>Serve - adding a dash of cream to each bowl.</li>
</ol>
<h3>
Alternative</h3>
</div>
<div>
Instead of using the chicken leg, use the leftovers from a roast chicken - strip the remaining meat and use a pint water/chicken stock cube in place of the stock made above.</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-30549007745115342772013-12-30T04:53:00.001-08:002013-12-31T04:54:30.842-08:00Windows 8.1 upgrade on Virtual boxWanted to update the Windows 8 VM I keep handy on my MacBook Air to Windows 8.1 but:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_IwzWySiHC0/UsFpJZnCWFI/AAAAAAAAAGM/3Qhx1imfW6I/s1600/win8+%5BRunning%5D+2013-12-29+10-12-31.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="http://4.bp.blogspot.com/-_IwzWySiHC0/UsFpJZnCWFI/AAAAAAAAAGM/3Qhx1imfW6I/s320/win8+%5BRunning%5D+2013-12-29+10-12-31.jpg" width="320" /></a></div>
<div>
The more info being:</div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-wYLmUitTNtg/UsFpAU6JSkI/AAAAAAAAAGE/wVdq1qasjyE/s1600/win8+%5BRunning%5D+2013-12-29+10-11-36.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="231" src="http://2.bp.blogspot.com/-wYLmUitTNtg/UsFpAU6JSkI/AAAAAAAAAGE/wVdq1qasjyE/s320/win8+%5BRunning%5D+2013-12-29+10-11-36.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
OK sounds easy - first tried turning on PAE and NX in the virtual box settings, rebooted and retried. But the same error occurs.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-pqTrna7FRFM/UsFqiwmSs9I/AAAAAAAAAGc/Sgg3eOnLk3U/s1600/win8+-+System+2013-12-29+10-16-48.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="105" src="http://1.bp.blogspot.com/-pqTrna7FRFM/UsFqiwmSs9I/AAAAAAAAAGc/Sgg3eOnLk3U/s320/win8+-+System+2013-12-29+10-16-48.jpg" width="320" /></a></div>
<br />
<div>
Quick google later and discovered it's connected to this <a href="https://www.virtualbox.org/ticket/11899" target="_blank">Bug 11899</a> - <span style="background-color: white; font-family: Verdana, 'Bitstream Vera Sans', sans-serif; font-size: 13px;">CMPXCHG16B instruction is disabled by default. Enabled it for this VM:</span></div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">vboxmanage setextradata "win8" VBoxInternal/CPUM/CMPXCHG16B 1</span></blockquote>
<div>
Also needed to enable 3D on the graphics card:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-hytqiSJnUg0/UsFqi2Wao0I/AAAAAAAAAGg/Nai8ltE72Fc/s1600/win8+-+Display+2013-12-29+10-17-29.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="http://4.bp.blogspot.com/-hytqiSJnUg0/UsFqi2Wao0I/AAAAAAAAAGg/Nai8ltE72Fc/s320/win8+-+Display+2013-12-29+10-17-29.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
And then sucessfully installed the update:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-oZbHjIdm89Q/UsFrNYDJN4I/AAAAAAAAAGw/ySaAKnB-fCI/s1600/win8+%5BRunning%5D+2013-12-29+10-18-06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="89" src="http://4.bp.blogspot.com/-oZbHjIdm89Q/UsFrNYDJN4I/AAAAAAAAAGw/ySaAKnB-fCI/s320/win8+%5BRunning%5D+2013-12-29+10-18-06.jpg" width="320" /></a></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-33768689059269741542013-12-17T14:24:00.000-08:002013-12-17T14:24:14.081-08:00Shredded Beef for Tacos<br />
<h2>
Shredded Beef for Tacos</h2>
<div>
Serves 8</div>
<h3>
Ingredients</h3>
<ul>
<li>1.2Kg pack flank steak (Costco) or 2-3lb of lean braising/stewing steak</li>
<li>2 medium onions, chopped</li>
<li>4-5 cloves garlic</li>
<li>2-3 red chilies</li>
<li>1-2 tsp dried oregano</li>
<li>2 tsp ground coriander</li>
<li>2 tsp smoked paprika</li>
<li>good pinch ground white pepper</li>
<li>good pinch salt</li>
<li>2 tbsp red wine vinegar</li>
<li>1 tbsp black treacle</li>
</ul>
<h3>
Method</h3>
<div>
Sear the beef pieces, place in a pan with a good fitting lid or slow cooker with the other ingredients. give it all a good swish round to mix. </div>
<div>
<br /></div>
<div>
Cook for around 6-8 hours until the beef easily falls apart. then with a fork shred the beef (the onions etc will be very soft by now too).</div>
<h3>
Serving</h3>
<div>
Serve with warmed crispy tacos, sour cream, sliced peppers salad and cheese & fresh coriander.</div>
<div>
<br /></div>
<div>
Supermarket mini salsa/guacamole/sour cream combo is hard to beat for value.</div>
<h3>
Storage</h3>
<div>
Once cooled this freezes very well.</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-80370295861748115582013-11-26T02:49:00.002-08:002013-11-26T02:49:47.607-08:00Fix the Mac OS printer setup to work with a network Samsung printer 2013<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-dVmnNuIwidg/UpR14zyoL_I/AAAAAAAAAFQ/8Hllj7H2hGc/s1600/MacPlusSamsung.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="http://4.bp.blogspot.com/-dVmnNuIwidg/UpR14zyoL_I/AAAAAAAAAFQ/8Hllj7H2hGc/s400/MacPlusSamsung.png" width="400" /></a></div>
<br />
<br />
We use a Samsung CLP-6220 network printer from a variety of PC and Mac hardware. It's a great printer - does double sided A4 colour which is just what I need for printed reports. Just one problem - more often than not when printing from one of the Macs it just doesn't work. The Mac spends ages searching for it on the network and can never find it. The Windows and Linux computers have no problems.<br />
If you follow the help on one of Apple's forums, you can <a href="http://support.apple.com/kb/PH11070" target="_blank">'reset the printer system'</a>. This just deletes all your printers (!), but once you add the printer again it works. OK - so I thought maybe the printer's IP address has changed (because the network uses DHCP), so the mac can't find it any more. So I went into my router control panel and fixed that by adding an Address Reservation so it always gets the same one.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-vmfsdkOwpQw/UpR4N13xZKI/AAAAAAAAAFc/DFNp9PY1QME/s1600/FixIP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="63" src="http://1.bp.blogspot.com/-vmfsdkOwpQw/UpR4N13xZKI/AAAAAAAAAFc/DFNp9PY1QME/s320/FixIP.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
But nope. It doesn't fix it. After living with it for a bit (delete/add the printer sort of works around it although its painful) I had another look. In /etc/cups/printers.conf is the address of the printer. Theres a line in there that specifies the URL for the printer</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><Printer <b><span style="color: red;">Samsung_CLX_6220_Series__SEC001599494557_</span></b>></span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">UUID urn:uuid:6893396a-3732-3c37-6762-23d7856fdb44</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Info Samsung CLX-6220 Series (SEC001599494557)</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">MakeModel Samsung CLX-6220 Series PS</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">D</span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">eviceURI <b><span style="color: blue;">dnssd://Samsung%20CLX-6220%20Series%20(SEC001599494557)._printer._tcp.local./</span></b></span></blockquote>
<div class="separator" style="clear: both; text-align: left;">
It looks like it uses some sort of zeroconf setup so that it <i>should</i> be able to find the printer automatically. It'd be nice if that works!! But it clearly doesn't for my network setup.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
So I tweaked it using the 'lpadmin' tool as root so that its permanently on my fixed IP for the printer</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">sudo lpadmin -p <span style="color: red;">Samsung_CLX_6220_Series__SEC001599494557_ </span>-v socket://192.168.0.11:9100/</span></blockquote>
<div class="separator" style="clear: both; text-align: left;">
So far, it's worked just fine.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-67847730377034629712012-07-06T08:01:00.002-07:002012-07-06T08:01:22.347-07:00Tweak your libvirt XML with XSLTI wanted to clone a KVM VM, and while there a several tools to do the job, I fancied doing it 'the hard way'.<br />
<br />
<h3>
Plan</h3>
<div>
<ol>
<li>Get the libvirt XML definition for the XML</li>
<li>Tweak it with an XSLT stylesheet</li>
<li>Put it back in for the new VM</li>
</ol>
Then I can clone the HD, mount it, change some of the bits in there and voila - new VM.</div>
<h3>
Implementation</h3>
<div>
You need 'xsltproc' to perform the XSLT transformation from the commandline - easy on Ubuntu:</div>
<blockquote class="tr_bq">
# apt-get -y install xsltproc</blockquote>
<div>
Here's the XSL:</div>
<div>
<br /></div>
<div>
<blockquote>
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <!-- tweak libvirt XML file when cloning simple VM --></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <!-- xsltproc --stringparam newUUID 1234-5678-90zbcdef --stringparam newMAC 11:22:33:44:55:66 </span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> --stringparam newNAME fred clone.xsl eg.xml --></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:output omit-xml-declaration="yes" /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:param name="newUUID" select="'XXX-YYY-ZZZ'"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:param name="newMAC" select="'XX:YY:ZZ:XX:YY:ZZ'"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:param name="newNAME" select="'XYZ'"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:param name="newMEMORY" select="'1048575'"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:param name="newROOT" select="'/XYZ/ROOT.qcow'"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="node()|@*"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:copy></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:apply-templates select="node()|@*"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:copy></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="uuid/text()"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:value-of select="$newUUID"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="imagelabel/text()|label/text()"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:text>libvirt-</xsl:text><xsl:value-of select="$newUUID"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="mac/@address"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:attribute name="address"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:value-of select="$newMAC"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:attribute></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="memory/text()|currentMemory/text()"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:value-of select="$newMEMORY"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="/domain/name/text()"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:value-of select="$newNAME"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:template match="disk/source/@file"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:attribute name="file"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <xsl:value-of select="$newROOT"/></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:attribute></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </xsl:template></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"></xsl:stylesheet></span></blockquote>
</div>
<div>
Just needs the parameters specifying to override the sample ones in the scripts when you invoke it...</div>
<div>
<br /></div>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$ xsltproc --stringparam newNAME testvm --stringparam newMAC 11:22:33:44:55:66 clone.xsl oldvm.xml</span></blockquote>
<div>
And the new XML comes out on stdout.</div>
<div>
<br /></div>
<br />
<br />Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-4406506326656567842012-06-13T23:50:00.001-07:002012-06-13T23:58:26.709-07:00Ubuntu NAS - ZFS on the HP Microserver<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-JKapsTXgOl8/T9kPOzU034I/AAAAAAAAACA/CIqPzGzxcKA/s1600/hpmicroserver.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img alt="HP Microserver N40L" border="0" height="200" src="http://1.bp.blogspot.com/-JKapsTXgOl8/T9kPOzU034I/AAAAAAAAACA/CIqPzGzxcKA/s200/hpmicroserver.jpg" title="" width="173" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HP Microserver N40L</td></tr>
</tbody></table>
I had loads of fun setting up <a href="http://www.freenas.org/" target="_blank">FreeNAS</a> on a <a href="http://h10010.www1.hp.com/wwpc/uk/en/sm/WF25a/15351-15351-4237916-4237917-4237917-4248009.html?dnr=1" target="_blank">HP Microserver</a> and can highly recommend this combination for a small home/office file server. But I had a few problems mainly with the performance and stability of the iScsi driver that comes with it. So I decided to pull out the FreeNAS/freebsd root disk and put in a new one on which to check out <a href="http://www.ubuntu.com/" target="_blank">Ubuntu 12.04</a> server in combination with the <a href="https://launchpad.net/~zfs-native/+archive/stable" target="_blank">native linux ZFS filesystem</a>.<br />
<br />
My target was to get 1Gb/s read and write performance out of the little microserver - ideally iScsi, but NFS would be OK too. Amazingly although the former appears to be a little optimistic the latter is acheivable.<br />
<br />
I had setup FreeNAS with 3x2TB disks in a RAIDZ1 array. I replaced the root disk with a new one leaving the 3 ZFS disks in situ and installed ubuntu 12.04 server on the fresh root disk. I created a 'nas' user account for the box and got the installer to put SSH on for me, but nothing else.<br />
<br />
ZFS installation is straightforward - i installed bonnie++ too so I could do some benchmarks on the box.<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># apt-get update</span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># apt-get upgrade</span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># apt-get install python-software-properties</span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># apt-add-repository <span style="background-color: white; color: #333333; line-height: 18px; text-align: left;">ppa:zfs-native/stable</span></span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"><span style="background-color: white; color: #333333; line-height: 18px; text-align: left;"># apt-get update</span></span> </blockquote>
<blockquote class="tr_bq">
<span style="color: #333333; font-family: 'Courier New', Courier, monospace;"><span style="line-height: 18px;"># apt-get install ubuntu-zfs nfs-server sysstat iscsitarget iscsitarget-dkms open-iscsi bonnie</span></span></blockquote>
<span style="font-family: inherit;">Once installed mounting the existing ZFS array was a case of doing</span><br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"> # zfs import -f nasvol</span></blockquote>
and /nasvol appeared by magic on the root of the filesystem.<br />
<br />
I then set about benchmarking performance of ZFS, ext4 (the root filesystem) NFS, iScsi using bonnie++. The fastest combination turned out to be a 4 drive RAID10 ZFS setup with NFS. I couldn't get iScsi to perform without large latency, i/o coming in bursts or high CPU. NFS on the other hand was pretty sweet - locally managing 180MB/s write and 250MB/s read. NFS speeds top out at 96MB/s write and 105MB/s read.<br />
<br />
To get this performance, a few tips:<br />
<br />
<ol>
<li>ZFS performance is woeful (40MB/s) unless you create the zpool with '-o ashift=12'. This makes it use 4k blocks (i think) which coincides with the modern SATA drives.</li>
<li>More spindles, more speed. Raid 10 gives it 4 to read from and 2 to spread the writes accross. </li>
<li>RAIDZ1 is great, but not with the Microserver's horsepower. Get an i5/i7 and you'll be able to enjoy deduplication too!</li>
<li>NFS server set up rw, async, no_subtree_check, wdelay. (The UPS is on order)</li>
<li>NFS client set up to use rsize/wsize 65536, tcp, and noatime.</li>
<li>It's possible to disable checksumming in ZFS, but it didn't make much different in this setup.</li>
</ol>
As I mentioned above, iScsi performance didn't really compare too well with NFS. My ZFS zVol iScsi target managed 70MB/s writes and 50MB/s reads. None of the combinations of LVM2/ext4/iScsi I tried managed more than 80MB/s write although some did manage 100MB/s read.<br />
<div>
<br /></div>
<div>
<br />
<br />
<br />
<br />
<br /></div>Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com2tag:blogger.com,1999:blog-3859606087184738173.post-82892835627783439972012-06-13T10:16:00.001-07:002012-06-13T10:16:53.109-07:00Ach! NFSv4 is mungling my UIDsJust noticed my NFS mounts had horribly long UID/GIDs which look suspicioiusly like 2^32 -1 (or close to that). It turns out that with nfs4 idmapd is used to map uids to/from the server. For my simple purposes my first instinct was how do I turn this off! But it appears that one source of it's confusion is just the the domain name it is configured with.<br />
<br />
Changing the idmapd.conf file to set the domain to be the same at both ends did the trick - now the IDs are as expected on client and server.<br />
<br />
**update** Only on the 12.04 server. On my 11.10 server the IDs were still mungled, and worse I couldn't restart idmapd using service restart. Manually starting rpc.idmapd didn't work either. I rested to:<br />
<br />
# apt-get remove nfs-common libnfsidmap2<br />
# apt-get purge nfs-common libnfsidmap2<br />
# apt-get install nfs-common libnfsidmap2<br />
<br />
Which after putting the correct domain back in /etc/idmapd.conf did the trick.<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-58893617560095893952012-06-08T01:57:00.002-07:002012-06-08T01:58:50.690-07:00Stop Ubuntu 12.04 NetworkManager meddling!<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><img border="0" height="118" src="http://2.bp.blogspot.com/-rVTIeAALRdc/T9G6PkSNzVI/AAAAAAAAABc/tTbI5OvD0nA/s200/networkmanager.png" style="color: #0000ee; margin-left: auto; margin-right: auto;" width="200" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Annoying Notifications!</td></tr>
</tbody></table>
<div>
After adding a couple of extra NICs to my work <a href="http://www.ubuntu.com/" target="_blank">Ubuntu 12.04</a> desktop PC - part of an ongoing work with our office NAS/iScsi server - the network icon was blinking away trying to do something useful with the new cards. Mildly annoying when in the office. Horrid when accessing remotely as the notifications eat lots of bandwidth. At the same time it was generating a fair amount of guff in /var/log/syslog.<br />
<div>
<div>
<br /></div>
<div>
Easy, I thought - i'll go fix them in /etc/network/interfaces... ...hang on:</div>
<div>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">auto lo<br />iface lo inet loopback</span></blockquote>
</div>
<div>
where's eth0 gone?! It seems that by default all is now managed by the network manager - just what I want most of the time especially on my notebook. But not what I want right now. Should I disable it?</div>
<div>
<br /></div>
<div>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">root@welbeck:/run# service network-manager stop<br />network-manager stop/waiting<br />root@welbeck:/run# ifconfig<br />lo Link encap:Local Loopback <br /> inet addr:127.0.0.1 Mask:255.0.0.0<br /> inet6 addr: ::1/128 Scope:Host<br /> UP LOOPBACK RUNNING MTU:16436 Metric:1<br /> RX packets:118 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:118 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:0<br /> RX bytes:8230 (8.2 KB) TX bytes:8230 (8.2 KB)</span></blockquote>
</div>
<div>
Eth0 has gone! Not quite what I had in mind. A quick dig into the manpage for NetworkManager.conf (in /etc/NetworkManager) though has this:</div>
<div>
<br /></div>
<div>
<blockquote class="tr_bq">
managed=false | true<br />
Controls whether interfaces listed in the 'interfaces' file are<br />
managed by NetworkManager. If set to true, then interfaces<br />
listed in /etc/network/interfaces are managed by NetworkManager.<br />
If set to false, then any interface listed in /etc/net‐<br />
work/interfaces will be ignored by NetworkManager. Remember that<br />
NetworkManager controls the default route, so because the inter‐<br />
face is ignored, NetworkManager may assign the default route to<br />
some other interface. When the option is missing, false value<br />
is taken as default.</blockquote>
<div>
Sounds like it does <i>Just the right thing(TM)</i> then. So quick hack of /etc/network/interfaces</div>
</div>
<div>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">auto lo</span><span style="font-family: 'Courier New', Courier, monospace;">iface lo inet loopback</span><span style="font-family: 'Courier New', Courier, monospace;"><br /></span><span style="font-family: 'Courier New', Courier, monospace;">auto eth0</span><span style="font-family: 'Courier New', Courier, monospace;">iface eth0 inet dhcp</span><span style="font-family: 'Courier New', Courier, monospace;"><br /></span><span style="font-family: 'Courier New', Courier, monospace;">auto eth1</span><span style="font-family: 'Courier New', Courier, monospace;">iface eth1 inet manual</span><span style="font-family: 'Courier New', Courier, monospace;"><br /></span><span style="font-family: 'Courier New', Courier, monospace;">auto eth2</span><span style="font-family: 'Courier New', Courier, monospace;">iface eth2 inet manual</span></blockquote>
<div>
And a service network-manager stop/start... </div>
</div>
<div>
<br /></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-SGXOSDyEGmU/T9G-PP1lWFI/AAAAAAAAABo/VkEivbL1vVo/s1600/fixednetworkmanager.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="160" src="http://2.bp.blogspot.com/-SGXOSDyEGmU/T9G-PP1lWFI/AAAAAAAAABo/VkEivbL1vVo/s320/fixednetworkmanager.png" width="320" /></a></div>
<br /></div>
<div>
And it's wound it's neck in.<br />
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0tag:blogger.com,1999:blog-3859606087184738173.post-89270385802955402452012-06-05T16:15:00.001-07:002012-06-05T16:44:12.751-07:00Host a VirtualBox VM on a FreeNAS iScsi target<h2>
Setup Freenas iScsi Target</h2>
<h3>
Pre-requisites</h3>
<div>
<ol>
<li>A <a href="http://www.freenas.org/" target="_blank">FreeNAS</a> server with a ZFS filesystem. I have Freenas 8.04p2 with RAIDZ1 accross 3x2TB disks</li>
<li>Another computer on the same network with <a href="https://www.virtualbox.org/" target="_blank">Virtual Box</a> installed - in my case an ubuntu 11.04 workstation (sudo apt-get install virtualbox virtualbox-guest-additions virtualbox-guest-additions-iso)</li>
</ol>
<br />
<h3>
Create ZFS Volume</h3>
<div>
Easy with freenas, just needs a name and a size. My case - 'coppervmroot' and 30gb.</div>
</div>
<div>
<br /></div>
<h3>
Set up iScsi</h3>
<div>
<ol>
<li>Create a 'portal' - the default 0.0.0.0:3260 is fine.</li>
<li>Create an 'authorized initiator' using the defaults (all/all)</li>
<li>Create a target. name: coppervmroot, type 'disk', portal group '1', initiator group '1', auth method 'none.</li>
<li>Create a device extent. coppervmrootextent refering to the coppervmroot ZVOL</li>
<li>Create an 'associated target', in this case the coppervmrootextent and the coppervmroot target</li>
<li>Turn on iscsi !</li>
</ol>
</div>
<h3>
Testing from Ubuntu</h3>
<div>
Get the iscsi tools:</div>
<blockquote class="tr_bq">
sudo apt-get install open-iscsi open-iscsi-utils</blockquote>
See what volumes are exported by (as root)<br />
<br />
<blockquote class="tr_bq">
# iscsiadm -m discovery -t sendtargets -p 10.xx.xx.xx:3260<br />
10.xx.xx.xx:3260,1 iqn.2002-02.jfdi.org.tgt:coppervmroot</blockquote>
<br />
<div>
Try mounting a the iScsi volume as a local block device</div>
<div>
<blockquote class="tr_bq">
# iscsiadm -m node --targetname iqn.2002-02.jfdi.org.tgt:coppervmroot --portal 10.xx.xx.xx:3260 --login<br />
Logging in to [iface: default, target: iqn.2002-02.jfdi.org.tgt:coppervmroot, portal: 10.xx.xx.xx,3260]<br />
Login to [iface: default, target: iqn.2002-02.jfdi.org.tgt:coppervmroot, portal: 10.xx.xx.xx,3260]: successful</blockquote>
<div>
And you should see a device appear in /var/log/syslog:</div>
<blockquote class="tr_bq">
# tail -f /var/log/syslog<br />
Jun 5 ... sd 4:0:0:0: [sdc] Attached SCSI disk</blockquote>
</div>
<div>
OK, so unmount it:</div>
<div>
<blockquote class="tr_bq">
# iscsiadm -m node --targetname iqn.2002-02.jfdi.org.tgt:coppervmroot --portal 10.xx.xx.xx:3260 --logout<br />
Logging out of session [sid: 1, target: iqn.2002-02.jfdi.org.tgt:coppervmroot, portal: 10.xx.xx.xx,3260]<br />
Logout of [sid: 1, target: iqn.2002-02.jfdi.org.tgt:coppervmroot, portal: 10.xx.xx.xx,3260]: successful</blockquote>
</div>
<h3>
Setup Virtual Box VM with iScsi target for HDD</h3>
<div>
You can't (yet!) manage an iscsi volume from the Virtual Box GUI. But you can do it with the vboxmanage command:</div>
<blockquote class="tr_bq">
vboxmanage storageattach copper --storagectl sata0 --port 1 --device 0 --type hdd --medium iscsi --server 10.xx.xx.xx --target iqn.2002-02.jfdi.org.tgt:coppervmroot </blockquote>
<div>
That's it. Boot off a CD and install onto the iScsi HDD.</div>
<div>
<br /></div>
<div>
N.B. during installation my VM disconnected a couple of times. Resuming the VM (which stops automatically when this happens) seemed to do the trick. </div>
<div>
<br /></div>Anonymoushttp://www.blogger.com/profile/11391520021315769367noreply@blogger.com0