Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Alternative Operating Systems > Building a ZFS based NAS

Building a ZFS based NAS
Thread Tools
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Dec 8, 2009, 06:34 PM
 
Hello,

Is there any interest in a tutorial and/or discussion on building a homemade ZFS based storage appliance?

I've been learning a whole lot about not only building such a system (which is actually very easy), but also in ways to tweak additional performance and storage capacity out of it (e.g. putting the ZIL/slog/L2ARC on a faster device such as a solid state drive, compression, deduplication, etc.) I've also learned a whole lot about the various hardware options out there, and what sort of resources ZFS will consume.

There is a whole multipage thread on building a homemade ZFS appliance for personal use at ArsTechnica, I thought I would see if there is any interest in this here? Because ZFS is such a turnkey sort of product for a basic setup it is actually a fantastic solution for homemade storage solutions.
     
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
Dec 8, 2009, 06:39 PM
 
I think there might be more interest if you sketched out the basics, such as necessary hardware, OS for the box, software for the box, any tweaks needed for client machines, etc.

It sounds quite interesting, but I'd need to know more about it before I spent much time on it.
Glenn -----
OTR/L, MOT, Tx
     
Moderator
Join Date: Dec 2000
Location: Polwaristan
Status: Offline
Reply With Quote
Dec 8, 2009, 06:50 PM
 
I would be interested in your tutorial, besson.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Dec 8, 2009, 07:55 PM
 
Okay...

The basics:

Why ZFS over a Drobo or some other consumer storage appliance? Well, you can grow it as needed, easily create and destroy partitions without having to reformat, easily share these partitions to various computers in your house via NFS, iSCSI, or SMB (AFP with a little additional work), and data integrity under Solaris/ZFS is superb. In the event of a disk failure ZFS will failover to your mirror gracefully, and you can tweak several settings depending on what is important to you.

On the hardware side you just need some sort of device to host a bunch of disks. This can be an external hard drive enclosure (e.g. Newegg.com - AMS DS-3141SSBK Steel / Aluminum 3.5" SATA 4-IN-3 SATA Module - External Enclosures), internal drive bays, USB flash storage, or even little solid state drive modules that connect directly to your SATA controller (e.g. Logic Supply - Leaders in Mini-ITX & Small Form Factor Solutions). The drives can be your traditional SATA, SAS, flash, SSD, whatever, ZFS doesn't care.

For interfacing with your ZFS partitions, as mentioned above you can use NFS, iSCSI, and SMB natively. Really, any way you can connect to this device and mount these shares is fair game though, including Netatalk for AFP services. You would connect to this device via Ethernet. A fast consumer SATA disk will run at 7200 RPM, while a fast SAS disk will run at 15000 RPM. SATA disks are designed to provide a lot of storage for cheap at the expense of performance, while SAS will provide a lesser amount of storage while focusing on performance. Solid state drives (SSD) are also an option. With no drive head I believe the performance of these drives vary, but in general they outperform regular SATA disks by quite vast margins, although I don't know how they fare against SAS drives. If you are interested in using SAS drives you will need a SAS controller which you can get as a PCI Express card for around $100-200. ZFS doesn't require the drives to be of the same capacity, but you'll be limited by the capacity (and speed) of the smallest/slowest drive.

A 15000 RPM drive can apparently saturate a gigabit Ethernet line, so if you *really* want to hit this hard and think you might be limited by network bandwidth, "multi-pathing" or combining multiple ethernet adapters/NICs together is also an option.

For running ZFS itself you'll need either FreeBSD 8 which was just released and ZFS is now listed as stable, or OpenSolaris where ZFS has been stable for a while. If you have never used FreeBSD or Solaris before, not a big deal, as long as you can install the OS and it sees your drives and any other hardware you have attached to it, you're set. They both should have no problems with your drives, but if you decide to install any PCI cards such as a SATA/SAS controller or additional NIC or something, you might want to check to make sure these are supported. OpenSolaris has a hardware compatibility list (HCL) on their site.

The only other often mentioned hardware recommendation is RAM with ECC (error correction). Both your motherboard and the memory modules need to support this feature.

Once the OS has been installed, you interact with ZFS the same way on both OSes. You can literally have your appliance up and running with a few Unix commands...

You'll want to decide on what sort of drive configuration you want to run with ahead of time. ZFS can mirror and stripe drives, and supports the ZFS equivalent of RAID-5 and RAID-6. A "stripe" is pairing together multiple disks so that it is seen as one giant disk, and a mirror is a clone of your main drive so when one of the drives fails you do not lose any data. One popular drive configuration is doing both mirroring and striping (RAID 10), the other is RAID-Z (RAID 5) or RAID-Z2 (RAID 6). Each of these categories have their pros and cons...

With mirroring and striping, you can keep on adding drives in pairs and build the size of your overall storage without having to reformat or do anymore than simply enter a command to add these two drives to the pool. RAID-Z is a way to maximize the amount of disk space you have available, since the total disk space will be the number of drives you have minus 1 multiplied by the capacity of the smallest drive. So, for example, 4 1 TB drives will give you 3 TB of space in total. You need at least 3 drives to do RAID-Z/RAID-5. Therefore, you'll want to use at least 4 drives so that you can have one fail without losing any data. A RAID-Z2 setup (RAID 6) allows you to have two drives fail simultaneously without losing any data. It requires a minimum of 4 drives.

One important caveat with RAID-Z: you cannot add disks to an existing RAID-Z pool. You can *replace* disks with larger ones, but you can't just grow your storage the way you can with a mirror/stripe setup. Therefore, a RAID-Z setup might be a better option if you plan to put a drive in each drive bay. However, if you have 10 drive bays, for example, you could build a RAID-Z configuration with 5 drives, and in the future add some new drives, copy over the data to them, and then build a new RAID-Z pool using the entire set of 10 disks, so there are ways around this limitation.

The other caveat with RAID-Z is that your boot drive(s) cannot be in a RAID-Z pool. If you don't want to salvage the drive bays just for booting though, you could just boot off two flash drives that are mirrored. Solaris needs 2 gig of space for a minimal install.

One benefit of RAID-Z in addition to making more space available is its self-healing and the fact that this form of RAID-5 (unlike other software RAID-5 implementations) is safe and does not potentially jeopardize your data in the event of a power loss.

For testing all of this you can easily setup a virtual machine using VMware/Virtualbox/Parallels and present as many disks as you want to your Solaris/FreeBSD virtual machine so that you can get the knack of all of this. If you use dynamically expanding disk images you can make these drives as large as you want.

ZFS supports many configuration options which are very easy to set without having to reboot or do anything other than issue a single command. One configuration option is file compression. You can choose what compression algorithm you want to use, the aggressiveness of the compression (where more aggressive compression = more CPU resources), and you can choose to have individual partitions compressed while others remain uncompressed. So, for instance, you could create yourself a partition for large video files that you leave uncompressed, and other for documents that can be compressed without taxing your CPU. The compression is block level, meaning it occurs at a very low level, and can be enabled and disabled at your leisure. ZFS is built so that compression will make use of multiple CPU cores, so if you want to be super aggressive with this it might not be a bad idea to buy a quad core CPU for your appliance.

Moving into more advanced areas, ZFS includes an intent log (ZIL or slog) for writing data and an "L2ARC" cache for reading data. ZFS supports putting both of these caches on faster devices, such as SSDs or SAS drives, if you want faster reads and writes. I believe the recommendation for the ZIL is half of your physical memory.

I believe that ZFS itself will use half of your physical memory for caching and improving performance. Therefore, while I believe the minimum recommendation is 500 MB, the most common recommendations seem to be 2+ gig, but ZFS will use more if you make this available.

Another recently added ZFS feature is deduplication. This feature is off by default, but when it is on it compares checksums of your data and prevents storing duplicates. You will apparently need some more CPU power for this without jeopardizing performance.

It can take a while to tweak ZFS's settings to best match the speed of your computer and the resources you have available, but this can be done as simply as switching preferences on and off in an OS X app, the interface is clear and easy to follow. Even with your basic vanilla ZFS setup without compression enabled, no separate ZIL/L2ARC, deduplication or any of that, providing your network is up the task you should notice faster disk performance overall. Because the load you will put on your disks will be spread out across multiple disks, you'll get more operations per second.
     
Moderator
Join Date: Dec 2000
Location: Polwaristan
Status: Offline
Reply With Quote
Nov 21, 2010, 12:52 PM
 
besson,
What do you think about an SSD PCIe ZFS NAS? I'm thinking of a project where I don't want RAID, but just an ultra-fast file/data server. I know this would saturate gigE, but shouldn't I/O capability provide some great performance?

Do you know where I can find the smb installer for opensolaris? It wants me to be connected to the internet to grab it, and while that is nice, I'm looking to build it all on a closed LAN and keep the necessary updaters and binaries local for faster testing, etc.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 21, 2010, 03:14 PM
 
If you are concerned with it saturating GigE you can do ethernet bonding if you have an additional NIC/PCI slot to combine the bandwidth of multiple nics.

I don't know where the installer is for OpenSolaris because I went with Solaris 10 at the time which was recommended as being more stable and production-worthy. OpenSolaris is sort of like what Fedora is to Red Hat Enterprise Linux. However, Oracle just released Solaris 11 Express just days ago which is sort of a preview version of Solaris 11, although it will be fully supported by Oracle. It's also unstable, but if you are in no hurry maybe it would make sense to play around with it and use Solaris 11 when you are ready to put this thing into production. If this is not going to be used in an environment where you need maximum uptime this is probably all moot anyway. If all you want is a file server you could probably use any version of Solaris, ZFS is stable and production-worthy on all currently supported versions.

As far as an SSD based ZFS NAS, I would strongly recommend thinking about using SSDs for your buffers (ZIL or L2ARC depending whether you anticipate doing more reads or writes). Take a look at the little charts at the top of this page:

ZFS L2ARC : Brendan Gregg

Basically, the more RAM and buffer you have buffering the disks, the faster the performance up to the point where that buffer becomes an overkill. However, there is no limit as to how large those buffers can be. So, I would probably save money by building my pools with a big ass buffer and cheap SATA disks.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 21, 2010, 03:19 PM
 
Also, when planning this you should consider that the "root pool", i.e. boot drive(s), need to be separate from your data pool unless you want to get into partitioning which from what I can gather is generally not recommended. Most people suggest mirroring the boot drive with ZFS, so if you want to abide by these recommendations you'll need to reserve 2 drive bays for your OS disks.

I don't know how many drive bays you have to play with, but let me know, cause there is also a few things to consider when deciding how to use your drive bays in terms of maximizing performance.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:49 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2