Build My own NAS

The time has finally come to build my own NAS as my old synology DS713 is too old to handle my storage need. It is a 2-bay unit with a Intel Atom CPU. Since I’m considering starting using plex transcoding. That Atom chip ub Synology is not able to handle any 1080p transcode. Also my archive of BDRip and Photos keeps increasing. The 10 TB RAID1 setup is currently 60% used. Although I can somehow delete some unused file to free up some space. I deciede it is finally time to build a DIY NAS to support muiltple spinning disks.

This article is simply a build log that records the moments from purchasing stuff to building the machine.

Choosing proper OS

Other than Synology DSM there are many perferred OS for a NAS:

  • OpenMediaVault (Debian-based)
  • Windows Server (Name explains it)
  • XPEnology (Basically Synology DSM on non synology hardware)
  • OpenSUSE (Support for BTRFS + hardware RAID)
  • freeNAS

Vanilla OpenSUE and freeNAS might be the hardest to set up. For pure personal use I’dont think it is necessary to go for FreeNAS as there are many simple and straight forward options other than using a FreeNAS. I probablly don’t need ZFS, probablly don’t need iSCSI, probablly don’t need BSD jails, probabbly don’t need raidz. However I decide to go for FreeNAS as it is always fun to try something new. FreeNAS community is faily active and helpful. You can learn lots of interesting stuff from their forum.

Later after I setup the machine I might want to try virtualize FreeNAS on ESXi since I intend to build a beefy server and use ESXi allows me to put some of my other workload onto this machine. However I’ll need to do some benchmark to see if virtualization has a huge performance penalty on FreeNAS.

Choosing Hardware

CPU

According to plex support, I need a CPU with higher than 12000 PassMark to handle 4K SDR (40Mbps, 8-bit HEVC) transcoding. If I want to go a step up, a 4K HDR (50Mbps, 10-bit HEVC) file need 17000 PassMark score. I don’t think I’ll go that far as I just don’t have any 4K HDR content archived. The only 4K UHD HDR BlueRay I have is the Kimi No Na wa Collector’s edition. However even for this one I would not be able to transcode it as 4K BlueRay’s DRM hasn’t been cracked and I have no way to Rip it to my disk :(

Except VC-1 transcoding, plex is able to use all available cores when transcoding the video. Thus Plex will benefit from a multicore CPU. Referring from PassMark for a PassMark score of 17000 I need a CPU like Intel Xeon E5-1680 v4 @ 3.40GHz OR Intel Xeon E5-2697 v2 @ 2.70GHz OR AMD Ryzen Threadripper 2970WX. Ok, in no way I’m gonna to put such a beefy CPU in my NAS server as 1. Thoses chip always need a proper cooling solution and beefy PSU. 2. They are just so expensive(a E5-1680 V4 cost 2000 CAD on ebay).

So overall a need a decent chip with 12000 PassMark score and 2000 single-thread PassmMark score. There are some decent options for my requirement.

Supermicro FAN control

  1. Fan threshold control
  2. PWM curve control
ipmitool -I lan -U USERNAME -P PASSWORD -H HOSTIP sensor thresh 'FAN 1' lower 0 0 75

Autostart VM

PCI passthrough to freenas

Setting a host only network for esxcli access

This is beacuse my router is not attached to the UPS. So upon power loss, the machine may suddenly lost IP address. I need to create a seperate switch for UPS VM to connect properly to esxi host.

Setting a host only network between photon os and freenas

This is an ugly implentation. I should really look into VLAN.

Setting UPS for auto shutdown

Use mailgun.org to send out smtp mails

Install VCLI on a minimal Ubuntu installation

Follow this guide: https://vdc-download.vmware.com/vmwb-repository/dcr-public/4fcf776d-9ec6-448d-83de-bc730ef047ea/e6a46e41-5c99-4a7d-beed-790cf7e146cd/vsphere-esxi-vcenter-server-65-command-line-interface-getting-started-guide.pdf

Set Public-private key verification on ESXi host

https://ogris.de/sshesxi/

#!/bin/sh
ssh -i /root/esxi root@10.0.0.1 poweroff

Freenas, ESXi and iocage Jails

In ESXi’s vSwitch, you need to enable ‘Promiscuous mode’ and ‘MAC address changes’ to get Jail’s networking working.