<?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>Life 25+ &#187; geeking</title>
	<atom:link href="http://curiositykitten.co.uk/index.php/tag/geeking/feed/" rel="self" type="application/rss+xml" />
	<link>http://curiositykitten.co.uk</link>
	<description>Life and all that</description>
	<lastBuildDate>Wed, 17 Mar 2010 17:33:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mythbuntu Fileserver for Dummies</title>
		<link>http://curiositykitten.co.uk/index.php/2010/01/06/mythbuntu-fileserver-for-dummies/</link>
		<comments>http://curiositykitten.co.uk/index.php/2010/01/06/mythbuntu-fileserver-for-dummies/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 00:45:29 +0000</pubDate>
		<dc:creator>Sara</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[geeking]]></category>

		<guid isPermaLink="false">http://curiositykitten.co.uk/?p=23</guid>
		<description><![CDATA[I&#8217;ve recently been working on a personal project to set myself up a fileserver with redundant storage, and I thought I&#8217;d combine this with a desire to run my own installation of Myth TV. In the house I&#8217;m currently living in, my room is in the attic and the only aerial input is fed into ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been working on a personal project to set myself up a fileserver with redundant storage, and I thought I&#8217;d combine this with a desire to run my own installation of Myth TV. In the house I&#8217;m currently living in, my room is in the attic and the only aerial input is fed into the living room, Myth seemed like the perfect way of distributing the television upstairs without cables, and theoretically should plug directly into the XBMC install I have running on an Asus Revo R3600 I have upstairs.</p>
<p>So this is detailing my experiences, the problems I&#8217;ve come up against, and the potentially rubbish ways I&#8217;ve come up with to deal with them. The end result however, is something that appears to be working, and whilst I can&#8217;t vouch for the success of my redundant storage solution till I have to use it in anger, it seems to be functioning as expected.</p>
<p><strong>Step Zero: Mythbuntu</strong></p>
<p>I chose to go with the pre-built Myth distribution of Ubuntu. I presume that most of these instructions would work for any debian based flavour of Linux (and with a bit of thought probably any other distro) but I didn&#8217;t have to manually install any of the myth software, and my hardware was all auto detected. I suppose in some cases you wont be so lucky.</p>
<p>One small issue I think I came across, I installed the OS and then found that GRUB couldn&#8217;t find the master boot record and it refused to boot. I think this was because the system disk wasn&#8217;t the first one seen by the BIOS. I just switched my SATA connectors around until it was, and reinstalled from scratch. Not the perfect answer, but it worked and that was my goal <img src='http://curiositykitten.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>St<span style="font-weight: normal;"><strong>ep One: Software Raid</strong></span></strong></p>
<p>I used mdadm to handle the RAID, and this wasn&#8217;t pre installed in Mythbuntu so first of all, get it installed.<br />
<code>$ apt-get install mdadm</code></p>
<p>In my machine I started off with two 1.5Tb hard disks, alongside the system disk, which I wanted to set up as a paired raid10 array. I searched dmesg to find the device names of the two disks first.<br />
<code>$ dmesg | less </code></p>
<p>Piped the output of dmesg into less, then searched that output for references to the one disk I knew I had, the system disk &#8217;sda&#8217;.<br />
<code>'/sda'</code></p>
<p>This showed me sdb and sdc, which I guess you&#8217;d think was logical, but I was being paranoid. You can also see the devices listed in /dev/.</p>
<p>Here was my magical command :-<br />
<code>$ mdadm -v --create /dev/md1 --level=raid10 --raid-devices=2 /dev/sdb /dev/sdc</code></p>
<p>Verbosely create a new raid 10 device called /dev/md1 (I should have used md0 if I were being correct but I didn&#8217;t, meh), using two raid devices found at /dev/sdb and /dev/sdc. You can test this is working with :-<br />
<code>$ mdadm --detail /dev/md1</code></p>
<p>And again, the device should appear in /dev/.<br />
You can check the progress of the raid array being initialised with :-<br />
<code>$ cat /proc/mdstat</code></p>
<p>And you can see the raid array appearing as one disk, by using :-<br />
<code>$ cfdisk / dev/md1</code></p>
<p>Though this may not work as expected if the disks you&#8217;ve used already had some form of file system on them, unreadable by Linux.</p>
<p>Technically there is another step which goes here, but I&#8217;m writing this to include the problems I faced, as I faced them; skip down to &#8216;Problems after Reboot&#8217; if you want to spoil the surprise.</p>
<p><strong>Step Two: LVM</strong></p>
<p>Initialise the disk for LVM.<br />
<code>$ pvcreate /dev/md1</code></p>
<p>Creates the a volume group, containing that &#8216;disk&#8217;.<br />
<code>$ vgcreate vg-server1 /dev/md1</code></p>
<p>Now, create the volumes themselves! I decided I wanted two, one partition for mythtv, the other for data.<br />
<code>$ lvcreate -L 500g -n lv-mythrecordings vg-server1<br />
$ lvcreate -L 895g -n lv-data vg-server1</code><br />
I had a &#8216;1.5Tb&#8217; disk, which of course ends up being nowhere near 1500gb. Hence I chose 500gb for my myth partition, and what was left at this point for data.</p>
<p>Next I needed to put a filesystem on the partitions. I chose XFS as it is extendable while mounted, very easily, but it has the drawback of not supporting shrinking. I don&#8217;t think I&#8217;m ever going to need to make my partitions smallers, so that&#8217;s fine by me.<br />
<code>$ apt-get install xfsprogs<br />
$ mkfs.xfs /dev/vg-server1/lv-data<br />
$ mkfs.xfs /dev/vg-server1/lv-mythrecordings</code></p>
<p>In order to test this had worked I mounted the partitions, and wrote small text files to them.<br />
First of all, create the mountpoints (I did this in /mnt for convention purposes at this point) :-<br />
<code>$ mkdir /mnt/data<br />
$ mkdir /mnt/mythrecordings<br />
$ mount /dev/vg-server1/lv_data /mnt/data<br />
$ mount /dev/vg-server1/lv_mythrecordings /mnt/mythrecordings</code><br />
When mounting you need to refer to the &#8216;magical&#8217; device address, you can see how it works there.<br />
Also, if you mount these as root (i.e. sudo) you can only write to them as root. Expect to have to sudo when creating your test  files.</p>
<p><strong>Step Three: fstab</strong><br />
We don&#8217;t want to have to mount the partitions by hand every time, it&#8217;d be ridiculous. The solution is to add them to fstab.</p>
<p>My editor of choice is vim, but any text editor will do :-<br />
<code>$ vim /etc/fstab</code><br />
You may wish to make a copy before you edit this file, just in case you change something by accident.<br />
I added :-<br />
<code>/dev/vg-server1/lv-data			/raid/data		xfs	defaults	0	0<br />
/dev/vg-server1/lv-mythrecordings	/raid/mythrecordings	xfs	defaults	0	0</code></p>
<p>The &#8216;defaults&#8217; option means certain interesting things to do with the way in which the partitions are mounted. The default was fine by me, read up on it if you think you may need something more complex.</p>
<p>Now create folders for the mount points to match fstab. I chose to keep my  partitions mounted in /raid &#8211; something I just chose myself, no convention.<br />
<code>$ mkdir /raid/data<br />
$ mkdir /raid/mythrecordings</code></p>
<p>I then tested fstab by mounting them as they should be when the system boots :-<br />
<code>$ mount /raid/data<br />
$ mount /raid/mythrecordings</code></p>
<p>When mounted, you will need to check the permissions on the folders are correct for everything to have permission to read/write to them, and that they are owned by the right user / in the right group. This involves  the commands &#8216;chmod&#8217; and &#8216;chown&#8217;.</p>
<p><strong>Step four: Samba</strong></p>
<p>Now samba for remote access to the partitions as shares, from Mac OS and Windows (and Linux). </p>
<p><code>$ apt-get install samba smbfs</code></p>
<p>Then you just add things to the config file. Again, make a copy if you&#8217;re worried you might mess it up.<br />
<code>$ vim /etc/samba/smb.conf</code></p>
<p>Under global settings I put :-<br />
<code>security = user</code></p>
<p>And then I added my shares :-<br />
<code>[media]<br />
        comment = Media Share<br />
        path = /raid/data/media<br />
        browseable = yes<br />
        read only = yes<br />
        guest ok = yes<br />
        write list = sara</p>
<p>[unsorted]<br />
        comment = the unsorted directory<br />
        path = /raid/data/media/Unsorted<br />
        browseable = yes<br />
        writeable = yes<br />
        guest ok = yes</p>
<p>[files]<br />
        comment = Files Share<br />
        path = /raid/data/files<br />
        browseable = no<br />
        read only = yes<br />
        guest ok = no<br />
        read list = sara<br />
        write list = sara</p>
<p>[sab]<br />
        comment = sabnzb space<br />
        path = /raid/data/sab<br />
        browseable = no<br />
        read only = yes<br />
        guest ok = no<br />
        read list = sara<br />
        write list = sara</code><br />
These may not be exactly right, but they seem to work for me. Notably, [unsorted] is a dump directory. Guest is allowed to write to it, to allow housemates who I don&#8217;t trust to organise things properly to leave things for me to assimilate into the media collection. [media] is readonly for guest accounts (i.e. they are allowed to read it, and access what&#8217;s there, but they can&#8217;t mess anything up). [files] and [sab] are shares only for me, they don&#8217;t appear in a network browser and only I have access to write.</p>
<p>Lastly, whichever account you&#8217;ve specified as having access, you need to give it a samba password.<br />
<code>$ smbpasswd -a sara<br />
New SMB password:<br />
Retype new SMB password:<br />
Added user sara.</code><br />
This only works for user accounts which exist on the host machine.</p>
<p><strong>Step five: Problems after Reboot</strong></p>
<p>Having got this far, I turned off the machine to connect my second pair of hard disks. On booting the machine up, the raid device /dev/md1 was nowhere to be seen but I could see that /dev/sdb and /dev/sdc still existed.</p>
<p>I tried to manually start the raid array first of all :-<br />
<code>$ sudo mdadm -A /dev/md1 /dev/sdb /dev/sdc<br />
[sudo] password for sara:<br />
mdadm: cannot open device /dev/sdb: Device or resource busy<br />
mdadm: /dev/sdb has no superblock - assembly aborted</code><br />
Obviously wasn&#8217;t successful.</p>
<p>So, I wanted to check that the disks still knew they were meant to be part of an array :-<br />
<code>$ sudo mdadm --query /dev/sdb<br />
/dev/sdb: is not an md array<br />
/dev/sdb: device 0 in 2 device undetected raid10 /dev/md1.  Use mdadm --examine for more detail.<br />
$ sudo mdadm --query /dev/sdc<br />
/dev/sdc: is not an md array<br />
/dev/sdc: device 1 in 2 device undetected raid10 /dev/.tmp.md1.  Use mdadm --examine for more detail.</code><br />
This made me breathe a little easier.</p>
<p>In the end, the solution was to create a mdadm config file. And it turns out it comes with a nice little script to generate just that :-<br />
<code>$ /usr/share/mdadm/mkconf>/etc/mdadm/mdadm.conf</code></p>
<p>A reboot showed this had worked quite nicely.</p>
<p><strong>Step Six: Adding more disks</strong></p>
<p>I connected up my new disks, and I checked again in dmesg that they were being seen. I then double checked using mdadm that the disks i was about to raid, weren&#8217;t the previous disks being detected in a different order.<br />
<code>$ mdadm --query /dev/sdb<br />
/dev/sdb: is not an md array<br />
/dev/sdb: device 0 in 2 device active raid10 /dev/md1.  Use mdadm --examine for more detail.<br />
$ sudo mdadm --query /dev/sdc<br />
/dev/sdc: is not an md array<br />
/dev/sdc: device 1 in 2 device active raid10 /dev/md1.  Use mdadm --examine for more detail.<br />
$ sudo mdadm --query /dev/sdd<br />
/dev/sdd: is not an md array<br />
 $ sudo mdadm --query /dev/sde<br />
/dev/sde: is not an md array</code></p>
<p>This quelled my paranoia, so I went on to create the array :-<br />
<code>$ mdadm -v --create /dev/md2 --level=raid10 --raid-devices=2 /dev/sdd /dev/sde</code></p>
<p>And as before, add it to lvm :-<br />
<code>$ pvcreate /dev/md2<br />
$ vgextend vg-server1 /dev/md2</code><br />
This extends the volume group from earlier to now include this new hardware.</p>
<p>I unmounted the current shares I want to extend:-<br />
<code>$ umount /raid/data</code><br />
Incidentally, smbstatus will tell you who/where is connected to the samba shares if you need to know.</p>
<p><code>$ lvextend  /dev/vg-server1/lv-data /dev/md2</code><br />
This extends the volume itself to include the maximum space available on the new disk.</p>
<p>Now, to grow the filesystem. The scary bit. XFS can only grow when mounted, so I remounted the share. Then grow the fs by referring to the mount point.<br />
<code>$ xfs_growfs /raid/data</code></p>
<p>Phew. I then ran lvscan to look at my volumes and their sizes :-<br />
<code>$ lvscan<br />
  ACTIVE            '/dev/vg-server1/lv-mythrecordings' [500.00 GB] inherit<br />
  ACTIVE            '/dev/vg-server1/lv-data' [2.24 TB] inherit</code><br />
Success!</p>
<p><strong>Step seven: A few tips on making myth frontends work with a remote backend</strong></p>
<p>You need to make sure that myth-backend is set to refer to it&#8217;s external address, not localhost or 127.0.0.1. This is because when frontends connect, the backend tells them that address to talk to for video.<br />
Also, don&#8217;t be foolish enough to try using MDNS (i.e Bonjour) for this. I had my external address set to &#8216;computername.local&#8217; which works perfectly for every communication I would normally do. Unfortunately, it caused the official myth-frontend for OSX to fail to connect to the backend 9 times out of 10. </p>
<p>I found XBMC to be much, much nicer and more sensible. In order to add myth to it, you need to create a new source like this<br />
<code>myth://mythtv:YOURPASSWORD@mythbackend-pc</code><br />
Make sure the password is the one from the myth-backend config, it is randomly generated.</p>
<p>Lastly, I got XBMC connected, it would show me the programme guide, and see a list of recorded programmes, as well as a list of live channels. Everything looked great, but when I tried to play any video it would either do nothing, or give me an error telling me &#8216;playback failed&#8217; and asking me to check the logs.</p>
<p>Solution? Edit /etc/hosts, and add the fileserver by hand. Madness.</p>
<p><strong>The End</strong><br />
I hope maybe this will help someone out there, it isn&#8217;t a perfect method and I&#8217;m sure I&#8217;ve done things in ways which could be improved, but it works and I am happy with it. I&#8217;d suggest if anyone has questions, I&#8217;m not the first person to turn to, I&#8217;ll only google for the answers!</p>
]]></content:encoded>
			<wfw:commentRss>http://curiositykitten.co.uk/index.php/2010/01/06/mythbuntu-fileserver-for-dummies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Christmas and New Years</title>
		<link>http://curiositykitten.co.uk/index.php/2010/01/01/christmas-and-new-years/</link>
		<comments>http://curiositykitten.co.uk/index.php/2010/01/01/christmas-and-new-years/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 03:00:19 +0000</pubDate>
		<dc:creator>Sara</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[christmas]]></category>
		<category><![CDATA[geeking]]></category>
		<category><![CDATA[newyear]]></category>

		<guid isPermaLink="false">http://curiositykitten.co.uk/?p=21</guid>
		<description><![CDATA[Bit of a funny Christmas this year, not that I&#8217;d really got used to not spending Christmas with my parents, but they took me away to a holiday cottage for the week instead of spending time at my sister&#8217;s house. It was very different, and not necessarily in a bad way, but it doesn&#8217;t really ]]></description>
			<content:encoded><![CDATA[<p>Bit of a funny Christmas this year, not that I&#8217;d really got used to not spending Christmas with my parents, but they took me away to a holiday cottage for the week instead of spending time at my sister&#8217;s house. It was very different, and not necessarily in a bad way, but it doesn&#8217;t really feel like Christmas has been and gone. It feels like I should be waiting for it still, which is even sillier given this is the first blog entry of 2010.</p>
<p>Best present this year was a car, yes you heard me correctly, someone gave me a car for Christmas and it is glorious. And yes that is left over snow, unbelievable all round.</p>
<p style="text-align: center;"><a href="http://img50.yfrog.com/i/23769550.jpg/"><img class="aligncenter" title="Christmas Car" src="http://img50.yfrog.com/img50/2793/23769550.jpg" alt="" width="420" height="315" /></a></p>
<p style="text-align: left;">Unfortunately the car also coincided with a good friend moving away to California :- you can&#8217;t pack a car into your hand luggage unfortunately. Regardless, I don&#8217;t think the car was worth the disappearance of the friend, but the Internet is a marvellous tool so I have no doubt we&#8217;ll remain in good contact. I&#8217;m even willing to investigate this new fangled &#8216;Skype&#8217; thing all the cool kids have been raving about. I don&#8217;t really do *talking* to people.</p>
<p>And so now it is new years. I&#8217;m not normally one for big celebrations on new years, I think back to the years of Heather, Alex and myself driving about listening to music, finding vantage points to watch fireworks, and then retreating to watch Bill Bailey dvds in Alex&#8217;s living room. I enjoyed those years a lot, but unfortunately Heather was busy this year. I was invited, but the event was spending the evening in Manchester city centre, moving from pub to club, meeting up with various people. I really didn&#8217;t fancy it, I don&#8217;t like going out in Manchester at the best of times let alone new years eve.</p>
<p>So instead I retreated to Lancaster, bringing with me my new fileserver! I&#8217;d built it at my parents&#8217; house but sadly they don&#8217;t have any monitors, their TV was too old to have an HDMI port and even if I&#8217;d overcome that hurdle, there&#8217;s no way I could realistically download a linux install disc over 3G. Upon turning it on here the first issue was that it wouldn&#8217;t output anything to a monitor. After some panicking, and disassembly, and finally stooping to reading the manual I discovered that in the 8 years its been since I last built a PC in anger, things have changed. You have to run separate power to the CPU, else everything goes tits up. Never have I been so relieved to hear post beeps.</p>
<p>There&#8217;s a lot more to be said about the fileserver project, but I&#8217;ll save that for a future blog entry. I&#8217;m trying to document what I did as I am a moron, and I don&#8217;t remember anything. Blogging it seemed as good a way as any.</p>
<p>So in conclusion, it is 2010. A new year, a new start, that&#8217;s what people say. I&#8217;ve never held much stock by resolutions, or life changing decisions happening just because the calendar rolled over, but its sort of nice to feel like everything is getting a new beginning. This year didn&#8217;t end well, 2009 certainly contained some of the most miserable events of my life so far, but ignoring that I think the good has outweighed the bad. Hopefully at the end of 2010 I&#8217;ll be able to say the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://curiositykitten.co.uk/index.php/2010/01/01/christmas-and-new-years/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
