Wednesday, September 16, 2009

Low Power Home Server Project

For too long I've left a computer running in my house to act as a little server, eating up electricity and heating up the living room. I general have used old machines that are useful for little else, but while these computers are essentially free, they use your standard 300 W power supply.

My goal in this project was to find a cheap server configuration that I wouldn't feel guilty about leaving on all the time. I went ahead and bought two 1 TB hard drives; these are cheap as free nowadays. But what to use for the mainframe?

I thought about the Eee Box, a lost cost, low power desktop. Running Linux, it would be as flexible as I could hope for, and I could plug in the TB drives with a USB enclosure, but the price, at $300, was a bit steep. I looked at all in one network storage solutions such as this one from Netgear, but the cost was still a bit more than I wanted, and the flexibility was essentially nil.

It was the Eee Box that reminded me of the Eee PC netbook I wasn't using. This Eee PC was an old Celeron 900MHz model, clocked down to 630MHz. I had always found it difficult to use; the screen is just a touch too small, the keyboard was painful, and it was just plain slow. But, as a server I wouldn't have to interact with locally, it became very attractive.

I found here that the Eee PC draws about 910mA when on but with the screen off. With a ~10V power adapter this means about 9W. Running a USB hard drive adds around 160mA when idle, or 500mA when busy and the heaviest CPU and SSD usage pulls another 250mA This means I would be pulling about 11W at idle, but only as much as 16.5W busy. That's like one of those compact fluorescent bulbs running all the time. Not too shabby.

I picked up a two drive USB enclosure from Newegg, so next I had to decide how to do backup. A TB is beyond my current needs, so mirroring the drives was my plan. But, should I set them up in RAID 1? This was the idea, but I decided this was a mistake. Faulty writes to a RAID 1 still result in data loss. The smart approach is to use one disk as the main data drive, and set the other up as a backup.

After I installed Ubuntu, I wrote a simple RSYNC script to do the backups for me, and added it to cron for thrice a week. Here's the script:

#!/bin/bash

rsync -avc --progress --log-file=/home/my_user_name/rsync_log/$(date +%Y%m%d)_rsync.log /media/data/ /media/backup/
Now, my data is backed up three times a week to the "backup" drive. I was worried about the speed of the Eee and the USB enclosure for serving movies, but I haven't seen any problem streaming movies to my set top box yet. There is no doubt that copying big files is slow, but it's managable.

I then set up LAMP for serving, UFW as a firewall (redundant, since my router is acting a firewall, too), and NX for remote access. After port forwarding on my cable modem and router, I can access this machine through ssh from anywhere. My next plans are to setup sharing with my XBox 360 and use a spiffy sharing tool like Tonido in case I start to hate Samba.

Overall, tons of fun, cheap and eco-friendly. How can you go wrong?

No comments:

Post a Comment