wezm.net/v1/content/technical/2011/12/freebsd-zfs-powered-nas.html

162 lines
6.7 KiB
HTML
Raw Permalink Normal View History

2012-01-21 06:09:55 +00:00
## Summary
2011-12-11 06:14:40 +00:00
2012-01-21 06:09:55 +00:00
Here's the tl;dr version: I sold my Mac Pro to fund building a home
NAS. The result is a HP MicroServer with 4Gb RAM and 3 × 2Tb hard
drives running FreeBSD from the system drive and a ZFS pool across the
three 2Tb drives. Total cost: AU$731.67.
## Rationale
Recently the Time Machine drive in my Mac Pro started to randomly
2011-12-11 06:14:40 +00:00
disappear and Mac OS X would say that I had removed it improperly,
which was not true given it was an internal drive still inside the
machine.
2012-01-21 06:09:55 +00:00
I've seen this behaviour before and in that case it resulted in the drive
2011-12-11 06:14:40 +00:00
being replaced due to its inability to complete a short S.M.A.R.T.
scan. This drive (also a Samsung) was suffering a similar problem except
that initiating the S.M.A.R.T. scan would actually cause it to disappear
from the SATA bus. A check on the Samsung site showed that the drive was
out of warranty so I was up for a replacement.
2012-01-21 06:09:55 +00:00
The Mac Pro wasn't getting used for much since I got a i7 powered Mac
Book Pro. Its main duties involved storing my iTunes library, Aperture
library and running my weather logger. It wasn't exactly a very energy
efficient machine to run all the time. It would in fact keep the study
warm overnight when the door was closed during winter.
2011-12-11 06:14:40 +00:00
There was also a problem with replacing the failing drive: I couldn't afford
to do so. So I decided to move the weather logging to my [ALIX board][alix]
and sell the Mac Pro to fund building a home NAS. I was able to sell the
Mac Pro very quickly on eBay for $1500 but gave myself a budget of $1000 for
2012-01-21 06:09:55 +00:00
the NAS. I wanted the NAS to have reliable, redundant storage, which for me
2011-12-11 06:14:40 +00:00
meant [ZFS]. This implied the new machine would need to run one of [Solaris],
2012-01-21 06:09:55 +00:00
[illumos], [FreeBSD], [FreeNAS] or [SmartOS]. The requirement to run one of
2011-12-11 06:14:40 +00:00
these OS's ruled out an off the shelf NAS appliance.
2012-01-21 06:09:55 +00:00
[ZFS]: http://www.opensolaris.org/os/community/zfs/
2012-10-29 09:20:08 +00:00
[alix]: /technical/2011/12/openwrt-on-alix/
2012-01-21 06:09:55 +00:00
[Solaris]: http://oracle.com/solaris
[illumos]: https://www.illumos.org/
[FreeBSD]: http://www.FreeBSD.org/
[SmartOS]: http://smartos.org/
[FreeNAS]: https://www.illumos.org/
2011-12-11 06:14:40 +00:00
I did a lot of research into different ways to build the machine and
tried out all the OS options in virtual machines. I considered using
2012-01-21 06:09:55 +00:00
basic PC hardware, MiniITX, HP MicroServer, etc. Each had its own
pros and cons. The basic PC approach was possibly the cheapest but it
was the largest. MiniITX was more expensive and choice of multi hard
drive bay cases were limited. I ended up settling on the [HP Proliant
MicroServer][microserver] running FreeBSD.
2011-12-11 06:14:40 +00:00
[microserver]: http://h10010.www1.hp.com/wwpc/hk/en/sm/WF06b/15351-15351-4237916-4237917-4237917-4248009-5163345.html
2012-01-21 06:09:55 +00:00
<script type="text/javascript" charset="utf-8">
$(function () {
var alt = $(document.createElement('img')).attr('src', '/images/2012/01/_MG_0581.jpg');
$('#inside-outside-view').toggle(function() {
$(this).attr('src', alt.attr('src'))
}, function() {
$(this).attr('src', '/images/2012/01/_MG_0582.jpg')
});
});
</script>
<figure>
2013-12-21 11:53:06 +00:00
<img id="inside-outside-view" src="/images/2012/01/_MG_0582.jpg" alt="Inside/outside view of HP MicroServer" />
2012-01-21 06:09:55 +00:00
<figcaption>The end result. Click/tap to toggle inside view.</figcaption>
</figure>
<figure>
2013-12-21 11:53:06 +00:00
<img src="/images/2012/01/_MG_0583.jpg" alt="Fron of MicroServer with CD for size comparison" />
2012-01-21 06:09:55 +00:00
<figcaption>CD for size comparison.</figcaption>
</figure>
<figure>
2013-12-21 11:53:06 +00:00
<img src="/images/2012/01/_MG_0584.jpg" alt="Oblique view of HP MicroServer" />
2012-01-21 06:09:55 +00:00
<figcaption>Oblique view (excuse the finger prints).</figcaption>
</figure>
## The Build
The MicroServer is a neat little unit. It uses a low power dual core AMD
2011-12-11 06:14:40 +00:00
Turion II CPU and comes with 2Gb ECC RAM and a 250Gb HD. I has 4 non-hot
swappable hard drive bays all packaged up in a squat little box. I ordered
mine with an extra 2Gb or RAM as ZFS likes to have plenty of RAM available
to run well.
2012-01-21 06:09:55 +00:00
During my research hard drive prices sky rocketed due to floods
2011-12-11 06:14:40 +00:00
in Thailand, however I was able to get some at pre-flood prices from
2012-01-21 06:09:55 +00:00
[ht.com.au][ht]. They have since put the price up ~$40 and placed order
limits on them.
2011-12-11 06:14:40 +00:00
For the drives I chose 2Tb Seagate Barracuda Green's. They feature SATA 3
2012-01-21 06:09:55 +00:00
and a 64Mb cache and run at an atypical 5900RPM. These drives seemed to be
2011-12-11 06:14:40 +00:00
a good balance across energy efficiency, noise, performance and price.
[ht]: http://ht.com.au/
2012-01-21 06:09:55 +00:00
The final parts list ended up being rather diminutive:
* 1 &times; [HP MicroServer][microserver] (658553-371) + 2Gb extra RAM $336.82
* 3 &times; [2Tb Seagate Barracuda Green Hard Drives][hard-drives] $394.85
2011-12-11 06:14:40 +00:00
2012-01-21 06:09:55 +00:00
[hard-drives]: http://www.ht.com.au/cart/1/part/V0531-Seagate-Barracuda-Green-ST2000DL003-hard-drive-2-TB-SATA-600/detail.hts
2011-12-11 06:14:40 +00:00
2016-12-30 07:02:03 +00:00
The total cost was $731.67, healthily under budget.
2011-12-11 06:14:40 +00:00
2012-01-21 06:09:55 +00:00
<figure>
2013-12-21 11:53:06 +00:00
<img src="/images/2012/01/IMG_0097.jpg" alt="Installing RAM into HP MicroServer" />
2012-01-21 06:09:55 +00:00
<figcaption>Installing the extra RAM.</figcaption>
</figure>
<figure>
2013-12-21 11:53:06 +00:00
<img src="/images/2012/01/IMG_0098.jpg" alt="Installing hard drives into HP MicroServer" />
2012-01-21 06:09:55 +00:00
<figcaption>Installing the hard drives.</figcaption>
</figure>
## Software
2016-12-30 07:02:03 +00:00
Installing FreeBSD and setting up the ZFS pool was straightforward. I'm running
the drives in a RAIDZ configuration, giving 3.6Tb of usable storage. I
currently have two ZFS file systems on that. One in a normal configuration and
the other for photos with `copies=2` set.
The system ran well for a few days however on the forth day one of the brand
new drives failed and started making a terrible clicking, beeping noise.
Fortunately HT replaced it promptly.
During the time the failed drive was out for replacement the ZFS pool continued
to run fine in its degraded state, with no data loss. Once the new drive was
installed it was a simple matter of issuing `zfs replace ada1` and it began the
process of resilvering the data onto the new drive and it has been running
incident free since (still running as of 30 Dec 2016).
2011-12-11 06:14:40 +00:00
2012-01-21 06:09:55 +00:00
$ zpool status
pool: storage
state: ONLINE
scan: resilvered 1.07T in 9h32m with 0 errors on Tue Nov 29 07:13:29 2011
config:
NAME STATE READ WRITE CKSUM
storage ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ada1 ONLINE 0 0 0
ada2 ONLINE 0 0 0
ada3 ONLINE 0 0 0
errors: No known data errors
After setting up the OS and file systems the only other thing I
needed to so was make the storage available to other machines on the
network. Since my house is all Macs I built [netatalk] via the FreeBSD
ports collection to make the storage available via <abbr title="Apple
Filing Protocol">AFP</abbr>.
[netatalk]: http://netatalk.sourceforge.net/
2016-12-30 07:02:03 +00:00
With that done the sever shows up in the Finder via Bonjour and
2012-01-21 06:09:55 +00:00
copying/accessing data is dead simple.