Installing and Updating Plex Media Server in a FreeBSD Jail (FreeNAS) via ‘pkg’

plex-logo-e1446990678679One problem I had with the FreeNAS plug-in architecture is the lack of a user-friendly update system. (Either it is hard to find, or that it doesn’t exist, it’s not user-friendly either way.) The version of Plex media server I received using the default plug-in installation process was several versions out of date and it looked like I was pretty stuck. In order to update, Google found manual instructions that were… well, let’s just call them ‘nontrivial’.

When I found out Plex media server is also offered as part of the FreeBSD Ports and Packages Collection (tracked via “FreshPorts“) I hoped that might be a much better way to go. I had to manually create the FreeBSD Jail running on my FreeNAS box, which was harder than the built-in plug-in version but was not horrible. Plus, if this goes well, it would be a one-time cost.

After the FreeBSD jail was set up, I opened a shell window into it and typed pkg install plexmediaserver which thankfully took care of downloading and installing all the binaries. The install process also ended with a few paragraphs of instructions on how to configure Plex to automatically start every time that instance of FreeBSD (in my case, the FreeBSD Jail) boots up. Copy-pasting the commands worked as advertised and everything was fairly painless.

I was then able to enjoy my home Plex media server for a few weeks. But there was one unknown: upgrades. I didn’t know how upgrades would work until I needed to perform one, so it’s just a waiting game for a new version of Plex to be released and see how things propagate. This week, the wait was over!

The first notification was from my home Plex media server. Apparently it checks for updates periodically and notifies me when one is available. After waiting a day or two, the update propagated to FreshPorts. Once that occurred, I opened a shell window into the FreeBSD jail running Plex and issued the following commands:

  • service plexmediaserver stop to halt the old running Plex.
  • pkg update to download the latest database of available packages.
  • pkg upgrade to perform updates of any new packages, including Plex.
  • service plexmediaserver start to start the new version of Plex.

I reconnect to the web interface of Plex running on my FreeNAS box, and I see the latest version up and running. Success!

SGVLUG: Custom Computer Projects

Last night I had the opportunity to present my Luggable PC, FreeNAS Box, and Portable External Monitor projects to the San Gabriel Valley Linux User’s Group. Though the projects themselves have only minimal relation to Linux, the spirit of customization and project sharing fits well with the Linux open source ethos.

SGVTalkTitle

I hauled in all the latest versions of my projects. Plus all the earlier drafts and revisions that have yet to be disassembled and pitched. More visual aids is always better than less and they proved quite popular after the talk concluded and people came up to look over the projects up close.

Some of the audience found the topic engaging and stayed after the talk discussing aspects that didn’t make it into the talk and offered ideas for future exploration. Some of those ideas were already on my to-do list and some are novel ideas I should explore.

A few people left early, whether they had other obligations or they got bored I might never know.

I don’t have a lot of public speaking experience so this was a great opportunity for me to get some practice in a low-pressure environment in front of a like-minded crowd. At the moment I’m not planning to go work in a mega corporation again. I might not need good presentation skills in a small business, but if I want to get entrepreneurial and start my own business, I will definitely need presentation skills.

This was good practice, building up the public speaking skill one bit at a time.

Much like my design and fabrication skills.

 

Acrylic Lights: Infinity Mirror

I’ve played with putting lights in my 3D-printed creations for glowing illumination effects. There were limits to what I could do with 3D printing, though, because printing with a clear filament does not result in a clear object. In contrast, acrylic is clear and works as a light guide with a lot of possibilities.

I’ve noticed a few attention-getting light effects in my acrylic projects to date, most of them created by happy accident. The acrylic box with external fixture made good use of external light. The Portable External Monitor version 2.0 was built from stacks of acrylic sheets: its fluorescent back light reflected between the layers like an infinity mirror.

PEMv2_InfLights

This effect was on my exploration to-do list for the future, but I moved it to the top of the list after seeing surprisingly good results on the FreeNAS Box v2 enclosure.

I had planned for it to have the standard PC status LEDs: one for power, and one for disk activity. The acrylic plate for motherboard mounting spacer also had two cutouts for 3mm LEDs along the center line. The red hard drive activity light is to be mounted high, and the blue power light mounted down low. The idea was for the blue light to illuminate the top edge of the plate. When there is hard drive activity, red LED will light up the center of that edge, and it should blend to purple with the power light. Both LEDs were blocked from direct view by the motherboard, so all we should see is a nice soft glow emitting from behind the motherboard.

FreeNASv2LightPlan

That was the plan, the reality was different. The red activity light worked as expected: when there is disk activity, the center of the top edge had a little red glow.

The blue LED decided to ignore my “nice soft glow” plan and put on an extravagant light show. It didn’t just light the top edge, it lit every edge of that acrylic sheet and had plenty of extra light energy to throw on the surrounding shelving.

FreeNASv2_LightsAbove

Here’s a close-up of the sideways illumination.

FreeNASv2_LightsSide

The many rays visible in the side illumination, as well as the lines making up the top illumination, indicate infinity mirror action going on inside that sheet. It wasn’t directly visible, and probably very difficult to photograph even if so. Without internal reflections, the blue light would have just gone straight up. But with the smooth surfaces and edges of the acrylic reflecting inside the sheet, the light of a single LED bounced around, found different angles, and was emitted in many more directions.

This LED illumination effect warrants further investigation. It is a happy accident that I fully intend to learn from, and put into future acrylic projects.

I want every acrylic project to look this awesome!

 

A Survey of Hosting Mechanisms in FreeNAS

After getting Plex plug-in up and running, I started researching the FreeNAS features for hosting other code. I plan to keep my FreeNAS box up and running at all times, as is typical NAS usage, to ensure files are available whenever I want them.  I wanted to know what else I can run on the box at the same time since it is going to be on and consuming electricity anyway.

From highest and most user-friendly level to the lowest, they are:

1) FreeNAS Plug-in: This is how I got started with Plex media server, as it is one of the few plug-ins on the default list. Some flaws with this system were visible immediately. The version of Plex on the default plug-in library is several versions out of date, and there is no user-friendly update mechanism. The user has to go into the FreeBSD jail and update manually. Similarly, in order to access the media files hosted on the same FreeNAS box, the user has to know about manually mapping storage into FreeBSD jails.

It feels like the FreeNAS plug-in ecosystem never matured as much as the creators had hoped. A sentiment confirmed by this page. It explained the reasoning behind the push in FreeNAS 10 (Corral) to move to a system based on Docker containers. Unfortunately, when FreeNAS 10 was abandoned, that push was also put on hold.

Summary: It looks like FreeNAS plug-ins are a dead-end for a deprecated architecture.

2) FreeBSD Jail: Since a FreeNAS plug-in user basically had to know about running a FreeBSD Jail anyway, they might as well learn to work at this more hands-on level rather than depending on the FreeNAS plug-in architecture to sugar-coat it. There are a lot more steps involved, but for popular things, somebody would have posted the list of steps. For example, here’s how to install Plex in a jail. (UPDATE: I’ve learned Plex media server is part of the standard package system and therefore even easier to install: Create a jail, open shell to the jail, type ‘pkg install plexmediaserver‘, done.)

Upside: FreeBSD jails’ isolation protects FreeNAS from some security exploits. The resources consumed by a jail is managed by the same system that manages the rest of FreeNAS and automatically gains all the benefits thereof. Storage in a jail can be mapped to a FreeNAS storage volume to allow (optionally read-only) access.

Downside: FreeBSD jails offers no protection against the nastier kernel-level security exploits.

Summary: FreeBSD Jail makes sense for running relatively trustworthy code that integrates with the volumes on FreeNAS. Plex media server is a good example.

3) Virtual Machine: New in FreeNAS 11 is a feature to create and run virtual machines alongside FreeNAS using the FreeBSD bhyve hypervisor. As of FreeNAS-11-0-U1, this new feature is quite immature. For example, trying to stop a VM in the FreeNAS UI seems to have no effect. I have to go into the administrative shell and use the “bhyvectl‘ command-line utility to stop the VM. As another example, the virtual UEFI boot sequence doesn’t act as some operating systems expect, which can result in the user getting dumped into the UEFI shell. (Something normal users should never see!)

UEFI Shell

Google pointed me to this page which will help with most Linux distributions that encounter this problem. Thanks to this tip, I got my Ubuntu test server up and running on a FreeNAS VM.

Upside: Full virtual machine isolation will protect against most security exploits.

Downside: Full virtual machine isolation consumes more system resources. Most significantly, the storage is not shared: Space dedicated to a VM is not available to the rest of FreeNAS. And there is no storage mapping so a VM could only access FreeNAS shares over the network interface as if it is physically a different machine.

Summary: Virtual machines make sense for things that do not interact with the rest of FreeNAS, and a good alternative to setting up another physical machine.

FreeNAS Plugin: Plex Media Server

plex-logo-e1446990678679Once I had a few simple network file shares set up in FreeNAS, it was enough to do most of what I want in a home network storage device. For a fraction of the cost of a commercial solution like Drobo. Now we can start looking at the less critical fun stuff.

Part of my home media collection stored on my NAS includes various video files that I’ve been carrying around. Most of them were standard-definition video files I recorded off of broadcast television programs. This was done at a time when most people would record to VHS tape. Only the super nerdy types record to computer video.

So I had the files, but I didn’t have a good way to play them straight off a file share. This is where something like Plex comes in. There’s a server-side component that runs on my FreeNAS box, talking to client-side components for various devices. The web client could cast to a Google Chromecast, and the Amazon Fire TV stick has a Plex client app.

For security isolation, FreeNAS runs plugins inside a “jail”. This is a FreeBSD feature that sounds a lot like a Docker container but isn’t a Docker container. This isolation is good default security, but it does mean the Plex Media Server plugin could not see the rest of the FreeNAS box until the user specifies a way for the code inside the jail to see specifically allowed files outside of a jail. I could even specify the storage visibility to be read-only so there would be no accidental manipulation of my video files.

Once I got past the FreeBSD jail mechanics, it was mostly smooth sailing. The only problem came from the large fraction of my files encoded in Windows Media Video format, an old video format that Plex does not support. If I end up deciding I like the Plex experience, I will have to look into doing a bulk re-encode of these old video files.

FreeNAS File Sharing: Trust the Wizard

FreeNAS LogoThe authors of FreeNAS tries to make things easy for the user by providing automation tools (“Wizards”) that take care of the fine administrative details without requiring the user to learn all the underlying nuts and bolts of FreeNAS, or FreeBSD, or Linux kernel, etc.

This is especially true for creating network file shares in FreeNAS. It supports many network file sharing protocols. Including the Apple-specific AFP (Apple File Protocol), the Microsoft Windows-based SMB (Server Message Block), the Unix-based NFS (Network File System), plus three others I don’t even understand.

Each of these have their own setup requirements that a casual user like myself is unlikely to get right on our own. So the manual encourages the use of Wizards. (Bold emphasis mine, but I think it should be in the manual!)

FreeNAS® provides a Wizard for creating shares. The Wizard automatically creates the correct type of dataset and permissions for the type of share, sets the default permissions for the share type, and starts the service needed by the share. It is recommended to use the Wizard to create shares.

Windows has a file sharing wizard as well: In Windows file explorer, I would create the folder I want to share, then right-click on that folder to select “Sharing…” This launches the wizard who will then take care of everything else.

Since I was used to the above workflow, I did the same thing in FreeNAS. Create a directory, then run the wizard to share that directory. Unfortunately this results in network shares that were not accessible. (“Access Denied”)

I eventually debugged the problem to my “create a directory” step. Since I had created as an administrator, the permissions on that directory were not set for use by other users. And the FreeNAS wizard did not (or could not) update the permissions properly.

What I needed to do was to launch the FreeNAS network sharing wizard, and tell it to create the directory as part of the network share creation process. This way the directory would be created by the wizard who will properly set the permissions for file sharing.

I did too much and that became unhelpful.

Trust the Wizard.

FreeNAS USB Flash Boot Drives: Recovering Boot Drives That Don’t Boot.

FreeNAS LogoWe’ve established that FreeNAS can mirror the USB flash drive boot device for redundancy. If one of them should fail, the system can be recovered with the other. I hadn’t set out to verify the recovery procedure, but I stumbled into a practice run anyway. In hindsight it’s good to get a feel of my recovery options now when I’m still playing with the system, rather than later when I’m in a panic to recover my data.

Over the past few days I’ve experimented with the boot volume, setting up the mirroring and using the built-in replacement mechanism to retire my USB sticks with checksum errors. After this was done, I unplugged the checksum-error drives (including the one I originally installed FreeNAS on) and rebooted the system.

It failed to boot and ended up at the GRUB recovery menu. Hmm, that’s not good.

I plugged all the old drives back in… and that didn’t improve the situation. Apparently, in the midst of all the mirroring and replacing, I managed to damage GRUB configuration so FreeNAS no longer boots.

Since I expected all the actual operating system files to be OK, I searched for a way to rebuild just the boot loader portion of the USB sticks. There are many ways to do this. The easiest – looking route I took is to perform an in-place upgrade.

I booted up the FreeNAS installation media, and selected the “Install/Upgrade” option. I pointed it to a USB drive that was free of checksum errors but would not boot. The installer detected an existing installation and offered to generate a new boot environment for the existing FreeNAS installation. Sounds perfect! I hit <OK>

Ten minutes later, the upgrade failed due to an error writing boot configuration files the installer wants to add. A quick Google search found a few suggestions on how to fix it using command-line tools I wasn’t familiar with. I decided to try easier things first.

I restarted the installation process and chose the other upgrade option: An upgrade with a disk reformat rather than just generating a new boot environment. The installer will preserve a copy of the FreeNAS configuration but wipe everything else from scratch.

This approached was more destructive and took more time but it worked. My FreeNAS box booted back up as if nothing happened. Success!

FreeNAS USB Flash Boot Drives: Wide Variations in Performance

Since I went into this FreeNAS project with the expectation to experiment and learn, I followed the recommendation to use commodity USB flash drives as the operating system boot drive despite my skepticism. The previous blog post discussed checksum errors found on some of the USB flash drives I had on hand, and how FreeNAS is able to mitigate the errors by mirroring the operating system across multiple USB sticks. This greatly increased my confidence entrusting the FreeNAS operating system to these USB thumb drives.

Usually these devices are used for ferrying files from one computer to another. They expect to see some files copied onto the drive, then copied off the drive in order. (sequential read/write operations.) Putting them in service as the operating system drive is an entirely different work pattern, with small pieces of data written at unpredictable places and other data retrieved from equally unpredictable places. (random read/write operations.)

I was aware of this difference and it was part of my skepticism using USB sticks as operating system drive. Now that I’m using it, I can see how it works in reality. Thanks to FreeNAS boot device mirroring, I have the confidence to go into this experiment without risking my data.

Outside of errors or outright failures, the other thing I had expected was degraded performance. If the flash memory controller chip is optimized for sequential operations, it might be bad at random operations. Unfortunately there was no way to tell up front. The software running on the flash drive controller isn’t something manufacturers put on the packaging. And every company has their own algorithm.

Since they are so cheap, the easiest thing to do is to just go and try it. The result is clear: some USB flash memory drive controllers are far far better at this workload than others.

Some of this difference is felt immediately, in the time taken for the mirroring duplication process. During this “resilvering” process roughly 2GB of data is copied to the new flash drive. Out of the two drives that had no checksum errors, one of them was able to complete the process in a little over two hours. The other took 26 hours, more than ten times longer!

Their difference is also visible in the FreeNAS system performance reporting page. Since FreeNAS keeps the two drives in sync, it’s easy to see how they respond to identical workloads. The flash drive identified as (da1) breezes through work, never more than 50% busy. Its mirrored sibling (da2) struggles to complete the same work, frequently spiking up to 100% busy.

DiskBusy

One of these is much less happy at their new job than the other.

Between the checksum errors and the disk busy graph, I am now much better enlightened on the varying quality of USB flash drives. I had thought of them as all basically equivalent, so I just bought whichever is the cheapest. My attitude has now changed. From here on out, whenever I need to buy USB flash drives, I’ll look for those made by SanDisk.

FreeNAS USB Flash Boot Drives: Mirroring For Fault Tolerance.

FreeNAS LogoFreeNAS encourages the use of USB flash drives as the operating system boot drive. This allows FreeNAS to dedicate all of the motherboard SATA connectors for data storage drives. I didn’t think commodity USB flash drives are trustworthy enough to hold the operating system, but I was willing to experiment and be proven wrong.

The very first night, I got worrying news from the nightly system check:

  pool: freenas-boot
 state: ONLINE
status: One or more devices has experienced an unrecoverable error.  An
        attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
        using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://illumos.org/msg/ZFS-8000-9P
  scan: scrub repaired 3K in 0h10m with 0 errors
config:

        NAME        STATE     READ WRITE CKSUM
        freenas-boot  ONLINE       0     0     0
          da0p2     ONLINE       0     0    11

errors: No known data errors

Looking on the bright side, “No known data errors” is comforting, as is the “repaired […] with 0 errors”. It’s nice FreeNAS was able to repair whatever was wrong with my USB stick. I suspect inexpensive commodity USB flash drives frequently encounter errors that are silently corrected by the operating system. Still, an error is an error and it’ll only be a matter of time before I run into a serious problem.

Fortunately, FreeNAS authors had the foresight to make sure a bad boot device does not become a single point of failure. A second one can be added to the system act as a mirror to the boot device. If either of them fails, the other can take over.

Much to my dismay, the second USB stick I tried also encountered a data checksum error. I didn’t have much luck figuring out how to interpret the checksum error code, but I did learn that it is supposed to be zero. The first stick returned 21, the second 26.

I tried a third USB stick and was relieved to finally see a zero checksum. The output below was generated when I ran ‘zpool status’ while the third stick is in the middle of replacing the second stick.

  pool: freenas-boot
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress
config:

        NAME             STATE     READ WRITE CKSUM
        freenas-boot     ONLINE       0     0     0
          mirror-0       ONLINE       0     0    21
            da0p2        ONLINE       0     0    21
            replacing-1  ONLINE       0     0     0
              da1p2      ONLINE       0     0    26
              da2p2      ONLINE       0     0     0  (resilvering)

errors: No known data errors

I also found a fourth USB stick that was checksum error-free, so I had it take the place of the first one.

  pool: freenas-boot
 state: ONLINE
  scan: scrub repaired 0 in 0h29m with 0 errors
config:

        NAME        STATE     READ WRITE CKSUM
        freenas-boot  ONLINE       0     0     0
          mirror-0  ONLINE       0     0    21
            da1p2   ONLINE       0     0     0
            da2p2   ONLINE       0     0     0

errors: No known data errors        

Now both boot drives in the mirror set have zero checksum error, but the mirror volume overall still has checksum error 21 from the first USB stick. I’m still learning if that means anything (bad) and what it would take to reset that to zero.

FreeNAS Box v2: Component Access

One aspect that was completely neglected in v1 was any kind of an access door. The panels were designed only enough for them to mesh, so the only way to hold things together is to glue everything shut. Completely impractical! The only way to perform any maintenance would be to shatter some acrylic to break the case open.

Now we have two access panels, one in the front and one on the bottom. I tried to see if I could somehow integrate things so there would only need to be one access panel, but never came up with a design that would work well while simultaneously satisfying all the other design goals I’m trying to accomplish.

Each access panel is held in by 4 x #6-32 screws, the standard desktop PC case screw. They fasten into threads I had tapped into the underlying layer of plastic. I should use heat-set inserts for better durability. Unfortunately I didn’t have #6-32 inserts on hand at the time and I thought I would probably build a V3 follow-up anyway.

FreeNAS v2 Front Panel Open

The front panel opens to allow access to the front chamber where the motherboard and CPU lives. If I wanted to upgrade the memory or switch out the SATA cables, I could do so through the front panel opening.

The bottom panel opens to allow access to the rear chamber. The two hard drives and the power supply are all installed through the bottom opening. The drives can be individually replaced without fighting through too many pieces of cable. The power supply can also be replaced through the opening exposed by the bottom panel.

FreeNASv2 Both Panel Open

FreeNAS Box v1 to v2 Size Comparison

Now that FreeNAS Box v2 is up and running, let’s do a size comparison to see how things have changed. The width dimension was a regression: v2 is wider by 3 centimeters. The real space requirement increased even more than that, because the v2 air intakes are on the sides.  So it needs additional room to the left and right of it in order to avoid blocking those intakes. In contrast, v1 with its bottom intake would be OK sitting flush against objects to its left and right.

Looking at the final results in reality, I think I can rearrange a few things to reduce the width by 1 cm. Something to consider for a potential FreeNAS Box v3.

FreeNAS v1v2 SideBySide

The greatest improvement is in the height which has been reduced by 7 cm thanks to the elimination of the lower air intake cavity. The advantage is somewhat reduced when in use, because the power cable now sticks straight up and adds a bit to the required height. If this becomes a serious problem, though, I could always switch to an power cable with a right-angle plug. This will allow the box to fit in a shelf only 28 cm high, leaving barely enough for proper heat exhaust. Looking over the results, I think I can safely reduce the bottom of the case by 1 cm and everything will still fit, another change for the potential v3.

FreeNAS v1v2 SideBySide

And finally, the depth is reduced by 3.5 cm. Real world improvement is even more, because now the back of the box can sit flush against the wall in a way that v1 could not.

The reduced height and depth has more than compensated for the increase in width, v2 is overall a more compact space-efficient package than the v1 design.

FreeNAS Box v2: Construction Complete

After spending an afternoon + evening at a Tux-Lab work session, I have my FreeNAS Box v2! It’s always fun to see my idea turned into reality.

FreeNASv2 Complete

The first thing I appreciated was the fact that the components are clearly visible through the acrylic panels. And even better, the messy tangle of wires are hidden behind them. This reversal from v1 is the best aesthetic change.

The other major design requirement – that both cooling fans be visibly spinning – is also present but it doesn’t have as much of an immediate aesthetic effect.

After I’ve kept it on and running overnight, I checked the temperature around the box the following morning. I think it would be neat to check thermal performance with a FLIR thermal imaging camera but lacking such toys I went with the low-tech way of putting my hands at various places around the box to feel the temperature.

The front chamber – where the CPU and motherboard reside – has a slight temperature gradient from top to bottom but overall it was relatively cool to the touch. This was expected as the CPU basically sat idle all night. It also means I won’t need to cut a hole in the front door for a direct air intake.

The rear chamber, with the power supply and both hard drives, is where most of the heat is generated. The two drives were warm to the touch signifying that they’ve been spinning all night and getting some amount of cooling to keep them from getting hot.

The power supply fan was running and the power supply case was cool to the touch. The power meter read 30W for the FreeNAS box in this steady-state idle state. This is a very light load for a 600W-rated power supply, reflected in its cool running temperature.

FreeNAS Box v2: Construction Fixture

One of the problems with FreeNAS Box v1 was that I designed it with tabs and slots to fit into each other. While it made the box easy to assemble, the slots severely weakened the structure of the box.

For FreeNAS Box v2 I avoid the tabs and slots. But I need something else in their absence to help me during construction. The answer is a fixture: Something I design along with the box that helps me build it, but not part of the end product.

Building the box will start with bonding all the major vertical pieces together. Once the cement has set hard enough for them to stand alone, the fixture pieces can be removed. The resulting assembly will then be self-supporting as the remaining pieces are attached.

The fixture pieces sit top and bottom. Pretty much where the largest horizontal pieces would eventually go, but are distinctly different from those pieces.

FreeNASv2 Fixtures.JPG
Initial assembly (gray) with assembly fixture (yellow)

The top fixture has two slots for holding two of the vertical sheets of acrylic. We’ve already established such slots are bad for the structural strength of the end product, but it’s perfectly OK (and quite useful) to have them in a fixture.

Both the top and bottom fixture have round cutouts in the corners and in the mid-span T-joint so that they stay clear of any extraneous acrylic cement that might leak out. This way we avoid accidentally cementing the fixture to the product.

Each of the fixture is made of two layers of acrylic, a main layer and a secondary layer whose shapes helps keep the box pieces in place. The small round circles visible in the picture is sized for M4 screws to fasten the fixture layers together. Using screws instead of acrylic cement allows us to later disassemble the fixture and recycle the pieces as scrap acrylic in future projects.

FreeNAS Box v2: Airflow Design

Designing the system airflow for thermal management is a huge consideration for the FreeNAS box design. The two fans in the system have been oriented for easy inspection first and then the airflow was designed second to work with natural convection flow. Lacking skills to use sophisticated thermal modeling and analysis tools, this design is mostly based on intuition.

Working as a network attached storage device is not a very computationally intensive task. Plus the CPU has its own fan, so thermal control of the processor is not a primary concern. The power supply also has its own fan, which I assume can take care of itself.

That leaves the hard drives as the primary thermal concern. Lacking their own cooling fans, the airflow design of the case will put them first in line to receive the coolest air. This meant placing them right at the intake. The v1 intake was on the bottom, so that’s where the drives were. The v2 intake air from the side, and again that’s where the drives were placed.

After the intake air has met the hard drive, the warmer bits should flow up and over the top of the hard drive, carried by convection towards exhaust. The cooler bits should head towards the rest of the case, helping to cool the motherboard and the CPU.

The motherboard and the CPU is in its own chamber. Cold air comes in the bottom and sides of this chamber and the top of this chamber has holes to send its warmest air into the power supply fan for exhaust.

If this proves to be inadequate cooling for the motherboard, we have the option of cutting an air intake hole directly in the front door panel of the case.  The CPU fan can then pull in cool air from the outside. This will reduce the amount of air drawn in past the hard drives, though, so I wanted to see how well it works before I start cutting holes.

 

FreeNASv2 Thermal Flow 2

FreeNAS Box v2: Additional Goals

We’ve just established all the problems exposed by the v1 prototype that we want to address for v2. In addition to those issues, we also want v2 to cover a few things that are no fault of the v1 prototype.

First one is relatively obvious: actually build a complete and usable case. I knew I was trying new ideas in v1 and that something will go wrong, so it wasn’t really complete. Even if everything went right (I knew it wouldn’t) I would have had to build a v2. For one example, I didn’t bother to design an access door.

We then have a few separate items that relate to improving space efficiency.

When I placed v1 on the shelf where I expected to keep my FreeNAS box, it wasted a few inches between the back and the wall due to the angle of the power cable. I want to rearrange things so that the back of the box can sit flat against the wall.

Cooling path in v1 started with air intakes on the bottom of the case. This was part of the tribute to the Apple PowerMac G4 cube, but functionally unnecessary while consuming vertical space.

Also contributing to the vertical space consumption was pointing all the ports downwards, like the PowerMac G4 cube. This made the ports difficult to access. It would be good to align the direction of all the plugs, so power and network cables can be in parallel.

Out of all the requirements listed here and in the previous post, the greatest impact was the “make sure all fans are visible for easy verification they are spinning” goal. It meant rearranging the components so both fans face forward. This made for an interesting design challenge as it is against common convention of computer case design. Once I got that set up, the configuration was then further refined in Fusion 360 to satisfy all the remaining requirements until we have this: my FreeNAS Box v2.

FreeNASv2

FreeNAS Box v1 Problems

FreeNAS Box v1 was a good learning project for acrylic construction. Here are the issues with v1 I want to address for the next version.

  1. Non-orthogonal joints: The laser cutter only cuts right angle edges. v1 had a few joints that were impossible to cement because the edges didn’t align at right angles.
  2. Tab and slot construction: To help align joints, I designed v1 with tabs to fit into slots I had also cut into their mating surfaces. While this made the box easy to build, it destroyed durability of the end product. The sharp corners of the slots are where acrylic starts cracking under stress. I had known about the dangers of sharp internal corners, but I thought acrylic cement would bond everything together eliminating the weak point. This idea has now been proven false.

    FreeNAS1_Cracks
    Stress cracks that started at corners of slots.
  3. Unappealing tangle of wires: The v1 box design placed all of the wires up front, which turned out to look pretty ugly, and all the components (hard drives and the motherboard) were hidden under the mess.

    FreeNASv1
    Yes, there’s a computer under the tangle of wires.
  4. Difficult access to components: Besides looking bad, the mess of wires up front also blocks access to everything else. It would be difficult to perform maintenance such as replacing drives if they fail.
  5. Cooling fans vulnerable to jamming: The wiring paths were such that, if some wires should misbehave and bend slightly out of position, they would impinge upon the blades of cooling fans stopping them from turning.

    FreeNASv1_Flaw
    Several wires in this bundle poked into the fan grill where it does not belong.
  6. Cooling fans are out of sight: Compounding the problem of blocked fans is the fact that despite the clear acrylic exterior, it was not easy to notice the fans were blocked.

I had to physically build FreeNAS Box v1 before I knew known any of the above are problems. Some I had thought about and didn’t think would be a problem, the others I just hadn’t thought about at all.

Acrylic Joint Evaluation

Acrylic JointBefore diving into building FreeNAS box #2, I thought I’d take a pause and take a closer look at the acrylic construction results of experiment #1. This is purely about learning to build structures from acrylic – independent from the positive or negative aspects of the project as a computer enclosure.

Since laser cutting acrylic is a fairly popular construction technique, there is a wealth of information on the internet. (To be taken with the usual grain of salt.) After getting some first-hand experience I now have context to better understand the information people have shared online. My favorite single page so far is on Makezine. After reading some of these again (with better understanding due to the new experience) I re-evaluated my design and decided my corners are bad.

For the corners of the enclosure, I had designed tongues for one panel to fit into another. On the upside, this helped with aligning pieces for assembly. On the downside, it made the design more complex to draw up and arrange. And even when well joined with acrylic cement, it is an visually unsightly interruption in the clean clear joint.

Even worse, this has introduced stress points that would otherwise not been there. As I recently learned building the Luggable Frame #1, a sharp internal corner laser cut into acrylic concentrates stress from surrounding components and is liable to start cracking from the point of the corner. Each of these tongues introduced two new stress points in each of the two sheets.

Since the only real upside here is making construction easier, I’ve decided this is not the way to build with acrylic. I should keep the edges for corners joints smooth and clear, free of these tongues, and figure out other ways to keep the pieces aligned during construction.

I’ll spend some time and effort to improve my acrylic joints before proceeding to build FreeNAS box prototype #2.

 

FreeNAS Box V1 Prototype

FreeNASv1With the concept designed, it’s time to head over to Tux-Lab to build it!

To be honest, it was not fully designed for use as a computer case. Since this was my first effort designing for acrylic construction I expected to run into some amateur mistakes very quickly. As a result I had left some known design issues open to be resolved in future prototypes. One example: I had not designed any kind of door or hinge. The prototype panels are mostly glued together, except for the front panel which is held in place by tape.

Aesthetically, I am pleased with how the clear acrylic looked though I am not pleased at how much of a rat’s nest the power supply cables became. Taming wires is a perpetual challenge. I now understand why Apple enclosed all the ugly guts of the G4 cube in shiny aluminum shell inside the clear acrylic shell.

Other than the messy computer wires, the clear acrylic does hint at the illusion of a computer floating in mid air. I’m pretty happy with that, but it’s not enough to offset the tangle of wires. Next prototype will either have good cable management (takes effort) or have some dark colored acrylic to hide the interior (much easier.)

The cooling functionality worked as designed: the intake air is drawn from the bottom, past the two hard drives keeping them cool, and out the top.

Similarly, the designed goals of tilted-PSU (power supply unit) space optimization was successful, as did the gentler turn demanded of the wires. However, there was an unforeseen deal-breaker of an issue.

Uh-oh!

FreeNASv1_FlawOn the back side of the tilted-PSU, we see that the tilt has pressed the bottom of the PSU up against the wire bundle at the top of the motherboard. The tight quarters mean individual wires of the bundle tried to relieve the crowding by moving into the space for the PSU fan preventing it from turning. Since the PSU fan is the primary air-mover for this enclosure, a stopped fan is obviously not acceptable.

Other notes

Space utilization efficiency has room for improvement. Some of this was caused by the desire to emulate the Apple G4 cube and have a square footprint. (20 cm squared!) The squareness was completely unnecessary and future iteration will likely have a rectangular footprint for space efficiency.

There was uncertainty about how well 3mm acrylic can hold the weight of the power supply unit. It proved to be surprisingly capable once the two top sheets reinforced each other at right angle.

Amateur Hour: A laser cutter only cuts vertically. There was no way to cut a 30 or 60 degree edge for the tilted PSU section! For this learning exercise, the cornered edges are simply left open and unattached.

The angled PSU was a novel idea to solve specific problems, but it caused new ones and also unsuitable for laser cut acrylic construction. That was a fun experiment, but we’ll have to leave the angled PSU concept behind for the next prototype.

FreeNAS Box V1 Design

FreeNASv1_CADOnce the components are gathered, we start thinking about designing an enclosure for them. The tool of choice is the Tux-Lab laser cutter. The material of choice is acrylic sheet. The objective of the exercise is to learn how to build with acrylic and ideally create something novel and unique.

Since my mind is already on acrylic, it was a short jump to think about the Apple Power Mac G4 Cube. A landmark of industrial design. Obviously what I make won’t be as pretty, but it’ll be my homage to the cube. Here are the two main design considerations in my FreeNAS experiment #1.

Hard Drive Cooling

Heightwise
Airflow along the sides has small surface area.
Lengthwise
Airflow lengthwise has large surface area, but will be obstructed by data and power cables.

 

Crosswise
Airflow crosswise has large surface area and will not be obstructed by data and power cables.

Since the goal is for low power, low noise, and small size, I didn’t want to add any fans. The small fan on the processor and the large fan in the power supply will take care of their respective components. That leaves the two hard drives without their own cooling, so the enclosure will have to utilize airflow created by the power supply fan.

We desire the maximum cooling surface area that presents the fewest obstructions to the air stream. And we want to work with (instead of against) natural convection forces. Evaluating the possibilities, the best choice is to align cross-wise airflow to be vertical by sitting the hard drives on their long sides.

Power Supply Spacing

PSU UprightFollowing the lead of the G4 Cube, air intake will be on the bottom and the power supply (with its fan) will sit at the top to work alongside natural convection and exhaust hot air.PSU Tilted

With the power supply sitting at the top, and the hard drives sitting on their sides against the bottom, that leaves a fairly large piece of unused space. The wires protruding from the power supply is also a concern. We either have to force those wires to make sharp downward turns to reach the system components, or we have to increase the depth of the enclosure to give the wires room.

Our experiment #1 tilts the power supply downward 30 degrees to utilize the available space to relieve the wire spacing issue.

Will these ideas work? Let’s build it and find out…

 

Components for FreeNAS Project

I wanted to play with FreeNAS without spending a lot of money to build the computer to run it. In fact, I would prefer not spending any money at all. This is a lot like how the Luggable PC project started: figuring out the most interesting thing I can do with computer parts I already had on hand.

AM1IThe brains of the system will be a Mini-ITX board, the MSI AM1I. I got this board a few years ago, along with its AMD Athlon 5350 processor while they were on sale at Fry’s Electronics together as a bundle. This pair has participated in many experiments and projects since. It was visible in some early Luggable PC project pictures, mostly of the January 2016 “Easel Frame” phase. And now, it will play host to the FreeNAS project.

The storage will be provided by two Seagate 2TB hard drives. These drives were part of my Windows Home Server and had been gathering dust ever since the server was decommissioned. They will now re-enlist to serve as storage for the home network.

The power will be provided by an ATX power supply that I’ve relegated to standby/ backup status. In its old age it has started to develop some coil whine. While it has not yet become a functional issue, the noise is unpleasant coming from a computer on my desk. Which makes it the ideal candidate for powering a NAS box stored someplace out of the way, probably out of sight, and best of all, out of hearing range.

I could throw all these pieces into a commercially available case, and call the physical setup done and turning this FreeNAS project into a strictly software learning exercise. But where’s the fun in that?

When I said I wanted to build a FreeNAS box I meant that literally: I want to build the physical box to enclose the above components.