The Moocher Builds a New Server

Last week, I took the plunge and ordered bits and pieces to make a new FreeBSD based FreeNAS file server. This server consolidates Plex, my iTunes library, and Time Machine backups on a new ZFS ZRAID2 volume. I made this move for several reasons.

I was double maintaining my media library, once in iTunes and again to update the Shield TV external disk

My Drobo directly attached storage is about 10 years old. It had FireWire and USB2 interfaces and no network interface making it unfriendly to modern computers without these interfaces.

After a lot of review of the usual suspects in the market place, I was unconvinced that they were sufficiently robust to prevent bit rot. Most were built on Linux, Linux software RAID, ant the EXT4 file system. NetGear Ready NAS uses Linux with the BTRFS making it a bit more robust but was not comfortable with a Netgear solution as it I was unsure if the entire product line used BTRFS or if current products were a mix of BTRFS and EXT4. I also wanted the freedom to run other applications such as audio recording in the future, something an appliance would probably not allow.

This article describes the component selection, commissioning, and software configuration. The references give the detailed procedures used and these procedures were correct and complete. The only disappointment was that UniFi NVR does not play on FreeBSD and I elected not to install a supported OS in a jail. Ubiquity distributes the packages directly rather than through the normal distribution work flows and services. At this point, they are a year behind the community and have yet to release a Win 10 version.

In a future article, I’ll describe how I use ZFS snapshots to give some protection against user filesystem encryption malware.

Goals

Replace 2 aging Drobo Gen 2 storage arrays

Host a Plex Media Server for music playing

Store my iTunes Media Library

Provide Time Machine bulk storage

Software

There are a number of file server distributions out there including FreeNAS, NAS4free, and several others. I was looking for a mature and well supported product that had a history of continuing support. In my search, I watched a lot of YouTube video and read many home brew blogs and Wikipedia pages. After reviewing all this material, I settled on the FreeNAS distribution of FreeBSD, the Cal Berkeley Unix distribution, now overseen by Ix Systems, a provider of mid-scale storage systems. FreeNAS has a small footprint, minimal attack surface, BSD jails, and bhyve virtual machines.

FreeNAS can serve files using SMB and AFS protocols to support an iTunes media library on a Mac and Apple Time Machine backup storage.

FreeNAS can run Plex Media Server in a BSD jail. It is also able to run Ubiquity Networks UniFi controller in a jail.

I opted to host the Ubiquity NVR video storage on a Ubiquity NVR appliance as Ubiquity distributed the packages directly rather than through the Linux distribution workflows and was not offering a version for FreeBSD and support folk indicated a lack of interest in doing so in the Ubiquity forums.

Hardware

IX and the FreeNAS.org gang strongly advise use of ECC capable processors and memory. Memory errors can lay FreeNAS low. Desktop PCs have faith based memory. Faith that what came out was what was stored. Cosmic rays and radiation have a way of causing soft memory errors that systems without parity are unable to detect. ECC coding provides the tools needed to detect and correct single bit errors, detect all 2 bit errors and many multi-bit errors. When a system runs continuously and has long-lived memory resident data structures, ECC coding is essential to successful operation.

The FreeNAS community spoke well of SuperMicro X10 and X11 series server motherboards as FreeNAS platforms. This hardware is solidly designed and built using well-supported chip sets and reliable Intel on-board NICS. These motherboards support ECC and have either 2 or 4 DIMM slots depending on the motherboard form factor. I elected to use an X11SAE-M motherboard designed as a workstation board. This board trades the management processor for sound hardware and supports modern on-board video over DVI/DP/HDMI interfaces rather than VESA analog video commonly found on server class boards. It also offered USB 3.1 as an option on the 6 USB 3 ports available plus a pair of USB 2 ports on the IO panel.

I chose a Fractal Design Node 804 uATX case with room for 8 3.5 inch disk drives and 2 2.5 inch disk drives. This case is well made and relatively easy to work in. This case supported 2 USB 3 ports on the front panel and comes with 3 high quality case fans.

For power, I chose a Seasonic 650 watt modular power supply which had sufficient power to run the disks and enough ports to power the disks. It also had sufficient power for high end graphics down the road. This supply is rated for continuous operation and remains efficient at low to medium loads characteristic of continuously operating servers.

I chose an Intel Xeon E3-1225 processor with built in video. This saved the cost of a video card and offered sufficient OpenCL capability to support audio and video transcoding. So far, it has not broken a sweat. Should I wish, I have the space and power to add a sports gamer video card to the system.

I was careful to buy memory directly from Crucial as SuperMicro recommended Micron memory for this motherboard.

I bought 3 Western Digital Red 4TB disks and 3 Seagate Iron Wolf 4TB disks. Both are tailored for small server operation. This was more pragmatics on my part. NewEgg was limiting quantities to 5 and I needed 6. But this also gives some diversity in disk design and manufacture. Both makers have similar reliability which varies from design to design and from time to time. The most important factor in disk life is how it was handled and shipped to you. All 6 disks came in shock protected packaging unlike the 2 I bought from NewEgg 10 years ago.

The hardware assembled easily following the Fractal Design and Intel guides. I used the stock cooler provided with the Intel retail processor. I did need to buy some extra SATA cables and SATA power cables from Amazon to complete the build.

Software Installation

I first tried to install FreeNAS 9.10 but it hung loading kernel modules. After some reading, I elected to move to FreeNAS 11-RC based on FreeBSD 11. FreeNAS 11-RC came up smoothly and is running well. IX Systems is in the process of building a new UI, new containers environment, and new virtual machine environment into FreeNAS but my application could use the FreeNAS 9.10 functionality and would inherit these features as they migrated to FreeNAS 11-Stable.

I followed the Time Macine How To to set up a Time Machine data set and set quotas to prevent Time Machine from eating the disk.

I followed a Matt’s UniFi Controller How To to set up UniFi controller in a jail. This runs solidly. I use UniFi Controller to keep an eye on a new power over Ethernet capable core switch.

Initial configuration

FreeNAS requires further assembly after software installation. Installation will create the first FreeNAS volume. Once that volume is created, I installed Plex and Ubiquity UniFi controller jails following following the instructions in the references. A FreeBSD jail is a tailored view of the kernel and filesystem that provides the resources needed by a group of cooperating processes. These sandboxes are isolated from the general user space and from each other. If something goes wrong, the jail contains the carnage.

Note that FreeNAS advertises its portal web server as a Bonjour service. You can browse to it as https://hostname.local/. This allows the FreeNAS instance to use DHCP rather than a fixed IP address. Same with the shares. They are advertised as Bonjour services. Life is very convenient this way. If only the other web interfaced services would do the same. I’m talking about you, Ubiquity.

iTunes and Plex Playing Together

With all the software installed, it was time to get iTunes and Plex to play well together. The key to this is to create an iTunes library on a FreeNAS SMB share.

Make a new iTunes library

Create a SMB media dataset.

Using finder, mount the media dataset on the Mac

Restart iTunes while holding the option key. iTunes will ask if you want to change iTunes libraries or create a new one. Elect the create new iTunes library option.

Follow the steps to create the new library. Select the “keep library organized” option so iTunes will build the artist and item folder tree in the new library.

Once the library is ready, copy the existing media to be added and paste it to the new library’s Automatically Add to iTunes folder.

When the smoke clears, your media will be in the new library.

Setup the new Plex server

Setup the new Plex server by having it build a Plex media library from your new shared iTunes library. Plex uses the original media in place but builds its own media catalog independent of iTunes. You do this evolution following the Plex instructions in the reference. Plex has not ported the premium library features to the BSD family of operating systems so create a regular Plex library.

When creating the music library, select the iTunes Music folder as the music repository. After a whole lot of shaking, Plex will build a catalog, fetch artwork and be ready to go.

As a convenience, Plex offers an iTunes channel that allows Plex to use your iTunes play lists and Genius play lists. Enable the iTunes channel and create play lists in your new library.

Time Machine Setup

Time Machine setup proved to be easy. Following the instructions in the references, I created an AFP share, a Time Machine user and group, and setup disk quotas for the dataset. Once those tasks were complete, I opened Time Machine preferences and created a new shared backup disk while leaving the old disk in the mix. In this configuration, Time Machine flip flops between the two volumes. When the Drobo begins to have spells, I will retire it.

UniFi Setup

This system hosts a UniFi controller running in a BSD jail. The controller is a Java application distributed as a BSD ports package making installation easy. Sadly, Ubiquity does not distribute UniFi NVR in this fashion.

UniFi Controller in a Jail

I set up a UniFi controller jail following the instructions in the references. This process was straight forward and everything worked as advertised. I elected to allow the jail to configure networking using DHCP. This means I have to find the UniFi Controller portal using the Ubiquity cloud portal. This service allows remote management access and, on the local net, redirects the browser to the proper web server from the jail.

I have one UniFi switch which is my network core switch and provides power over Ethernet for 3 Ubiquity video cameras to be installed later.

UniFi NVR in a Ubiquity NVR

Ubiquity provides Windows, Ubuntu Linux, and Debian Linux packages for UniFi NVR, the video recorder portion of UniFi video. Ubiquity’s builds are a bit dated with versions for Win 7, Win 8, and Ubuntu 16.04. I don’t believe they have released the source so the community can update the products for newer distribution releases. They have elected not to support the BSD family of operating systems including Mac OS. Which is strange because the product is a Java application (mostly?). The blessing of Java is that things should run in any conforming environment but the curse is that you have to test them all.

And Oracle Java is full of exploits so it better be in a jail or standalone host. When I set up the cameras, I’ll establish a VLAN for them and the UniFi NVR to keep vermin out of the main network.