<?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>Cranial Trauma &#187; Site News</title>
	<atom:link href="http://cranialtrauma.co.uk/category/site-news/feed/" rel="self" type="application/rss+xml" />
	<link>http://cranialtrauma.co.uk</link>
	<description>Taking a wedge to the cracks in your psyche.</description>
	<lastBuildDate>Fri, 24 Dec 2010 16:46:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Spam Measures</title>
		<link>http://cranialtrauma.co.uk/2010/12/spam-measures/</link>
		<comments>http://cranialtrauma.co.uk/2010/12/spam-measures/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 19:16:38 +0000</pubDate>
		<dc:creator>Toker</dc:creator>
				<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://cranialtrauma.co.uk/?p=380</guid>
		<description><![CDATA[Apologies to all those I&#8217;ve just affected, but due to the massive amounts of spam comments currently being submitted I&#8217;ve just beefed up our sign-up procedure as well as removing a tonne of users who seem to have submitted nothing (or nothing and spam). If I accidentally deleted your account, or you&#8217;re legitimate and trying [...]]]></description>
			<content:encoded><![CDATA[<p>Apologies to all those I&#8217;ve just affected, but due to the massive amounts of spam comments currently being submitted I&#8217;ve just beefed up our sign-up procedure as well as removing a tonne of users who seem to have submitted nothing (or nothing and spam).</p>
<p>If I accidentally deleted your account, or you&#8217;re legitimate and trying to sign up then I am really, truely sorry. Get in contact and we&#8217;ll sort it out <img src='http://cranialtrauma.co.uk/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://cranialtrauma.co.uk/2010/12/spam-measures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Source Swearing</title>
		<link>http://cranialtrauma.co.uk/2009/02/linux-source-swearing/</link>
		<comments>http://cranialtrauma.co.uk/2009/02/linux-source-swearing/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 09:24:21 +0000</pubDate>
		<dc:creator>Toker</dc:creator>
				<category><![CDATA[Great Ideas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://cranialtrauma.co.uk/?p=218</guid>
		<description><![CDATA[It was my attempt to track down some of the more amusing kernel source code comments I&#8217;d heard, that led me to thinking I&#8217;d broken the advanced tagline plugin (tho it wasn&#8217;t). It was also this quest, that led me across this most fantastic graph, showing Linux Kernel Revision against #of swear words contained. Many [...]]]></description>
			<content:encoded><![CDATA[<p><a class="thickbox" href="http://cranialtrauma.co.uk/wordpress/wp-content/uploads/2009/02/kernel-swear-counts.png"><img class="size-thumbnail wp-image-217" title="kernel-swear-counts" src="http://cranialtrauma.co.uk/wordpress/wp-content/uploads/2009/02/kernel-swear-counts-150x90.png" alt="x=Swear Words, y=kernel revision" width="150" height="90" align="right" /></a><br />
It was my attempt to track down some of the more amusing kernel source code comments I&#8217;d heard, that led me to thinking I&#8217;d broken the advanced tagline plugin (tho it wasn&#8217;t).</p>
<p>It was also this quest, that led me across this most fantastic graph, showing Linux Kernel Revision against #of swear words contained.</p>
<p>Many thanks to <a href="http://www.vidarholen.net/contents/blog" target="_blank">Mr. Holden</a> of <a href="http://www.vidarholen.net/contents/" target="_self">vidarholen.net</a> for posting this (and amusingly he&#8217;s currently using the same theme we are <img src='http://cranialtrauma.co.uk/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://cranialtrauma.co.uk/2009/02/linux-source-swearing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Taglines</title>
		<link>http://cranialtrauma.co.uk/2009/02/advanced-taglines/</link>
		<comments>http://cranialtrauma.co.uk/2009/02/advanced-taglines/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 09:04:18 +0000</pubDate>
		<dc:creator>Toker</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[stupidity]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://cranialtrauma.co.uk/?p=214</guid>
		<description><![CDATA[In which my stupidity lets me know how good the support is for this package :)]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just had some minor problems with the <a href="http://kmorey.net/computers/advanced-tagline-wordpress-plugin/" target="_blank">Advanced Taglines Plug-in</a> I use on the site.</p>
<p>Suffice to say, it turned out to be a minor mix of Interface Design Issues, but mostly my own stupid fault for not RTFMing or even checking the page source to see where I was going wrong.</p>
<p>I asked the author about it and he was back in touch with an answer within hours, and he was spot on the money about it being my fault. Excellent support and my greatest thanks to the author.</p>
<p>If you want to add some randomisation to your sites <em>Tagline</em>, then Advanced Tagline by <a href="http://kmorey.net" target="_blank">Kevin Morey</a> is well worth the install <img src='http://cranialtrauma.co.uk/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://cranialtrauma.co.uk/2009/02/advanced-taglines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server Move</title>
		<link>http://cranialtrauma.co.uk/2008/09/server-move/</link>
		<comments>http://cranialtrauma.co.uk/2008/09/server-move/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 06:50:39 +0000</pubDate>
		<dc:creator>Toker</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[stupidity]]></category>

		<guid isPermaLink="false">http://cranialtrauma.co.uk/?p=80</guid>
		<description><![CDATA[You might have noticed the downtime with the server over the last couple of days. We have been migrating to a new server over the last couple of days, and although it was supposed to be seamless, I fucked up royally. The hosting company we use has a very funky vKVM web-interface set up. Basically [...]]]></description>
			<content:encoded><![CDATA[<p>You might have noticed the downtime with the server over the last couple of days.</p>
<p>We have been migrating to a new server over the last couple of days, and although it was supposed to be seamless, I fucked up royally.</p>
<p><span id="more-80"></span></p>
<p>The hosting company we use has a very funky vKVM web-interface set up. Basically it boots your actual hard drive from your dedicated server into a <a title="qEMU Virtualisation" href="http://bellard.org/qemu/about.html" target="_blank">qEMU</a> virtual machine (a bit like vmware) and then gives you an embedded <a href="http://en.wikipedia.org/wiki/Vnc" target="_blank">VNC</a> client to connect to it with. Not only can I boot <em>my</em> hard drive, but I can get it to boot off an .iso image. So I can boot a nice minimal <a href="http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/releases/x86/2007.0/installcd/" target="_blank">live-cd</a> distribution which has ssh and dd. Annoyingly not ftp but that&#8217;s by the by.</p>
<p>So, my big plan. Both servers have (it turns out, exactly) the same hard drives, and I&#8217;m a clever linux bonny. I know how to linux, and I especially know how to `dd`. So, using nothing but dd, the pipe tool and an ssh connection, I should be able to clone over my server -no bother at all, and job is done and done.</p>
<p>After working out that the 2008-minimal .iso k-panics, I set to on the second problem of this really simple exercise. Neither of the machines have a real-world IP address (in fact they both had the same 10.x.x.x), but they did have internet access. This is the part where I remembered the ftp-backup, and then noticed the lack of an executable.</p>
<p>But we have ssh -both in and out- and that means I have sftp.<br />
Which doesn&#8217;t help either. I have no routable address to host a server, and there&#8217;s no chance in hell I&#8217;m going to transfer an image of a 250GB HDD thought my home internet connection, with its maximum upload of 512k/s. Actually, I can&#8217;t transfer squat through <em>my</em> internet connection, but then if people will leave unsecured access points lying around -and Windows can&#8217;t seem to stop itself automatically connecting to any Tom, Dick or Harry unsecured wireless network it can find, and I can&#8217;t seem to stop myself installing VNC and enabling ICS Wizard&#8230;.<br />
So the internet is a little sketchy.</p>
<p>Turns out I had an active account on a friends web server -thanks newb so after realising my auth details still worked (past tense as soon as he reads this) I started thinking about dumping data onto there.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">dd</span> <span class="re2">bs</span>=1M <span class="kw1">if</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>hda <span class="re2">of</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>hdb</div>
</div>
<p> copies everything from hda (your primary master hard drive) to hdb (the primary slave). <em>if=</em> and <em>of=</em> (for those of you that don&#8217;t catch on quick) is literally specifying the input and the output file. If its not specified, then dd assumes the data is coming in or out on the pipe.</p>
<p>So, we can be clever, and because linux treats everything as a file, we can just as easily dump it as an image file, rather than as a straight copy onto another hard disk.
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">dd</span> <span class="re2">bs</span>=1M <span class="kw1">if</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>hda <span class="re2">of</span>=<span class="sy0">/</span>backup.img</div>
</div>
<p> And now we have a file that is our hard drive, very nice.</p>
<p>Except, if my original hard drive is a 250gb hard drive, even if there&#8217;s only 30gb in use, the image is still going to be 250gb. Which is the problem in my case. I need compression.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">dd</span> <span class="kw1">if</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>hda <span class="sy0">|</span> <span class="kw2">gzip</span> <span class="re5">-c</span> <span class="sy0">|</span> <span class="kw2">dd</span> <span class="re2">of</span>=<span class="sy0">/</span>backup.img.gz</div>
</div>
<p> gives me it compressed as a gzip (the -c tells it to output to stdout (the pipe) rather than a file) which is kinda shibby, and truncates all the white space. So instead of our image being 250gb, its now about 30gb. Far more manageable.</p>
<p>The issue now, is that I have nowhere to store, even temporarily, a 30gb file. I&#8217;m still not waiting for&#8230; <em>this</em> internet to download and then upload the file again, even if I could somehow find space on the server to create it in the first place.</p>
<p>But wait, there&#8217;s no bother, I use ssh. So instead of telling dd on the local machine to write the file out, I can just pipe the data through the ssh connection into whatever is running at the other end, which I can make be dd on the remote server, to write it back out again.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">dd</span> <span class="kw1">if</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>hda <span class="sy0">|</span> <span class="kw2">gzip</span> <span class="re5">-c</span> <span class="sy0">|</span> <span class="kw2">ssh</span> me<span class="sy0">@</span>newbsBox <span class="st_h">&#8216;dd of=mybackup.img.gz&#8217;</span></div>
</div>
<p>How do you like them apples? Pretty sweet, no? And the code snippet even highlights the quotes, which effectivly highlights whats going on on the remote machine.</p>
<p>It should have worked without any bother. Except it didn&#8217;t. The virtual machine (apart from taking hours, and I do mean 14+ hours) kept crashing and the opperation had to be started again from scratch. Many times.</p>
<p>Unsure if its my internet causing the page to time-out and therefore resetting the VNC session, or what-the-fuck, I decide to use ssh and try and remove myself from this as much as possible, so I go for the old reverse-ssh trick, always a winner in those situations where you can get network access going out, but not back in.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0">## Step 1: SSH from the old server (on 10.x) to newbs box:</span><br />
<span class="kw2">ssh</span> <span class="re5">-R</span> <span class="nu0">2222</span>:localhost:<span class="nu0">22</span> me<span class="sy0">@</span>newbsBox</p>
<p><span class="co0">## Step 2: SSH from my PC to newbs server, and start a screen session (so when I get disconnected, the session doesn&#8217;t drop).</span></p>
<p><span class="co0">## Step 3: Inside of my screen session, ssh to the localport 2222 and it gets forwarded to port 22 on the new server:</span><br />
<span class="kw2">ssh</span> <span class="re5">-p</span> <span class="nu0">2222</span> root<span class="sy0">@</span>localhost</div>
</div>
<p>So now, both my machine at home, and the old server connects to newbs server.<br />
From my PC at home, I tell newb&#8217;s server to tell my old server to connect again to newbs server and dd the image across as we were doing before, but this time if my home internet goes down, its not going to affect the remote transfer. I think. I&#8217;m quite confused now, and I sure as hell was then.</p>
<p>It still took hours, but I finally managed to get a full backup onto his box. Just have to get it back off again now.</p>
<p>Except trying to do the reverse crashes the new server even more. Lots and lots of mad faffing about and it keeps keeling over half way through trying to restore the data. Thrashing my hosting centres network and qemu server is just not working, so onto the next step.</p>
<p>It was at this point,  I discovered another setting in the hosting centres control panel called &#8220;rescue-mode&#8221;, that I had previously dismissed as not being of any help. After I bothered reading documentation, I found out this actually boots <em>my</em> real dedicated server off a netboot image, letting it boot up the box on its own, real, actual hardware, and without touching the actual hard drive. Real-world IP address, too, which is absolutely fab. As with putting it into vKVM mode, you change it as a boot option and they email you your user name and password for the temporary mode.</p>
<p>A couple of minutes later, we&#8217;ve got the auth details, and I&#8217;m logged into my new server, and I can ssh and dd and the disks are offline.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">ssh</span> me<span class="sy0">@</span>newbsBox <span class="st_h">&#8216;dd if=backup.img.gz&#8217;</span> <span class="sy0">|</span> <span class="kw2">dd</span> <span class="re2">of</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>sda</div>
</div>
<p> and I&#8217;m leaving it to run, no bother, everything is good. When its done, I reboot the box and find out that as I forgot to de-compress the image first, the disk is trashed.</p>
<p>It shouldn&#8217;t have been a problem -a quick reboot into rescue mode later and I should have been able to re-run the command (using gunzip -c) and everything would have been fine -except this time when I reboot into rescue-mode, I dont get any auth details emailed through. Still nothing when I go into vKVM mode either, and the previous details have stopped working. After much faffing about rebooting trying to get access to anything I use (once again) the web management page and re-install the OS. 30minutes later I have a mostly up to date linux box and some auth details to access it.</p>
<p>By this time (about two days after I started) I was in no mood to fuck about. I set the new box updating and with a copy of the old world file (on Gentoo all of the packages you have installed are recorded in your <em>world</em>), I told the new server to install all of the same programs onto the new box.</p>
<p>On the old server I remounted the /home partition as read only, so it wouldn&#8217;t change and then from the new server ran:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">umount</span> <span class="sy0">/</span>home<br />
<span class="kw2">ssh</span> root<span class="sy0">@</span>OLDserver <span class="st_h">&#8216;gzip -c | dd if=/dev/sda7&#8242;</span> <span class="sy0">|</span> <span class="kw2">gunzip</span> <span class="re5">-c</span> <span class="sy0">|</span> <span class="kw2">dd</span> <span class="re2">of</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>sda7</div>
</div>
<p>and waited. After transferring a copy of the SQL databases, the apache vhosts information and updating the DNS, here we are, working as new.</p>
<p>And may I say, what a pain in the fucking arse. I&#8217;m smoking a d00b and then getting into bed with my bf -its nearly 7am and we have to be up in 5 hours.</p>
<p>-I still maintain its better than coding css tho :S</p>
]]></content:encoded>
			<wfw:commentRss>http://cranialtrauma.co.uk/2008/09/server-move/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

