A little post about where I store my 1’s and 0’s

My HP Microserver in all its glorious tiny-ness

My HP Microserver in all its glorious tiny-ness

Alright so I thought I’d make a little (uhm scratch that) massive that post about my server, this is by far one of the best investments I have made within the computing-world in years.

It all begun some time this autumn, I had friends from University back in the UK that had gotten hold of these cute little servers from HP, the HP proliant microserver, I had considered getting myself a server for a few years just to stash  away hard drives in and to play around with, I had planned to get some mini ITX motherboard with some low-power CPU and put it in a pretty case (yup I know its odd but I like that my computing stuff has a little bit of WAF).

These plans quickly changed as I discovered these HP proliant microservers, they were really small and really practical, so I got bought a HP proliant microserver N36L, it had a 2*1.3GHz Amd athlon neo CPU, 1gb of ddr3 ECC ram and a 250gb HDD. I had some plans about using a filesystem/Logical Volume Manager called ZFS and I had been warned that ZFS is really memory hungry so I bought 8GB of Kingston Value DDR3 ECC RAM (ECC is nice for server, you don’t want more corrupted data than you create yourself)

Installing ram and hard drives in this thing was incredibly simple, to install ram you simply open the large front door, undo two big blue thumbscrews and pull out the motherboard tray, pull out some cables, pull out the old ram and put in the two new sticks. to put in hard drives you simply pull out one of the caddies, use the tool and screws mounted in the door, mount the drive in the caddy and push it in.

Initially I tried out FreeNAS on the server by running it of a USB stick that was mounted in the internal USB port, this thing is basically made to run an OS like FreeNAS but I felt a bit awkward using freeNAS, I just didn’t like it so after playing with it for a while, I decided to move away from it, even though it had a pretty webUI and native support for ZFS and figured out you can run ZFS on linux operating systems by installing ZFSonlinux, this is a reimplementation of ZFS done by a third party as the CDDL license that ZFS is under is incompatible with GPL.

My HP Microserver naked and open showing the 4 drive bays and the ocz SSD mounted in the 5 1/4" bay

My HP Microserver naked and open showing the 4 drive bays and the ocz SSD mounted in the 5 1/4″ bay

I tried running ubuntu from the pendrive but it proved itself to be a bit of a pain but I got hold of a dirt-cheap OCZ vertex 2 60GB SSD so I thought I’d try that out, unfortunately the 5th SATA port on this server didn’t have support through BIOS for TRIM and was limited in other odd ways by HP as it was designed to be used for a DVD drive. But as with every popular product out there there was a hack for it, so I flashed the bios to some community modded version that did not have any of these limitations.

So with a new and fully featured bios I put the SSD in the 5 1/4 inch slot and mounted it securely with some zipties, plugged it into the motherboard and installed Ubuntu server on a 20gb partition and made another 20gb partition for swap, so that I had loads of memory spare for ZFS.

At this point I didn’t have any drives I could make some decent pool with but I got myself familiar with Samba shares, apache, mysql, ftp and user management. When I felt that I had gotten back on track with this I installed ZFS and bought another 2 3tb western digital green drives to accompany the one I already had and with a bit of help by the nice people at #zfsonlinux at freenode this was a breeze.

Before venturing into this unknown territory of ZFS I had surfed around the web for some good tutorials and I thought that this looked to damned simple, all I found was the same two commands everywhere, I was sure there had to be some unknown to me but common knowledge that all server wizards had that was suppose to happen between these commands.

I was wrong, to set up a raidz1 which is basically the same as a raid5 you really just need these two commands:

#Creates the drive pool (AKA Raid)
zpool create -o ashift=12 microserver raidz1 /dev/sda /dev/sdb /dev/sdc

#Creates the file system
zfs create microserver/datatank

and as if by magic I could now store data in this large data tank.

I got advised to export and import my pool by using these two commands to make it possible to pull out my drives and insert them in a random order and still make the pool build properly:

#exports the pool to a file (I think?)
zpool export microserver

#imports the pool
zpool import microserver

Now that’s convenient! I have played around with MDADM (software raid for linux before) and well… it goes apeshit on you if you don’t hook up the drives in the correct order.

Now there are a lot of other neat features to this magic called ZFS, I have barely scratched the surface but some neat things I am using is the built in NFS and SAMBA/CIFS sharing.

I have also set up several file systems on my pool where I have one system where I store all my TV Series, Music, Movies etc. and share them publicly on my local network. I have another where I keep my documents, projects, photos and personal things like that, for this system I have set up a quota off 200GB so in practice this appears as a 200GB hard-drive, this file systems does also have snapshots enabled which is another sexy feature that allows me to keep automated backups of my more important files.

To give a file system a quota you simply do:

#sets the quota for a file system
zfs set quota=200G microserver/personal

#to see what quota you have set for a file system
zfs get quota microserver/personal
NAME                 PROPERTY  VALUE  SOURCE
microserver/nikolai  quota     200G    local

Once again making snapshots are really simple you simply punch in:

#Creates snapshot recursively of all descendent filesystems
zfs snapshot -r microserver/personal@SnapName

The -r option makes ZFS do a recursive snapshot of all descendant file systems, in this case I have one file system /personal/ where I have another snapshot /nikolai/ where I keep my files, I have set it up this way so that I can easily add a file system for another user and give that system its own quotas.

The automation of the snapshots is done by a simple cron job and we all know how to do those right? :)

So why did I write this post now and not earlier? well first of all: my blog didn’t exist when I initially set up this server, secondly: I just went through the tedious job of expanding my array of drives from 3*3tb WD green dives to 4*3tb as I got hold of another drive for a cheap price, and it seemed like a waste of space to leave one bay empty, so now I have a total of 8.2 TB of space to go nuts with, hopefully it will keep me sorted for a good while.

So if you are looking for a decent NAS and don’t mind a bit of extra hacking and appreciate a bit more flexibility than most of-the-shelf units provide I would recommend that you take a look at these little beasts.

I will get back with another and hopefully a bit shorter post about what other things I use this little thing for.

EDIT: As I have had a few people contacting me about how much this setup did cost I had to add a little bit about that (making this post even longer)

I actually crunched a bit of numbers on this before buying the microserver and it actually turned out in the same price-range as an off the shelf NAS, following is the price list of the components I bought.

  • HP Proliant Microserver n36l: 1779,- NOK
  • KINGSTON 4GB 1333MHZ DDR3: 438,- NOK
  • OCZ Vertex 2 Series 60GB: 399,- NOK

That results in a total of: 2636,- NOK or about 345 Euros, yeah you can get an of the shelf NAS for less than that but this little thing knocks the socks of most NAS units within the consumer range, then again most comsumer NAS doesn’t use power hungry things like ZFS so they do not need a lot of computing-power or RAM but they do not provide the same flexibility as this setup does.

I have not considered the price of the storage drives within this summary as the price of the drives is irrelevant when comparing the price of NAS units, the storage drives turned out to cost far more than the other hardware in total anyways and with the current price of 3tb drives the server itself would be about 40% of the total price including the drives. (yup storage is expensive)

Leave a Reply