Wednesday, 19 July 2023

Building an UnRaid Home Server for Media Storage and Automation

Are you looking to create a versatile and efficient home server that can handle your media storage needs while seamlessly integrating with your home automation system? If so, building an unRaid home server might be the solution you've been searching for. In this post, we'll explore the benefits of unRaid and provide practical advice on building your own home server for media storage and automation.

I've been using unRaid for home storage and automation for about 10 years now, and have been blogging about it here for almost as long. A lot of my posts are quite specific, so I thought I'd try a high level guide for those starting out. Let me know what you think, or if there are other specific topics you'd like to see covered.


Section 1: Understanding UnRaid

unRaid is an operating system designed specifically for building home servers. Unlike traditional RAID systems, unRaid offers the unique advantage of allowing you to mix and match drives of different sizes, providing flexibility for storage expansion. This means you can easily upgrade or replace individual drives without the risk of data loss. unRaid's virtualization capabilities also enable you to run multiple operating systems and applications on a single server, making it an ideal choice for various home automation and media streaming needs.


Section 2: Selecting the Right Hardware

Selecting the right hardware is crucial when building an efficient UnRaid home server. The good news is, UnRaid is quite tolerant of underlying hardware, so really any old system will work to get started, though for specific use cases, there are some key decisions to think about. Here are the key components to consider:

Motherboard:

Look for a motherboard that supports a sufficient number of SATA ports for your storage drives and has ample expansion slots for future upgrades. In my experience, expansion slots are key. You can always increase your storage capability in future by adding PCIe SAS or SATA cards. For virtualization, you might need to add extra GPUs, USB controllers etc. 

I've had several hardware iterations of my own UnRaid server. One of the nice things about UnRaid is that you can easily migrate your data drives to an entirely new system, and it 'just works'. Right now, my system is based around AMDs second gen Threadripper architecture, specifically an ASRock Taichi X399. This is slightly older now, and somewhat expensive, but it's been super reliable for me, and still gives me everything I need in terms of storage, expansion and other features. The only thing that would prevent me purchasing today is the limitation of 1G ethernet.

I tend to have no preference for Intel vs AMD, but find historically that AMD solutions are somewhat more cost effective in terms of price / performance. Again, UnRaid doesn't really mind.

If I was starting out again today, building a no holds barred system, I'd be tempted to go with the Epyc platform. On the other end of the sale, if I just wanted to get started, this Ryzen bundle, (or similar),would be what I'd likely go for.

Processor (CPU):


Opt for a powerful CPU that can handle the demands of media streaming and home automation applications.

I'm currently running a Threadripper 2950X which is a second generation threadripper. It appealed to be as it's a 16 core , 32 thread CPU that provides plenty of scope for running multiple virtual machines inside UnRaid. 

My dream system would likely run an Epyc 7763 Tetrahexaconta (64!) core CPU, but starting out, I'd go for a current generation Ryzen 7, or similar.



RAM:
Choose an adequate amount of RAM to ensure smooth operation and multitasking capabilities. If you plan to set up virtual machine son your UnRaid system, more RAM is better as you'll be assigning it to your VMS.

Your RAM selection will be dictated by what your motherboard supports in terms of speed, form factor etc. I currently have 96GB of Corsair Vengeance DDR4 in my system and it has supported up to 5 VMs running simultaneously without any problems.

Many recommend installing fault tolerant error-correcting RAM (ECC). This provides additional benefits in data stability, but it requires specific and often expensive RAM as well as motherboard support. I've never felt the need for it, but many swear by it.

Storage Drives:

Select high-capacity hard drives or SSDs for your media storage needs. Consider using a combination of larger and smaller drives to maximize storage capacity while maintaining redundancy.

UnRaid has four main storage mechanisms to consider;

Boot Drive: UnRaid boots from a USB thumb drive and, once booted, resides in memory with very little writing to the boot drive thereafter. Any thumb drive will do the trick, but branded ones are likely to be more reliable. The UnRaid licence is tied to the USB drive UUID and while this can be changed, it's best to invest in a reputable brand. No need for USB 3 .0 here.

Main Array: This is the array of drives across which the user creates 'shares' to store data. These 'shares' are typically set up thematically(eg movies, music, work etc.) and are usually exposed as network shares. The disks in the array can be of any and differing size or type, and while SSDs can be used, they are usually conventional drives.

As part of the main array, there is an option for one or two Parity drives. Parity is the mechanism by which UnRaid protects data on the array in the event of a disk failure. It's not a backup or duplication, but rather a calculation across all data disks that allows a disks content to be emulated if the drive fails, and rebuilt to a new or replacement drive.

Parity drives must have a capacity as least as large as the largest individual drive in the array.

A great feature of UnRaid is the ability to mix and match drives by size, so you can get started with what you have to hand. 5200 rpm drives work OK, 7,200 RPM drives will offer slightly faster operations. Drives optimised for NAS usage tend to be a little more robust for the kinds of use cases UnRaid typically sees.

The best value in drives I've found are external USB drives that can be 'shucked'. That's to say, the case opened and the internal drive extracted to be installed in your system. This, of course, invalidates warranty. 

I have a few of these WD Elements 14TB drives in my array and they work perfectly. You can often pick these up on sale or offer, so keep an eye out. If I didn't want to bother with shucking or had a concern over warranty, I would be inclined to go for something like this Ironworlf

Pool Devices: Cache drives are additional pools of one or more disks that can be used for various functions. Historically, a cache drive was used to speed up write operations to the array. When data is written directly to a share on the array, it can be slow as UnRaid needs to make parity calculations and write to potentially several drives. With a cache in the system, data is written directly to a faster cache drive, and then written later to the array. Thus data appears to be written faster to your storage. The catch is that cache drives or pool devices are NOT parity protected, so data is not fully protected until it is written to the array.

This shortcoming has been somewhat addressed in recent UnRaid versions as a cache drive is no longer a stand alone device but can in fact be a RAID pool, offering redundancy and protection for the cache drive at the expense of duplication. Multiple cache pools are also now possible. Another typical use for cache pools is storage of Docker files , VM disk images and other data data that might benefit from faster read/write operations.

Given their traditional use cases, people tend to use SSDs or NVME drives as pool devices.

Unassigned Devices: Through the use of a plug in, any other disk in your system that's not assigned to the array or a pool can be accessed as an unassigned device. These can be any kinds of drives, including externals attached via USB. This is a convenient way to get data to and from your server if network access is a challenge. Additionally, unassigned drives can be 'passed through' directly to a VM offering near native access speeds.


Section 3: Setting Up the UnRaid Server

Setting up your UnRaid server is a straightforward process. Follow these steps to get started:

  1. Install the UnRaid OS onto a USB drive and boot your server from it.
  2. Configure the drives in the UnRaid web interface, assigning them to the appropriate storage and parity roles.
  3. Set up the network settings, ensuring your UnRaid server has a stable and reliable connection.
  4. Install and configure the necessary plugins and applications for media streaming and home automation, such as Plex, Emby, or Home Assistant.

Those are the principle steps. In a future post, I'll expand on the details here.

Section 4: Expanding Functionality with Networking

A robust network infrastructure is essential for seamless media streaming and home automation. Consider the following networking equipment:

Router: Invest in a high-quality router that can handle the traffic generated by media streaming and home automation devices.

Switch: Add a managed switch to your network setup to enhance connectivity and manage bandwidth effectively.

Access Points: Install access points strategically throughout your home to ensure reliable Wi-Fi coverage for all your smart devices.

I'm a big fan of Unifi equipment as I find it easy to use, robust and I can control it all from a Docker container on my UnRaid system. Currently I have a Security Gateway, a 24 port PoE switch, a few wireless access points and some additional smaller switches dotted throughout the house.



Section 5: Automating Your Home with UnRaid

UnRaid provides a solid foundation for integrating home automation into your setup. With the ability to run popular automation platforms like Home Assistant or Node-RED, you can control your smart switches, sensors, and hubs seamlessly. Automate lighting, temperature control, security systems, and more to create a truly smart home environment.


Conclusion:

Building an unRaid home server opens up a world of possibilities for media storage, virtualization, and home automation. With its flexible storage configuration, powerful hardware support, and seamless integration with automation platforms, unRaid empowers you to create a personalized and efficient smart home setup. Explore the benefits of unRaid and start building your own home server to transform your media and automation experience.

Do check out other blog posts here, and come back regularly for fresh content. 


If you found this useful, consider contributing to the cause by buying me a coffee. Every little helps feed my often insatiable tech. appetite!

Buy Me a Coffee at ko-fi.com





No comments: