Time to upgrade the server

img_0858The server that hosts lowtek.ca sits in a dusty corner of my furnace room.  There are lots of good reasons to not host your own web presence, but if you are stubborn like I am you might find this interesting.

The current hardware is an AMD Athlon XP 1800+ that I bought back in 2001 – I remember it cost me a bit more than $1700 at the time. This used to be my desktop until I upgraded to a much quieter (and slightly faster) refurbished machine a couple of years ago.  For the most part I’ve been avoiding buying new hardware to avoid the steep price depreciation.

Last week the server machine shut itself off, two days in a row.  There wasn’t much data in the logs, but poking around I’m fairly convinced that the CPU was overheating.  The sensor data claims a 23C swing in reported temperatures (55C-78C).  Either way, the machine is now unreliable in my mind and I need the server to be reliable.

While I was tempted to go the refurbished route, as I can pick up a reasonably capable system for about $100 – I really wanted to avoid getting in the same mess in a few years.  So after some amount of searching, I settled on the following components:

Total works out to under $200.  I can reuse a case (or steal one from a friend) and the drives I have already.  I do plan to measure the power consumption of my new system vs. the existing one, I’m hopeful I will get results similar to this claim of 41watts.

My thinking here is that by buying new, I’m going to have a more reliable system for longer.  The energy savings are a sensible investment over a few years, thus both the Atom CPU and 80Plus power supply make sense.  Less heat (again the Atom) should mean easier cooling, and again hopefully longer life.

Playing in the Cloud

mirrors_edge_2dThere has been lots of talk lately about “the cloud” – I was a little taken aback by this blog posting from Google which implied that Google is the cloud.  Pat also recently posted about web UIs that I’d recommend people check out.  I’ve been keeping an eye on some of the instant on OSes, and it turns out a friend of mine is involved with one of the companies offering a cloud solution.  I’ll admit that the cloud concept is very cool – but what I really want is to host my own cloud (and yes, that does seem a bit backward).

Let’s get back to what computers are good at – entertaining us.  If you haven’t seen this yet, you need to check out mirrorsedge2d.com – a pretty neat flash based game that is a 2D take on Mirrors Edge.  It only take about 30mins of toying around to exhaust the content on the beta site right now, but if you enjoy 2d platformer games this will hook you.

The other night my internet connection was down for about 30 minutes.  How annoying will that be once all our data is in the cloud?

Ubuntu with Apple’s Time Machine

timemachineOnce I had managed to get Leopard up and going on the mac mini with all of the user settings copied over, it was time to start exploring new features.  Time Machine was first on the list – but I wanted to have it back up over the network to my Ubuntu Linux server.  I probably took the long route to a solution, but what I have seems to be working.  The two main parts of getting time machine to work are: a) make it so the Mac can see the network storage b) trick time machine into using it as a destination.

Part A – I believe that you can use a non-AFP network storage solution (and my Mac can see my Samba volumes for shared files) but I went the route of enabling AFP.  This is based on instructions found here, but I’ll repeat it here with my comments:

  1. We’ve got to recompile netatalk to have encryption.  You’ll need the universe repository enabled, and the development tools.  Details can be found in the ubuntu forums.
    sudo apt-get install dpkg-dev
    sudo apt-get install devscripts
    sudo apt-get install libssl-dev
    apt-get source netatalk
    sudo apt-get build-dep netatalk
    sudo apt-get install cracklib2-dev
    cd netatalk-2.0.3
    DEB_BUILD_OPTIONS=ssl debuild
    sudo dpkg -i ../netatalk_2.0.3-3ubuntu1_i386.deb

    You’ll probably want to issue a ‘hold’ on the netatalk package by using dpkg –set-selections to prevent being upgraded
    For the lazy – here is a link to the .deb I created.
  2. Modify the configuration file /etc/netatalk/AppleVolumes.default to point at the location you are going to store files.  Ensure ownership and permissions are correct for the user you want to have access this location.
  3. Now we install avahi
    sudo aptitude install avahi-daemon
    Edit /etc/netatalk/afpd.conf to contain:
    - -noddp -uamlist uams_randnum.so,uams_dhx.so
    you might add -noslp to that line above to remove a warning, the key is that the configuration must be on a single line.
    Edit the hosts line in  /etc/nsswitch to match
    hosts: files dns mdns4
    Download using wget http://www.disgruntled-dutch.com/media/afpd.service
    and install that in /etc/avahi/services
    Restart the services:
    sudo /etc/init.d/netatalk restart
    sudo /etc/init.d/avahi-daemon restart

At this point your Mac should be able to discover the service and see the volume as a shared drive.

Part B – Tricking the Mac into using this volume as a backup.  You may not need to do any of the work in Part A at all as is evidenced by other people claiming success on the net.

  1. Create a file named “.com.apple.timemachine.supported” at the root of the filesystem we pointed at in (2).  I’m not entirely sure this is required, but it didn’t hurt.
  2. On the Mac we need to fiddle one default.  Enter the following command in a terminal:
    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
    At this point, Time Machine would connect, but then fail with the error message: “Time Machine Error – Backup disk image could not be created”
  3. The ReadyNAS folk had a solution that worked for me.  Create the backup volume locally on the Mac and move it to the network volume:
    Determine your hostname, hopefully it is a simple one.
    Issue the command “ifconfig en0 | grep ether” which will find the MAC address of your Mac.
    Using <hostname>_<mac address>.sparsebundle as the filename we create a new volume:
    hdiutil create -size 140g -fs HFS+J \
    -volname "Backup of magpie" \
    magpie_0016cbaf91d7.sparsebundle

    Copy the newly created “sparse bundle” to the network volume.
  4. Now start up Time Machine – you should be good to go.  I opted to leave SpotLight enabled, this did significantly slow down the backup performance – but I do want the ability to search for “lost” files from the backup.

Time Machine is pretty weird.  I had assumed (wrongly) that it simply gave you a file view in time.  It turns out that many of the Mac applications are time machine aware, and will show you a views of the past.  For example, you can view your email through time and recover the mailbox from the past.

[Edit: April 2013 – it’s been some time since I stopped using this solution. I experienced this failing twice for me in basically the same manner. When the timemachine volume would get full my backup would stop being accessible. Instead of spend more time figuring out what exactly was wrong, I’ve moved onto an rsync (rsnapshot) based solution].