How to make a Home Theater PC/ Storage Server as easy to use as a toaster
Update (5/11/2011): I have replaced the build below with an improved model, though it is larger. Read about it here!
My goal behind building my HTPC/NAS device was to have a storage/TV solution that:
a) Didn’t need me to babysit it to get it to work and
b) Was easy enough to interface with that it would pass the WAF (wife acceptance factor)
Given those two points, the server needs to function more like an appliance and less like a project. Once complete it should do what it was built to do and not require me logging in every day to check on it.
I wanted a device that would be able to do the following regardless of whether or not I was around:
- Hold all of our media
- Collect media on it’s own
- Play it in 1080p over HDMI to our TV
- Be able to send the media to our cell phones
- Act as additional hard drive space for our laptops
- Hold all of our backed up data
- Enough redundancy to suffer a failed hard drive without any losses
Because these requirements are slightly more processor intensive, I would need a system a little more powerful than a nettop. I did consider going with an Atom/Ion system for quite a while at first because of the lower power requirements but stumbled upon an article at Tom’s Hardware that solidified my decision against the Atom platform. The article showed that because the Atom processor takes longer to complete it’s tasks than a traditional processor, it actually burns more power than a traditional dual core processor.
Mobo: Intel GD45FC – Micro/Mini form factor and has a X4500HD graphics processor and HDMI out
Processor: Pentium E6300 2.8ghz Dual Core – at 65w it packs a punch but won’t kill my power bill
RAM: 4gb OCZ DDR2 800mhz RAM
OS Drive: Seagate 120gb 7200 RPM 2.5” laptop hard drive
Main Drives: 4x Western Digital Green 1TB Drives
SATA Card: SYBA SY-PEX40008 PCI Express SATA II Controller Card
Case: Rosewill RS-MI-01 BK Mini ITX w/250 watt power supply
Putting all that together was quite a tight fit. The case was so small it took a little “creative building” to get it all in. I might swap the case out for one of the Chenbro NAS cases if I ever have $200 sitting around burning a hole in my pocket but this does the trick for now! I went with a smaller, faster hard drive to house my OS and then put the four green drives into a RAID5 configuration. Since my primary concern is being able to read quickly, I’m happy to sacrifice some of my write speed for the redundancy and the read speed.
So I tried two options here. First I started with Windows Home Server. This had some great advantages. The installation was easy, my XBOX 360 and Windows 7 laptops saw it effortlessly and the fact that it had a GUI interface on the actual server I could use to work on it. The downsides however were that automating tasks was a much more laborious process, it ran a lot hotter, and I had to use their proprietary drive configuration that wouldn’t let me remove my boot drive from the storage pool. Those down sides were too much for me so I went with Ubuntu Server 10.04. There is so much documentation and help available these days that unless the thought of using a terminal is way too scary for you, this is by far the best way to go. The abilities this give the server are much more advanced too.
Installation and Software
OS: Installing Ubuntu Server was pretty straight forward. I loaded the OS on to my thumb drive and set it to boot using unetbootin. Once I booted the server into the install program I selected the basic Ubuntu Server, SSH, and the LAMP server package. I partitioned my smaller 120 gb drive so that root, usr, tmp, and var had their own partitions along with my swap partition. I set all four of the WD Green drives as Linux raid drivers and then went into the RAID setup to configure them as an EXT4 RAID5 array. I mounted the array as my /home directory since that’s where all the media is going to be stored. Also, this is the data I really need to be redundant if one of the drives fails. Once the formatting and installing finished the server greeted me with the terminal login screen. The server was ready for action!
Webmin: In order to manage the server easier, I prefer to use a mix of SSH and Webmin. Webmin gives you a graphical web interface that makes some of the basic managing easier. I’m really impressed with how much you can do from Webmin, including browsing, moving, and managing files, managing settings, monitoring the status of the server, and even fixing things when they go wrong (I had a hard drive die and could tell the RAID to rebuild itself through the Webmin tools).
Samba: By sharing the huge RAID array with Samba, I can map all of the server’s storage drives to our Windows 7 laptops. This way anywhere in the house we can access the data on the sever as if it was stored locally. The computers can also back up and restore files from the server which already came in handy once when I hosed my laptop.
The Media Acquisition Piece:
One of the key pieces of this media server is that it has to be about as easy to use as a toaster. I want it to automatically acquire all of our new TV shows and download/sort movies with one-click selection. I chose two methods for getting media but either one of these could be implemented to handle this.
For TV shows I use Torrentflux-b4rt to download an RSS feed set up at showrss. To do this, you use a little gem called “fluxd”, a daemon that runs in the background running specific tasks. The two important tasks fluxd is running for me are 1) Download any new torrents from my RSS feed to a folder and 2) Check that folder every 10 minutes for new torrent files and automatically start downloading them when they appear there. The real magic comes in with the sortTV perl script. Using cron (the task scheduling function in Linux) I have this script run once a day and it looks at the TV show names and then files them into their appropriate folders using the /TV/Show Name/Season Number/ filing system. I can’t tell you how excited I am about this, especially since it works flawlessly (so far at least).
For movies I went a different route. Movies are a different beast because you don’t want all of one type of movie, like action or drama. You want the movie you want and you want a GOOD copy, not a CAM. For this reason I pay ($9.99 a month) for access to a newsgroup service, easynews. I like this service in particular because for the price I get 20 gigs a month that I can download as fast as my internet connection can handle. Now easynews alone will give you access to way more content than you’d ever want to deal with so you need a way to filter the content to get just what you’re looking for. For this we have NZB sites like nzbs.org. These catalog all the media on news group servers into categories like “movies” or “tv” and even further into the quality. Once you get a free account on one of these sites you can just browse all the latest movie postings until you find the ones you want, put a check mark by them and add them to your “cart”. This dumps them into your rss feed, ready to be downloaded.
So how to get those files from the RSS feed, to your sever, unzipped, and put into the correct folder? Sabnzb, that’s how! Sabnzb does for the nzb files what torrentflux-b4rt and fluxd do for the TV show torrents. Sabnzb watches the RSS feed, downloads all the new movies, tv shows, music, or whatever else you put in your cart, unzips/unrars them, deletes the compressed files, and moves them to folder based on media type (movies go to /Movies, tv goes to /TV etc). It can get really advanced with it’s TV show or movie sorting but since I just use it for movies I don’t have any of that set up.
With these two services, I can now go to either showrss or nzbs, click on a new TV show or movie that I want to watch, and a little while later it’s downloaded and sorted. No further action is required by me. I love how seamless this works!
Media Consumption: The fun part!
Now that all of this media is just amassing on the sever, I need it to get to my TV, laptops, and cell phone for me to enjoy it. Otherwise this would all have been a waste, wouldn’t it? I used a couple different programs to do this since each of them has one thing that it does really strong but is weak in other areas.
Watching Media on the Xbox 360: Twonky Media Server
The Xbox 360 has a great value added feature of being able to act as a network media player. I originally bought it primarily for this reason but eventually discovered that while it will play media off the network, it’s really damn picky about the media it plays. Twonky is a DLNA server that does a really good job of finding the media the 360 can play and sending it over.
Watching Media right off the server: XBMC
This is a really, really sweet piece of software if you’ve ever used it. With the server constantly acquiring media and sorting it, XBMC takes it a step further and automatically pulls down the IMDB info, the posters for the movie or show, and the trailers as well. With a gorgeous 1080p interface optimized for the TV, this is really the best way to go. Right now I just have this running off a monitor but because the mother board has a HDMI output, I plan on moving this into my living room once I work out some pesky wiring issues. As a bonus there are aps for Android OS, iOS, and WebOS to use cell phones as remote controls. This is perfect for parties where any one of the guests can see and change the video or music playing if you grant them access.
Media off the cell phone: Ampache
Even with modern cell phones now coming with gigs of storage in the double digits, none of them can even get close to the terrabytes of media stored at home. Although I keep my most frequently listened to songs directly on my phone, what am I supposed to do if I decide I need to listen to the entire Rolling Stones discography while I’m traveling for work? Android OS, iOS, and WebOS all have applications that can log into the Ampache server (which just runs off the Apache web server) and seemlessly stream any song you have. With great search features, finding one song out of 10,000 isn’t hard either. Ampache will now handle video streaming too, but unless you have a massive upstream connection at home, expect a long frustrating wait before the movie trickles onto your phone.
The End Results
I love to tinker with gadgets and don’t mind troubleshooting the occasional issue or two. A system that has to constantly be prodded into producing what you built it to do is not a finished product, it is an eternal project. Although my installation wasn’t without the occasional snag, the system now works so flawlessly, it’s almost… boring. When we decide we want to watch something new, it takes a couple clicks in a web browser before the content is on it’s way. Everything gets sorted and cataloged correctly without any manual moving etc. The only point any maintenance is required at all is once the drives start to get full, and then we’ll just open up the shared folders and delete old TV shows (for daily TV shows I even have a cron job set up to delete them once they reach over 15 days in age so it’s actually only an issue for multi-season shows). Mission accomplished!
Stay tuned though. This home media project will be the first of many!