Network File Server using FreeNAS (Part 1)

Juggling around files can be a nightmare when you have multiple computers, especially when you use multiple operating systems. Trying to back up files can easily turn into a mess once you have multiple copies of files here and there, and you may constantly worry about hard drive failure.

By building a NAS yourself, you can solve these issues and save a lot of money compared to buying a commercial NAS product!

Juggling around files can be a nightmare when you have multiple computers, especially when you use multiple operating systems. Trying to back up files can easily turn into a mess once you have multiple copies of files here and there, and you may constantly worry about hard drive failure.

These are some of the reason which drove me to set up a NAS (Network Attached Storage) server to serve my files across my network. My requirements were the following:

  • At least 2TB of storage
  • Able to serve Windows, Mac OS, and Linux (SMB, AFP, NFS) at gigabit speeds
  • Low power consumption for 24×7 usage
  • Protected against hard drive failure
  • Protected against accidental file deletion
  • As cheap as possible

There are various companies which provide NAS solutions – for example, Synology and QNAP, as well as regular hard drive / network device manufacturers like Western Digital and Buffalo. However, as I looked through their products, I realized that while they looked very nice, they tended to be expensive and limited (depending on how deep your pockets are). For example, the Synology DS411J and QNAP TS-410 (both 4-bays) both cost around USD360, and once you’ve got them, they don’t tend to be that flexible.

So, I decided to DIY a server. Firstly, I looked at OS solutions, and settled on FreeNAS 8 (Using something like Solaris/FreeBSD would be even more flexible, but for simplicity, I went for FreeNAS which is small and has a decent web interface). The main attraction I was looking for was ZFS, a file system built to ensure data integrity. It can be thought as a marriage between hardware & software RAID, which is very beneficial because it avoids many of the write hole problems with a RAID system, and can self-heal your data. I won’t go into the details of ZFS, which can be found elsewhere, but it is clearly a very capable file system.

ZFS would provide me the following:

  • RAID-Z1: By using one of the drives in a pool for parity, I would be safe from a single hard drive failure.
  • Dataset quotas: Ability to limit datasets (or to effect, the shares) to a certain size.
  • Snapshots: You can think of this like Time Machine for Mac OS, although, to me, even better, because snapshots are instantaneous, and provide me safety against accidental file deletion, etc. They don’t take up any extra space, and allow me to roll back my file server to a particular state. Here’s how to use snapshots with Windows & Mac OS [Coming soon]
  • On-the-fly compression: Using fast compression algorithms (You can actually choose from a range – Gzip/LZJB), data can be compressed when written to the hard drive, saving space and in some cases, enabling even faster speeds on the hard drive. This is because most reading/writing is limited by hard drive speed and not CPU compression speed (At least with a modern CPU).

And having a DIY NAS server would give me the following:

  • A fast CPU for on-the-fly compression/transcoding – which I can upgrade in the future if needed
  • Flexible amount of RAM
  • Up to 6x SATA HDDs, plus with PCI-E expansion, I could easily put up to 15 Hard drives in total, for a LOT less cost than a commercial NAS
  • Ability to upgrade to 2x1Gbps network interfaces (or more), to double my network bandwidth
  • USB3.0 support

Of course, a DIY solution would tend to consume a bit more power than a NAS solution, given that it has a lot more CPU/RAM, and a lot depends on the power supply efficiency.

Parts & Build

In the end, I decided to go with the following:

  • Intel G620 2.6GHz Processor: The cheapest Socket 1155 CPU I could find at the time. It’s already a lot faster than needed, although if you do use on-the-fly encryption or compression, you can saturate it
  • Intel DH67BL-B3 microATX Motherboard: One of the cheapest boards I could find with at least 5x SATA ports. I decided to go with this because it had an Intel network controller, and according to some reviews I read, the lowest power consumption. It also gives me USB3.0 support which could be useful in the future.
  • 2x4GB Kingston DDR3-1333MHz RAM: Since RAM is cheap, and ZFS benefits from higher levels of RAM, 8GB made sense. The motherboard, supporting up to 32GB of RAM, can be easily upgraded in the future
  • 3x2TB Western Digital WD20EARX “EcoGreen” Hard drives: Not nearly the fastest drives around, but from tests (at least of the earlier generation WD20EARS), they appear to have the lowest power consumption
  • Corsair 4GB Flash Voyager USB flashdrive: One I had lying around to install FreeNAS on

All this added up to a grand total of USD422, hard drives included (USD196 without). I didn’t have a free case lying around at the time, so I just built it open:

After updating the BIOS, adjusting fan speeds, etc., I installed FreeNAS 8.0.1-RC1 onto my flash drive and booted up. Everything was detected without problems and the web interface was accessible. I created a RAIDZ1 array using the 3 drives, resulting in 3.56TB of usable space.

(Note: I had to use the wdidle3 tool to ensure my drives wouldn’t load/unload their heads so often, which could lead to premature failure)

Performance

Using the linux dd tool, I did a quick benchmark of the hard drives, which gave 217.7MB/s writing and 226.1MB/s reading. More than fast enough for me, given that gigabit LAN maxes out well before that anyway.

Next, I tested the network performance using iperf, and with 2 clients connected, the interface managed to push 950Mbps (119MB/s). All was looking well, so I quickly set up a CIFS/SMB (Windows) share and copied a file over. Both ways, I was getting 112MB/s. I also set up an AFP (Apple) share which got me the same 112MB/s.

Conclusion

I managed to get a file server which has great data integrity features, and can serve all my network clients. In addition to the regular network shares, I also use it as a “Time Capsule” of sorts for the two Mac OS machines on my network. In particular, for much less than what it would cost to buy an equivalent NAS or Time Capsule!

FreeNAS is still a work in progress, and isn’t perfect right now (still waiting for them to add VPN and torrent support), but it’s definitely on its way.

Further

FreeNAS: Simultaneous AFP/CIFS shares done neatly

10 thoughts on “Network File Server using FreeNAS (Part 1)”

  1. Hoong, i’m trying to build a FreeNAS 7 system with the same motherboard[latest bios update] as you did but without success. On the step of assigning interfaces my ethernet connection is not detected! Did you come across such an issue durig your installation? All the cables, router and switch i’ve used work fine. The network interface controller operates flawlessly on both windows xp/7 after the driver intallation.

    1. I built my system using FreeNAS 8 – rather than 7. Probably the Intel driver is not included, so if you want to run version 7, you’ll probably have to download the driver from Intel [http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=17509] and compile it for your platform (32bit or 64bit) – unless you can find it online somewhere. Once it’s compiled, you may want to try following these instructions – http://www.kristijan.org/2010/11/freenas-realtek-network-card/ (I can’t vouch for them being correct)

      You may also want to try asking at the FreeNAS 7 support forum, if you haven’t done so yet.

      Hopefully you get your system up and running!

  2. Hi,

    I’m looking into building a FreeNAS server with the G620 processor and an Intel mobo, either the one you’re using or the DH61BE.

    Is FreeNAS able to use the built-in video that you get from the G620 and the DH67BL or did you have to install a graphics card? I know that ultimately FreeNAS will run headless but I’m thinking that I would need a display for initial installation and troubleshooting.

    Are you running your HDs on the SATA 6GB ports? I’ve read that these new Intel motherboards have problems with SATA 6GB because of the Marvell controller they are using. I’m a bit unsure about the Intel mobos as I’m hoping to use these faster ports.

    Does FreeNAS have any issues with the built-in Intel NIC on the DH67BL? It looks like it’s working well for you from the transfer rates you’re getting. Did you have to install a special driver for the NIC or does FreeNAS already have it built-in?

    Sorry for the multiple questions. Thanks for any advice you can offer.

    Jeff

    1. Hi Jeff,

      Assuming you mean FreeNAS 8 (I’m on 8.0.2):

      1) FreeNAS has no issues with the built in graphics. I only tested it via the DVI port but don’t see why the HDMI port shouldn’t work. Although, I do all my work via Web Interface & SSH, so I only use the monitor when I need to access the BIOS.

      2) Yup, I have 4 drives connected right now, 2 on the SATA3 ports and 2 on the SATA2 ports. TBH, I didn’t know about any issues with the Marvell controller when I got it, but so far I haven’t had any issues to speak of. I’m using WD20EARX drives on 3 ports – they’re SATA3 drives, but of course they don’t come anywhere near to saturating the 6Gbps link.

      3) I had no issues with the Intel NIC on FreeNAS 8, but for FreeNAS 7 you may get issues as posted by Dave. Everything worked out of the box for me. Booted up and straight away got an IP address.

      The DH67BL is a decent mobo but of course it only has 5 SATA ports – if you want more drives you’ll have to use a PCI-E expansion or perhaps USB3/eSATA which I have not tested. The G620 is fast enough unless you plan to use on-the-fly compression (lzjb is fine though) or other CPU intensive features.

      Hope this helps,
      Hoong Ern

      1. Hi Hoong Ern,

        Thanks for your reply. Yes I’m looking to install FreeNAS 8. Good to know the integrated graphics and NIC works.

        I might be mistaken about the Marvell controller. After more research, I’ve realised the H67 chipset supports 2 x SATA 3 ports natively so I’m guessing there’s no Marvell SATA controller on the DH67BL.

        Not sure which version of ZFS RAID I’ll be running as I’m new to ZFS. My Linux server has RAID-1 and that’s all I’ve ever used. I’ll only be installing 2 HDDs on the NAS so I’d be glad for a suggestion about which version of ZFS makes sense on that config.

        I would also like to install a print server on the NAS although I’m not sure if that is even possible on FreeNAS 8.

        Right now I’m torn between the DH67BL/G620 combo and an ASUS E35M1/E-350 setup. With the E35M1 I could possibly use an old 230W supply I have and save some cost there. On the other hand the G620 is a more capable processor and the extra power might come in handy. I am a firm believer that a bit of margin is a good thing.

        Jeff

        1. If you’re using 2 HDDs, I’d suggest either a standard mirror RAID or a ZFS mirror. The plus side of ZFS mirroring is that you have data integrity. If you do use a standard RAID, you shouldn’t be using ZFS for the file system as it prevents ZFS from doing its own data integrity checks.

          Unfortunately, FreeNAS 8 right now doesn’t support any add-on modules, so I doubt your print server would work. FreeNAS 7, on the other hand, does support a fair bit more.

          I actually had the same decision between the G620/socket 1155 motherboard and the E35M1. The E35M1 of course has 6 sata 3 ports, but it is a bit underpowered and IMO, a bit pricey given the performance. In the end, I also couldn’t find it where I live so I went with the G620 – I can always add on PCI-E SATA controllers in the future if I need to. And to be honest, I’m sure your 230W PSU should be fine with whichever route you go. The setup shouldn’t really be drawing more than 50W (just a guess though, don’t take my word for it), unless you’re planning on running a ton of hard drives.

          The FreeNAS community forum may also be able to give you better answers and other opinions, if you’re interested!

          Hoong Ern

          1. Hi Hoong Ern,

            I’ve got the FreeNAS 8 server running with ZFS mirroring. Haven’t left it on to test for more than a couple of hours yet. Seems stable so far. Managed to setup user acocunts and CIF shares and even able to logon from a Win 98 machine. Will be transferring files over from my old server this weekend and hopefully the FreeNAS server will be running daily next week.

            Only niggling issue is that, as the server is running headless, the Intel motherboard complains about the keyboard being missing and delays the startup. Did you find a way to make it ignore keyboard error when booting?

            Still hoping for the print server plugin but will use it as is for now.

            Jeffrey

          2. Hi Jeffrey,

            Glad you got it working. Be sure to test it thoroughly (and perhaps try different setups) before leaving important data on it. Regarding the keyboard, I don’t have any issues – did you check the BIOS to skip keyboard errors? I can’t check mine right now (Well, I could – but it’s also running headless and is a bit of a pain) – let me know once you’ve checked the BIOS and if you still can’t find anything – I can check mine.

            (When it says the keyboard is missing, does it just delay the startup or does the startup fail entirely? It could be that mine also is delayed – but I wouldn’t know since I only had the screen on it for a day)

  3. Hi,

    When the keyboard is not connected it displays a message for a while and then continues booting. Just a little annoying although it doesn’t prevent the system from booting.

    I checked BIOS settings to disable keyboard error but there wasn’t an obvious setting to disable. I’ll just leave it for now as I only start it up once a day.

    Thanks.

    Jeff

Leave a Reply