Thursday, December 17, 2015

Low budget fanless ZFS NAS

Dunno how this will end up as I did again mistake of digging up one of those Wyse Z90D7 terminals from junk pile. This time my idea is to use it for NAS after upgrading RAM from 2GB to 6GB and adding two 1TB 2.5" USB3 disks. Wyse being fanless and with host powered disks this should be decent combo.

Then add FreeNAS 9.2 and ZFS with snapshots. Snapshots are mandatory feature as I'm sending this to friend of mine for christmas present. He's one of those who insist on installing every virus and cryptolocker he can find. With data backed up to NAS and protected by daily snapshots recovery is much easier than ever before. With assumption that he'll save important data to network drive which will then probably corrupt it all due me using inappropriate hardware...

Design "parameters"
 - RAID-Z1 mirror of two USB3 disks.
 - Three datasets: datat, scratch and spycam.
 - Snapshots once per day for datat and scratch.
 - Keep snapshots shorter time for scratch dataset.
 - No performance needs since clients connect over 54Mbit/s multihop WLAN mesh.
 - All users granted global read/write to all data.
 - No need to access from Internet.
 - No plugins or jail services on FreeNAS.
 - Ability to upload images using FTP (from WIFI IP cameras).
 - No maintenance. Set it and forget it - at least until both disks fail.

Let's start by adding some RAM to Wyse. First I took 2GB module from another identical Wyse so no compatibility issues but 4GB is bit too much lower than FreeNAS 8GB requirement so I kept one of Wyse DIMMs and added one Kingston "KTD-XPS730B/4G 1.5V" for total of 6GB. I'm using PC3-10600U RAM and BIOS shows 1333MHz bus speed.

With 6GB RAM and 4GB internal SSD we're still way below FreeNAS minimum hardware requirements which as 8GB RAM and 8GB storage. I think with just two 1TB disks and having only Samba and FTP services running 6GB will be more than enough.

Download latest FreeNAS 9.2 build, I used FreeNAS-9.2.1.9-RELEASE-x64.usb myself. Really shame we're stuck with 9.2 instead of latest 9.3. That's due 9.2 being last version that can boot on any standard PC. Starting with 9.3 developers decided to switch to GPT (to be able to boot from ZFS) causing many PCs no longer being able to run FreeNAS. Unsurprisingly Z90D7 is among those no longer compatible which combined with fact that 9.2 has less than perfect USB3 support is bit worrying. If you're using Windows use Rufus to create bootable USB install media.

If you haven't done so already upgrade to recent BIOS following my earlier instructions. Connect FreeNAS install USB stick to Wyse but DO NOT connect USB3 disks yet. Go tio BIOS setup and enable USB boot so we can boot from FreeNAS install media. Set boot order so everything is disabled (press "!") except SATA0 and FreeNAS install media. SATA0 should be first on boot order list. Save changes and hit "P" on startup to access boot menu and boot from USB.

On FreeNAS menu select shell and wipe your internal SSD to avoid "error 19" issues due left over junk. Check device name for SSD using "camcontrol devlist", in my case it was "ada0". Then overwrite it using "dd if=/dev/zero of=/dev/ada0 bs=4096". This will take around 15 minutes at 4MB/s rate that internal SSD is capable. After dd completes type "reboot" and boot PC again from FreeNAS USB install stick.

Follow install instructions, there's actually only one prompt - where to install which is obviously our internal SSD. After install go to BIOS settings and disable USB boot so only thing PC can boot from is our internal SSD.

On first boot after install FreeNAS will fetch IP from DHCP which is shown on console after bootup is complete. You can also set fixed IP now if you don't have or don't like DHCP.

Next open web browser and connect to IP of FreeNAS.
- Set admin password when prompted
- Login will be "root"

- System > System Information > Edit hostname
-- Enter name and domain for device

- System > Settings > General
-- Set keymap and timezone

- System > Settings > Advanced
-- Check "Enable powerd"
-- Set "Swap size on each drive" to 4
-- Check "Show console messages"
-- Check "Show advanced fields"
-- Check "Enable autotune"
-- Uncheck "Enable automatic upload of crash dumps"

- System > Tunables > Add Tunable
-- Variable: xhci_load
-- Value: YES
-- Comment: Enable USB3 support

- System > Tunables > Add Tunable
-- Variable: vfs.zfs.prefetch_disable
-- Value: 0
-- Comment: Enable ZFS prefetch with <4GB RAM

Click Shutdown from bottom left, connect USB3 disks and restart PC. Then login again to web interface.

- System > SMART Tests > Add SMART Test
-- Disks: da0 and da1
-- Type: Long Self-Test
-- Description: Do long self-test every month
-- Hour > Each selected hour: 03
-- Day > Each selected day: 15

- Storage > Volumes > View Disks
-- Select both disks and click Edit in Bulk
-- HDD Standby: 10
-- Power Management: Level 64
-- Acoustic Level: Maximum

- Storage > Volumes > ZFS Volume Manager
-- Volume Name: pool
-- add both disks
-- Layout: Mirror

- Storage > Volumes > /mnt/pool > Create ZFS Dataset
-- Dataset Name: datat
-- Enable atime: Off

- Storage > Volumes > /mnt/pool > Create ZFS Dataset
-- Dataset Name: scratch
-- Enable atime: Off

- Storage > Volumes > /mnt/pool > Create ZFS Dataset
-- Dataset Name: spycam
-- Compression level: Off
-- Enable atime: Off
-- Quota for dataset: 200G

- Storage > Volumes > /mnt/pool/datat > Change Permissions
-- Mode: Owner, Group and Other R/W/X

- Storage > Volumes > /mnt/pool/scratch > Change Permissions
-- Mode: Owner, Group and Other R/W/X

- Storage > Volumes > /mnt/pool/spycam > Change Permissions
-- Mode: Owner, Group and Other R/W/X

- Storage > Periodic Snapshot Tasks > Add Periodic Snapshot
-- Volume/Dataset: pool/datat
-- Lifetime: 52 Weeks
-- Begin: 01:00:00
-- End: 05:00:00
-- Interval: 1 day
-- Weekday: Select all days

- Storage > Periodic Snapshot Tasks > Add Periodic Snapshot
-- Volume/Dataset: pool/scratch
-- Lifetime: 1 Week
-- Begin: 01:00:00
-- End: 05:00:00
-- Interval: 1 day
-- Weekday: Select all days

- Services > SMART
-- Power mode: "Standby"

- Services > FTP
-- Clients: 10
-- Connections: 10
-- Login attempts: 10
-- Check "Allow anonymous"
-- Path: /mnt/pool/spycam
-- File permissions: Owner, Group and Other R/W
-- Directory permissions: Owner, Group and Other R/W/X
- Services > Control Services
-- Toggle CIFS to ON
-- Toggle FTP to ON

- Sharing > Windows CIFS > Add share
-- Name: DATAT
-- Path: /mnt/pool/datat
-- Check "Allow Guest"
-- Check "Only Allow Guest"

- Sharing > Windows CIFS > Add share
-- Name: SCRATCH
-- Path: /mnt/pool/scratch
-- Check "Allow Guest"
-- Check "Only Allow Guest"

- Sharing > Windows CIFS > Add share
-- Name: SPYCAM
-- Path: /mnt/pool/spycam
-- Check "Allow Guest"
-- Check "Only Allow Guest"

- System > Settings
-- Save Config and place backup in safe place

Performance? Enough to fill 100Mbit/s uplink to Aruba A200 WLAN controller. Which is far more than two-to-four hop long 802.11g 54Mbit/s WLAN mesh clients are connected to can handle. Performance does plummet hard with multiple clients and random I/O but that doesn't matter much in this case.

Reliability? Dunno. Pulling USB cable while there's I/O didn't hurt and disk is promptly dropped from ZFS. Plugging cable back won't bring it back so reboot is required. Resilver speed was around 22MB/s and scrubbing ok disks runs at ~45MB/s. Had to trigger that manually after reboot. I also tried pulling power cable and FreeNAS recovered ok from it.

Done? Close enough. Should setup SMTP alerts to catch failing disks tho.

No comments:

Post a Comment

Got something to say?!