I had been researching NAS options for some time and most of my research had turned up a few truths;
1) High Performance NAS options are expensive (eg, starting price of $1000+ with no drives)
I wanted something that would take 4 drives and give me a bit of redundancy without sacrificing either write performance (RAID5) or capacity (RAID10) and could be have volumes carved up for iSCSI, SMB and whatever else I needed. I wanted at least 100mb/s write and 200mb/s read for my virtualisation host. I wanted this as well as capacity available for my media storage for photos, music and videos. I really wanted ZFS after reading more about it. I had basically convinced myself it was the coolest filesystem on earth and the only thing that would fit my needs.
2) Software support for turnkey solutions was tied to a hardware vendor (eg, thecus/synology/netgear etc) which meant that disk compatibility research was required for a any disk purchasing decisions.
I had heard some anecdotal stories from my workmates about the HDD support for various NAS vendors including a friend of mine who has lost an entire shared volume, seemingly at random, during a BIOS update. The same friend also complained that his NAS did not have a fast enough CPU to adequately do iSCSI and RAID5 in tandem.
It seemed I was going to have to build my own. I would need a hardware platform and an OS. I became enamored with Nexenta after I read this excellent AnandTech writeup called ZFS – Building, Testing, and Benchmarking by Matt Breitbrach about a custom built SAN made from consumer grade hardware. If you’re at all interested in this I highly recommend you read this article. The OS was chosen.
As luck would have it an opportunity came to purchase an HP N36L MicroServer for an incredibly good price. After reading that this system was compatible with Nexenta I snagged this one up with a view to use it as the NAS system I had always ‘been meaning’ to build.
Inside the MicroServer
I have worked with HP hardware for a while in the enterprise server space and they are my preferred choice for any sort of x86 compute platform if you can afford it. I find the attention to detail that HP put into their engineering makes managing and maintaining these servers simple; components are modular, easily identified and simple to replace (assuming you’re under an HP Carepack agreement! :)) Their free management software is also fully featured and allows you as an administrator to quickly drill into the health of all components of your platform.
Surprisingly this MicroServer is actually from the ProLiant hardware family and is designed for up to 10 users in a SoHo environment.
The inside of the MicroServer was elegantly arranged for such a compact system. Stats for this system below from HP’s website
- AMD Athlon™ II NEO N36L
- AMD RS785E/SB820M chipset
- Two (2) DIMM slots
- 1GB (1x1GB) Standard/8GB Maximum, using PC3-10600E DDR3 Unbuffered (UDIMM) ECC memory, operating at max. 800MHz
- Storage Controller:
- Embedded AMD SATA controller with RAID 0, 1
- Embedded AMD eSATA controller for connecting external storage devices via the eSATA connector in the rear of the server
- Storage Drive Support:
- 4 Internal HDD Support
- Maximum internal SATA storage capacity of up to 8.0TB (4 x 2TB 3.5″ SATA drives)
- Network Controller:
- Embedded NC107i PCI Express Gigabit Ethernet Server Adapter
- Expansion Slots:
- Slot 1: PCI-Express Gen 2 x16 connector with x16 link
- Slot 2: PCI-Express Gen 2 x1 connector with x1 Link
- Slot 2-2: PCI-Express x4 slot for optional management card
- USB 2.0 Ports:
- Seven (7) USB 2.0 ports: 4 front , 2 rear, 1 internal (for tape)
- Power Supply:
- 150 Watts Non-Hot Plug, Non Redundant Power Supply
- Optional MicroServer Remote Access Card
- Operating System:
- Supports Windows and Red Hat Linux
- Form Factor:
- Ultra Micro tower
Here’s a picture taken from my galaxy tab 10.1v that shows the inside of it.
The only downside of this system is that it does not support the Suspend to Ram (S3) power option. I will not be using this feature so it does not concern me.
In addition to this I added the following hardware;
4x WD20EARX Caviar Green 2TB HDDs with 64mb cache and 4k Sectors. I wanted to do 7200 Caviar black drives but N36L doesn’t support SATA 3 and at almost $200 a pop they weren’t totally price friendly.
1x Patriot inferno 60gb SSD for the system drive. I wanted this for speed and it was the cheapest one they had. Could probably have gotten away with a 16 or 8gb SSD instead, or even a USB stick if you’re feeling game.
2x4GB ProLiant N36L MicroServer 4GB DDR3 PC3-10666 ECC from MemoryStock is still waiting to be delivered. There is 1GB of ECC RAM that comes with the server which I have in there currently.
Nexenta does not yet support installation from anything BUT Optical drive. No USB stick build yet (why?!) I learned this the hard way and purchased an external Samsung DVD-RW for the system install.
High level build
The high level steps I needed to do:
- Install hardware
- Update BIOS and install hacked Russian BIOS
- Set all WD20EARX drives to relax the aggressive default spin-down timings by using wdidle3
- Install Nexenta
- Install Napp-IT for easy web configurability
- Create a ZPool using a modified version of the zpool binary to account for the 4kb sector size.
When I started this build I was completely unaware of the requirement for steps 2, 3 and 6. I’ll explain them all out as I go so others can lean from my mistakes.
Pretty straightforward. Screws for the HDD caddies are stored in the door at the bottom. One gotcha was the SAS connector can be tricky to pull out of the board. Squeeze hard and pull gentle. I didn’t have a case for the SSD so I left it sitting in the 5.25 bay with a bit of tape for now.
This IcyDock bay is a serious contender for the 5.25 drive bay as it allows you to put 4 x 2.5 SSDs in the space of 1 optical drive and another SATA controller card.
Update BIOS and install hacked Russian BIOS
The HP BIOS for N36L does not support anything but legacy IDE emulation on the internal ODD SATA port and the external eSATA port. This is a problem for Nexenta which can detect false disk errors when using the ODD drive on emulated IDE mode. Luckily an unknown Russian hacker somewhere has modified the BIOS to allow AHCI mode on both the internal and eSATA ports. I have always said, “Give the Russians two weeks and they will crack anything” and usually that has held true. Huge thank you to whomever has modified this BIOS given HPs complete failure to do so.
I have enabled this with good results. The main one being no emails from Nexenta informing you that the syspool has moved to a degraded state when it actually hasn’t
You need a USB stick with at least 512mb free (maybe less) that you don’t mind formatting.
BIOS update 17/01/2011 (A) 27 Feb 2011 from HP – This is used to create the USB stick for the BIOS flash. Don’t download the newer version – it’s unknown if the hacked BIOS is a patch or a complete replacement. Safer to make sure you download SP52016.exe (2.6 MB) which is the BIOS the hack is designed for
Hacked BIOS with AHCI support – This file goes on the USB stick also.
- Execute the HP install file and let it prepare your USB stick – follow the instructions on the web page that pops up after it installs.
- Copy the unzipped O41_AHCI.ROM file (after extracting from the zip file) to the same USB stick
- Copy the “flash.bat” file onto itself in the same directory and rename to “ahci.bat”
- Open “ahci.bat” in a text editor and replace the ORIGINAL.ROM filename with the O41_AHCI.ROM filename, save (should look like this: kbd /”flash O41_ahci.rom -r 100000,10000 -r 1e0000,10000;q”)
- Put the USB stick in and boot from it (you’ll need a monitor and keyboard obviously)
- Restart server – it will auto execute the first HP BIOS update automatically
- At the command prompt enter ahci.bat and press return to flash the patched BIOS
- Remove USB stick
- Restart the machine and enter BIOS with F10 and load defaults. Save and restart.
- Enter BIOS with F10
- Go to the Chipset Menu > Southbridge Configuration > SB SATA Configuration (New Menu!)
- Enable OnChip Sata Channel, OnChip IDE Type to IDE, Sata ID Combined Mode to Disabled and SATA ESP and SATA Power on all PORT to Enabled.
- While you’re in BIOS, ensure that video memory is set to 32mb to save your ram getting eaten by a video card you aren’t using.
(Optional) Set all WD20EARX drives to relax the aggressive default spin-down timings by using wdidle3
With the first build of this NAS before the current incarnation I had issues where disks would randomly report themselves as failed within Nexenta. This was quite distressing at first as I’d just bought this hardware was convinced it wasn’t to blame yet. Some digging on forums around the place uncovered a post about the default spin down time on these drives being set to 8 seconds by default which causes Nexenta to have ATA timeout errors. To counteract this I used a utility available from WD that can set the disk timeout value. I set these using the /d flag, which on the WD20EARX drives sets the spin down value to 62 mins – this value is never reached and thus produces no errors in Nexenta. If I was some Solaris guru I’d work out how to get Nexenta to talk to the disks and spin them down when there was no I/O but doing that is breaking the law for me.
You need the USB stick you created previously (easy) or another way to boot into DOS.
If you use the same USB Stick that you created last time remember to edit the Autoexec.bat file and remove the line with flash.bat (that re-flashes your BIOS to the HP standard)
- Edit the autoexec.bat file on the USB stick to remove the flash.bat entry – otherwise you’ll have to re-run AHCI.bat again and reconfirm your BIOS settings
- Download and unzip the file onto the usb stick
- Boot into Dos
- Execute wdidle3.exe /r to check the current timings
- Execute wdidle3.exe /d to set the timings to disabled.
- Execute wdidle3.exe /r to check the current timings are set to high values..
This will set the timing settings across all WD drives that it can – If you have non WD drives they should not be affected but probably doesn’t hurt to remove them beforehand.
After install don’t forget this line if you’re using DHCP. It caught me out first time! It enables the NetWork Auto Magic (NWAM)
sudo svcadm enable nwam
Install Napp-IT for easy web configurability
Super easy. I had to run two lines of perl instead of one as per the PDF. Just make sure your n36l has a valid IP and is connected to the net.
wget www.napp-it.org/nappit sudo perl nappit
Napp-IT will do the rest. Before you reboot, be sure to re-enter your root password for SMB. Use the command
and then follow the instructions below
Create a ZPool using a modified version of the zpool binary to account for the 4kb sector size on newer disks.
If you’ve got drives that use “Advanced Format” or 4k sectors you’ll need to snag this modified binary version of the zpool command. This is because the version of zpool that comes with nexenta has a 512 byte sector offset hardcoded into the binary. Napp-IT uses this binary by default so any pools you create within the Napp-IT interface will have the wrong sector size for your disks. This leads to sub-optimal performance and it’s generally not good long term.
Grant Pannell has come to the rescue with the following blog post. He goes into some excellent detail and provides some before and after benchmarks with numbers that describe the difference between proper sector alignment and not and optimal numbers of drives per RAIDz types here.
I’ve condensed the instructions below – what this does is replaces the default system binary with the one modified by Grant.
from a terminal session on the NAS;
wget http://digitaldj.net/zpool-12 sudo mv /sbin/zpool /mv/sbin/zpool.old sudo mv ~/zpool-12 /sbin/zpool sudo chown root:bin /sbin/zpool sudo chmod ugo+rx /sbin/zpool
You can create your zpools with the web gui now but beware if you change or add disks that use non-4k sector aligned drives.
DD Test writing a 10GB file:
write 10.24 GB via dd, please wait... time dd if=/dev/zero of=/stuffpool/dd.tst bs=1024000 count=10000 10000+0 records in 10000+0 records out 10240000000 bytes (10 GB) copied, 60.8555 seconds, 168 MB/s real 1:00.8 user 0.0 sys 16.3 10.24 GB in 60.8s = 168.42 MB/s Write
read 10.24 GB via dd, please wait... time dd if=/stuffpool/dd.tst of=/dev/null bs=1024000 10000+0 records in 10000+0 records out 10240000000 bytes (10 GB) copied, 40.8021 seconds, 251 MB/s real 40.8 user 0.0 sys 11.2 10.24 GB in 40.8s = 250.98 MB/s Read
All in all it’s been a fun build with a lot of learning along the way. I’m keen to see what bumping up the ram from 1gb to 8gb does to the DD results.