Saturday Dec 13, 2008

OpenSolaris and ZFS make it possible to build a NAS box with general PC hardware and free open source software, which is different from other NAS boxes in a way that data redundancy is achieved without RAID hardware, and at a very acceptable cost. As a super DIY fan, I'm not going to miss this chance to DIY an OpenSolaris and ZFS based NAS box, not only for fun but also for serious use.

Some principles were established first:

  • Use low-power 64-bit microprocessor to run Solaris and ZFS smooth and fast;
  • Use four hot-swappable 3.5" SATA HDD to build a RAIDZ1 pool with over 2TB capacity;
  • Use Gigabit Ethernet interface to take advantage of the network bandwidth.

Other factors needs to be considered include total cost, total power consumption and noise level. After all, this is for personal and home use.

Many x86 microprocessors in the market are 64-bit capable, unfortunately most of them are not designed for low power application, hence their TDP is fairly high (over 35W), which means active cooling is mandatory and system TDP would be higher than 60W, not so good for 7x24 use. Things changed with the emergence of Intel Atom processor, with the advanced 45 nm process, the TDP of the single-core Atom 230 and dual-core Atom 330 are merely 4W and 8W respectively, no need to be cooled by a fan at all. And the exciting news is that Atom processors are 64-bit capable.

But every Atom 230 based motherboard in the market lacks an on-board Gigabit Ethernet controller, a obvious result of cutting cost. My final choice is Intel D945GCLF2 mini-ITX motherboard, with 1.6G dual-core Atom 330 CPU on board (supports Hyper Threading), 945GC express chipset, Realtek Gigabit Ethernet controller and a standard 32-bit PCI slot. You will be impressed by the passive cooling of the CPU and active cooling for the north bridge at the first glance of the board. Compared with the 8W TDP of the CPU, the 20W TDP of the 945GC north bridge is really high, another "reasonable" design of cutting cost. Fortunately 20W is not so bad and the noise of the cooling fan is almost inaudible. The storage device interfaces of the board include one IDE and two SATA II ports, definately not enough for a 4-HDD NAS, so we need an extra PCI SATA adapter to provide all the necessary SATA ports.

Intel D945GCLF2

Before choosing the SATA card, the chassis needs to be determined. To me, the chassis should be small and pretty, support mini-ITX motherboard and have 4 hot-swappable 3.5" HDD bays. It turns out to be really difficult to find a good chassis that meets all the requirements, not quite surprising though. The model I choose is ES34069 (from the Taiwan chassis manufacturer Chenbro) and it's a perfect product in my point of view. However it took me quite some time to find a distributor in mainland China, and they have to import the chassis for me, at a fairly high cost of RMB1850 (over USD260). The delivery was also awful, it took over 50 days, but what can I say, I just wish I could order it from US.

Chenbro ES34069 Chassis

The perfect chassis arrived, and the motherboard was bought from www.taobao.com (the equivalent of eBay in China). With some simple measurement after successful installation of the motherboard, it turns out any PCI card higher than 40 mm is not going to fit into the chassis. Be aware that a PCI SATA card lower than 40mm does not exist. The solution to this problem is a PCI riser card, which is a small PCB with standard PCI gold fingers and a standard PCI slot with every signal routing to the gold fingers directly, so that a PCI card can be installed in parallel with the motherboard via the riser card. Choosing a proper PCI riser card was not an easy job either. The height of the riser card has to be carefully chosen: it will conflict with the audio interface of the motherboard if it's too low, and it will not fit into the chassis if it's too high. At last, a 35mm-high PCI riser card and a Sil3124-based PCI 4-port SATA II card were bought from www.taobao.com, although the riser card is a non-branded one and seems not well tailored. I could not wait to assemble all the stuff, and the space usage is just perfect (see the pictures), but after the power-up, the machine did not boot at all!

Something must be wrong with either the PCI riser card or the PCI SATA card. Removing the SATA card and leaving the riser card on the motherboard, the machine still did not boot. Removing the riser card and plugguing the SATA card on the motherboard directly, the machine booted OK! Seems the riser card problem, but where exactly?

I started to check each signal on the riser card with the reference of the PCI specification. Only one signal looks suspicious, it should be tri-stated according to the specification but connecting to the ground plane directly in the riser card. By cutting off the connection between the signal and the ground plane, problem was solved! The big lesson here is: better get a branded product!

PCI riser card and PCI SATA card

Next step was installing Solaris. At first I considered using DOM (Disk-on-Module) with IDE interface or a CF-to-IDE as boot device, but the performance price ratio turned out to be low -- a fast 4GB DOM or CF card cost more than RMB 200 (over USD 30). With much larger capacity and faster access, 2.5" HDD seems to be a better solution. So I bought a 160G 2.5" SATA HDD for no more than RMB300 (aournd USD 40).

Now which Solaris release to use? Of course the fresh released OpenSolaris 2008.11! Installation was quite smooth. The Realtek Gigabit Ethernet controller and the Sil3124 PCI SATA card were easily recognized and started to work. With the power of the dual 1.6G cores, the graphic desktop environment runs very smoothly, and please remember, only 8W power consumption! The wattmeter shows 45W average power consumption of the system, the temperature of the CPU and north bridge are all under 40 degree Celsius, green and cool!

The hardware part is almost complete (except the four 3.5" SATA disk drives) and the cost is around RMB 3200 (USD 450). Looking at similar products from HP, Thecus, QNAP and Buffalo, with average price over $700, they all run specially tailored embedded Linux, which means you can not run your favorite applications or play with the system at all. In contrast, using OpenSolaris as the firmware of the NAS box brings higher performance price ratio and much more fun. Of course, lacking of a good human-machine interface is the Achilles heel, but I believe with the open source of FISHworks, things will change a lot!

Now it's time to choose the 3.5" SATA disk drives. 7200RPM disks are just out of the problem because of the power consumption and noise. I found a very good 5400RPM candidate from Western Digital, the Caivar Green series 1TB disk drive only consumes less than 5W when idle and the performance is good enough for the NAS box. I bought four for RMB3000 (USD 430) and created a RAIDZ1 pool on top of them. Since the real capacity of each disk drive is 931GB, the total available capacity is around 2.7TB. That's RMB 2.3 (USD 0.33) per GB, pretty good deal! I created several ZFS file systems for storing different contents: books, musics, pictures, movies, etc.The rest steps were setting up Solaris NFS and CIFS services, really simple tasks and you can find lots of tutorials on internet. After that the NAS box was finally completed.

Complete view

Through NFS and CIFS over the Gigabit network interface, the average write speed is around 32MB/sec and read speed is around 40MB/sec, not bad. The total power consumption of the system ranges from 50W to 55W, pretty green for 7x24 use, right?

Wednesday Dec 10, 2008

Item Model Ref Price (RMB) Note
Chasis Chenbro ES34069 4 Hot-Swap HDDs Mini ITX Server Chassis 1850 180W PSU included
Motherboard + CPU Intel D945GCLF2 (Atom 330 CPU on-board) 650
PCI riser card 3.5cm high, non-branded 30 See picture below
PCI SATA II card Speed Dragon SD-31242-4IR-A2 300
Memory Kingston KVR800D2N6/2G 150
System HDD Hitachi Travelstar 160G 5400RPM SATA 250
Data HDD WD Caviar Green 1TB SATA II 3000
750 x 4pcs
Total
6230

PCI Riser Card:


To help more people read the article, I decide to post an English version of the article in a couple of days. Please stay tuned.

Here are more pictures of my Home NAS Box.

Picture 1: 2 of the 4 hot swappable SATA HDDs

Hot-swappable SATA disks

Picture 2: WD Caviar Green 1TB SATA II HDD

WD Caviar Green 1TB SATA II HDD

Picture 3: Sil 3124 SATA Raid Card BIOS screen

Sil 3124 PCI SATA Card BIOS screen

 Picture 4: OpenSolaris 2008.11 GRUB screen

OpenSolaris 2008.11 GRUB screen

Picture 5: Front view with 5 blue LEDs (4 for HDD, 1 for power)

Front view with 5 blue LEDs (4 for HDDs, 1 for Power)

Picture 6: OpenSolaris 2008.11 login screen

OpenSolaris 2008.11 login screen

Picture 7: "prtdiag" output

prtdiag output

Picture 8: Scanpci result

Scanpci result

Picture 9: Yes, there is also a DVD drive

DVD drive

Picture 10: Power consumption when idle (49.4 Watt)

Power consumption when idle

Picture 11: CPU temperature (measured as soon as case was open)

CPU temperature

Picture 12: North bridge temperature

North bridge temperature


Tuesday Dec 09, 2008

OpenSolaris 和 ZFS 为我们提供了一个机会用通用计算机硬件和开源软件搭建针对个人和家庭的小型NAS Box,我这个DIY迷当然不会放过这个机会啦。此次DIY我制定的基本目标是:

  • 低功耗的64位处理器,更好更快地运行Solaris和ZFS;
  • 4个热插拔3.5寸SATA硬盘位,支持1TB以上的大容量;
  • Gigabit网卡,充分发挥网络带宽。

此外还要着重考虑几方面因素:成本、整体功耗和噪音,毕竟是家用嘛。

市面上具有64位处理能力的x86处理器很多,但绝大多数都不是为低功耗应用设计的,TDP一般都在35W以上,需要主动散热。Intel推出的Atom处理器改 变了这一状况,由于采用了先进的45nm工艺,单核的Atom 230和双核的Atom 330 TDP分别只有4W和8W,只需被动散热即可,功耗和散热风扇的噪音问题一并解决。但目前市场上的Atom 230主板都没有板载千兆网卡,因此暂不考虑。我把目标锁定在Intel自家出的D945GCLF2主 板,这是一块标准的Mini-ITX主板,17cm见方,集成了Atom 330处理器,945GC北桥,Realtek千兆网卡和一个32位PCI插槽。CPU只用了铝散热器,没有风扇,相比之下功耗大户是945GC北 桥,TDP超过20W,因此用一个4010风扇主动散热,好在噪音很小。主板上提供了一个IDE接口和两个SATA 3G/s接口,无法满足接4块SATA硬盘的要求,因此需要加一块PCI SATA扩展卡。

在选SATA扩展卡之前我决定先把机箱确定下来。我对机箱的要求:一是小巧美观,二是支持Mini-ITX主板,三是支持4个热插拔硬盘。看似简单,可实际上寻找符合要求的机箱让我颇费了一番力气。最终我决定使用台湾勤诚(Chenbro)的ES34069,各方面都可以用完美来形容,唯一的问题是在大陆难觅身影。终于在北京找到一家勤诚的代理商,同意帮我从台湾订一套过来,但价格不菲,人民币1850元,而且货期长达45天,我下决心,等!

终 于,完美的机箱到手了,主板也从淘宝上淘来了。把主板安装好,测量一下,发现任何高度超过4CM的PCI卡都没法直接插在主板上,否则机箱盖子都扣不上。 于是又开始寻找合适的PCI转向卡(PCI riser card,可以把PCI卡的安装方向转90度,与主板平行),也不易啊,因为通常1U服务器用的PCI转向卡都太矮了,会导致PCI卡与主板的音频接口在 空间上冲突。又是在淘宝上淘到了解决方案,一种3.5CM高的PCI转向卡,刚好避开主板音频接口,又不会导致机箱扣不上盖,太棒了!顺便淘了一块 Sil3124的4口PCI SATA 3G/s卡(同样不好找,因为SATA 3G/s卡大多是PCI-X接口的)。收到货马上安装试验,SATA卡经过90度转向后,空间利用非常完美!可是一上电,系统没反应!连BIOS画面都不 出现了!

一定是PCI转向卡或是SATA卡造成的问题。于是把SATA卡取下,只留PCI转向卡插在主板上,结果还是不能启动。 再把PCI转向卡拿下,SATA卡直接插在主板上,机器启动起来了!看来问题出在PCI转向卡,但具体出在哪里呢?对照着PCI规范检查转向卡上的每一根 信号线,发现一根非必须的PCI信号线(细节略)直接连到了GND,非常可疑。用刀割断,再插上试验,启动正常!

下一步是安装 Solaris。先前考虑过用IDE接口的DOM或是CF卡转IDE作为启动设备,但读写速度快的性价比又太低——4GB的要花200多元。干脆用2.5 寸的硬盘吧,容量大,读写速度快,价格还实惠,80G的才200多元。Solaris的版本呢,就选择了刚刚出炉的OpenSolaris 2008/11,基于Solaris Nevada build101,很新很强大!安装过程非常顺利,Realtek千兆网卡和Sil3124 SATA控制器马上被识别出来并开始工作,双核Atom CPU的能力也充分体现出来——图形界面运行很流畅,要知道这可是一颗耗电区区8W的CPU啊。用功率计测一下,整机平均功耗在45W左右,红外测温显示 CPU和北桥芯片的温度也都不超过40摄氏度。

除了4块SATA硬盘,硬件方面基本齐备了,粗算一下成本大约3200元。市场上 HP、Thecus、QNAP、Buffalo都有同档次的NAS Box(支持4块热插拔硬盘),价格平均在4500元以上,而且都是运行定制的嵌入式Linux,无法二次开发。相比之下,我的OpenSolaris Home NAS性价比高多了(除了人机界面差点,等FISHworks开源就好啦)。

硬盘方面,因为功耗和噪音的原因,7200转以上的不考虑。感觉WD Caviar Green 1TB硬盘非 常适用,5400转,对Home NAS来说够用了,功耗也很低,平均不到5W,价格也不错,4块硬盘总共3000元。硬盘到位,就相当于仓库盖好了。我用4块硬盘做了一个RAIDZ1, 因为每块硬盘实际容量是931GB,因此实际可用容量是2.7TB,可以坚持相当一段时间啦。

安装好Solaris NFS和CIFS服务之后,一个真正的Home NAS Box就新鲜出炉啦。透过千兆网络连接,CIFS和NFS的读操作能达到40MB/sec,写操作也能达到32MB/Sec,应该算是不错的成绩吧。算上 硬盘,系统的总功耗是50~55W,很绿很环保哦。从11月7日开始到现在一个月的时间,7x24小时运行,稳定!

照片1:Home NAS Box 外观

照片2:机箱内部

照片3:PCI转向卡和PCI SATA扩展卡

照片4:北桥(在风扇下面)和CPU(在下方的那个散热器下面)

This blog copyright 2009 by Zhong Tom Wang