I’ve been running an Ubuntu 10.04 server with a small 4TB of hard drives for a few years now. It had 2 2TB disks, running RAID0 and RAID1 on separate partitions using mdadm. RAID0 hosted media, RAID1 was for backup. This worked well, but had the issue that it was completely non-extensible. Once the RAID0 filled up (getting close), my options would be:
- Buy 2 or more disks for another separate RAID setup and bear with having to manage 2 partitions that were used for the same thing
- Buy 2 or more disks, re-build a RAID5 with one disk missing with new disks, copy all the files over, and then slowly adding the original disks to the array (the process would take >48 hours)
I really got myself in the foot by choosing to go with RAID0 originally, but a RAID5 would not make this situation much better. More on RAID5 later.
Having some extra time because of the holidays, I decided to completely restructure the server, ending with this setup:
- Case: Fully modular full tower
- Silicon: Basic motherboard with bottom-of-the-line i3
- OS: Ubuntu Server 12.04 LTS (Precise)
- Disk redundancy: SnapRAID
- Disk virtual views: AUFS
- File sharing: SMB, AFP (for time machine only)
- Media sharing: Plex Media Server
- Music sharing: Subsonic
- Torrents: Transmission
- Usenet: Sabnzbd + Sickbeard
- Management: Webmin
Deciding to build a server
I wanted an HTPC, home server and eventually gaming computer all-in-one. I found out the hard way that, no matter how hard you try, these are actually mutually exclusive. Below are my requirements for each type of computer.
- An HTPC should be tiny, quiet, and extremely power efficient. It needs practically no disk space, should store data only to buffer, and should require no maintenance whatsoever. It should be OK to power on and off on-demand.
- A home server should be as quiet and power efficient as possible. It should have ample disk space. It should take a minimal amount of effort to increase disk space. It should be powerful enough to perform whatever its clients require of it, including video transcoding, P2P sharing, file sharing, web hosting, and possibly VM hosting. The above demand that the home server be always-on.
- A gaming computer… well, it should be powerful and fast. That’s about it. Unfortunately that also tends to make the computer large, loud, and power hungry.
While it seems that the requirements of an HTPC can be mostly satisfied by a home server, a home server cannot be shut off and will most likely be louder than an HTPC. My personal concern is that I strongly prefer a headless server (no graphical user interface). This makes the server build minimal, which tends to make the server more stable. Throwing in HTPC features introduces a significant amount of software that I would not want on my server. Finally, a relatively inexpensive Roku box or AppleTV (with some tinkering) can easily take the place of an HTPC, given that the home server meets the requirements above.
Since the 3 options do not work well together, I decided to keep them separate, and start with building a home server. The rest of this guide will cover how to build a Linux home server that meets my requirements above, and the choices made in doing so.
Server build choices
I mainly considered the choices of using an NAS, using/building a small server (like Mac Mini) + external SATA/RAID enclosure, and building a full DIY server. They all have their pros and cons, and which one to choose depends on your budget, how much time you are willing to spend building/configuring the server, and whether you may expand it in the future.
- Most compact, likely quietest and most power efficient
- Extremely easy to set up. Just have to stick in hard drives and the NAS takes care of the rest
- Vendor support
- Expensive. You are paying a lot for the engineering and software
- Vendor lock-in. Hard drives cannot just be taken and put into another computer. Will need to pay for another NAS from the same vendor to expand the server.
- Small community, less software (though most server software like SMB, AFP, torrent should be built-in)
- Less powerful. Most NAS are designed just for serving files, meaning it is unlikely they will be able to support video transcoding
If the disadvantages listed are not important to you, then Synology 412+ is a great choice. Note that any lesser models will not be transcode over Plex at all. This one can barely handle 720p.
Small server + external SATA/RAID enclosure
- Still relatively easy to set up, especially if you choose something like a Mac Mini for the computer
- Very configurable with good community support
- Powerful as you need it to be
- 2 pieces of hardware vs 1
- May be expensive depending on the computer and enclosure. Unlikely to be cheaper than a DIY server
- Vendor lock-in on the enclosure
- Possible performance impact using 1 cable to connect multiple drives
DIY home server
- Fully configurable
- Strong community support
- Relatively cheap
- No vendor lock-in, can be easly extensible
- Powerful as you need it to be
- Can be completely open source
- No vendor support
- Relatively difficult to configure, especially for Linux beginners
Obviously I chose this option. The advantages far outweigh the disadvantages for me, and I get to build it from scratch.
My original home server was housed inside a ThermalTake Lanbox Lite. This is a low-profile, sturdy, fully modular case. The problem with having a small case was that it just couldn’t hold enough drives. I maxed it out with 2 media disks, 1 system disk and 1 DVD drive. Another issue was that being so compact, cabling inside this case was a mess.
I went with a Fractal Design Arc Midi, which holds up to 10 drives, 8 of which live in removable 3.5’ drive trays. Any modular full tower would do really. I really like recommend modular cases because they not only make maintenance easier, they make the initial setup a breeze.
If you don’t mind having a cramped case and don’t want a full tower, the LIAN LI PC-Q08B Mini-ITX at $110 is a great choice. Make sure you purchase a mini-ITX motherboard for it though.
Motherboard and CPU
For a home server, the motherboard doesn’t need any bells and whistles. ASUS and its cheaper ASRock line are good choices. For CPU, the bottom desktop Intel processor would be a great choice. Intel processors tend to be slightly more expensive than AMD processors, but are more power efficient and powerful. The processor I chose is i3-3220. It can handle anything I throw at it, does 1080p video transcoding just fine, runs VMs, and idles at around 15W.
Always have an extra disk for back up. This should be the largest disk in the array. Green drives will use a little bit less power, but it will save money in the long run. They are also slightly slower, but that doesn’t matter for the purposes of a home server. Two backup disks is overkill since it’s much more likely for you to lose the whole computer (and many other things) due to a natural disaster than to lose 2 disks at the same time.
< 1GB is enough for just downloading and serving files. 2GB would be better if you want to run Plex. 4GB or more for hosting virtual machines.
Power supply and fans
Any power supply < 300W will do. Obviously quieter power supplies are better. The Seasonic X-400 is a passive power supply with no fan, and should produce nearly no noise.
It’s recommmended to replace the CPU fan with quieter alternatives, like the Scythe Shuriken. The case fans can also be replaced, or just turned off. It’s unlikely your home server will be producing enough heat to need them. A well-ventilated case will help ensure that.
Storage technology choices
RAID is the most common solution taken for redundant server storage, and is the technology I chose for my original server. But as it turns out, RAID isn’t quite the best solution. Let’s rule out RAID0 and RAID1 first. RAID0 has no backup. If any drive in the array fails, you lose the entire array. RAID1 has great redundancy but is wasteful. RAID5 looks like a good choice, but while you can grow a RAID5 (add more disks), it is time consuming and somewhat error-prone. You also can’t add larger disks. If you have an array of 2TB disks, adding a 3TB disk will effectively turn it into an additional 2TB disk. Finally, a RAID array cannot be spun down if any of its disks is being accessed, so it’s quite power hungry. ZFS and RAID have similar issues, ruling both of them out.
Non-RAID redundant storage technologies shine here. The technologies I consider below all fall in this class. They provide redundancy like RAID, but tend to be more extensible. The ones listed below also have the property that the data is not striped, meaning that you can mount it as a standalone disk and use the files stored on there. It would be impossible to make sense of the data on a single disk in a RAID0/5.
UnRAID is a popular choice for home servers, but I dislike that the server software is locked to a USB key. It also forces you to use the UnRAID Linux distribution (a variant of Slackware). Lastly, UnRAID only works on clean disks, meaning you have to buy new hard drives, set up UnRAID with them, and then migrate your data over.
FlexRAID is another popular choice. I admit I didn’t look too far into it since its support for Linux is limited, being designed for Windows.
SnapRAID is the choice I decided to go with. It’s very different from the other choice in that it does not compute real-time parity. You schedule SnapRAID to compute parity at certain intervals, usually nightly. This reduces overhead greatly. Snapshotting rather than real-time isn’t much of an issue since data shouldn’t change often on a media server. SnapRAID also functions on filesystems rather than block devices, so you can mix and match filesystems and disk sizes (UnRAID and FlexRAID also support this), provided your parity disk is the largest disk in the array. This makes the system much more extensible than RAID. It’s also interesting to note that SnapRAID does backup by file and folder and allows you to exclude certain files/folders.
Virtual hard drive views
A very useful feature of UnRAID and FlexRAID is that they both provide virtual filesystem views (called shares in UnRAID). While each of your disks has its own filesystem and directory structure, a virtual filesystem view can merge the directories for each of the disks. From the user’s viewpoint, this makes them very similar to RAID because they make an array of hard drives look like a single hard drive.
SnapRAID does not have virtual filesystem views built-in, but instead lets other tools take care of the virtual filesystem views. Some of the choices are AUFS, UnionFS, OverlayFS, Union Mount, mhddfs, and Greyhole. With the exception of Greyhole, the remainder of the tools are called Union Filesystems, and merge several filesystems into a single virtual filesystem. Greyhole actually works above the filesystem layer, relying on Samba to create shares that Greyhole manages.
AUFS was my choice. UnionFS is mostly outdated, OverlayFS has little documentation available, Union Mount seems to no longer be in development, and mmhddfs is too resource intensive. AUFS, on the otherhand, is well documented and has respectable performance. I considered Greyhole for a bit, but I didn’t really want the virtual filesystem to be dependent on Samba, rather have Samba to run on top of the virtual filesystem. I’ve had stability issues with Samba in the past.
Operating system choices
Some popular choices for home server operating systems are:
- Ubuntu Server Edition
I looked into FreeNAS for a bit. Its main advantage is that it has a nice web interface for configuring everything and all the sharing services are pre-installed. However, the downside was that FreeNAS 7 is old, way too old, and FreeNAS 8 is considered by many to be unstable. As for Slackware, I didn’t find any real negatives, but no strong positives either. Given that I’m already familiar with Ubuntu and it has such a strong community, I decided to simply stick with Ubuntu.
The current LTS (long term support) release is Ubuntu 12.04 Precise. I did try 12.10 for a bit, but did not find it stable enough for a home server. Given that Ubuntu pledges 5 years of security updates and 18 months of security updates for LTS, 12.04 was the obvious choice.