Latest in Cifs

Image credit:

How-To: Set up a home file server using FreeNAS

John Browning, @linuxjeb
February 1, 2012

Sponsored Links

In today's digital world we've all got data, and lots of it. Our libraries are also growing rapidly: where you used to get by setting aside a few bookshelves for your books, CDs, DVDs and VHS tapes, we now require untold server space to preserve our beloved media in digitized form. We also want our data to be itinerant, or at least seem that way. That is, if you want to take a book or disc to another room of your abode, you pull it from the bookshelf and take it with you. Similarly, if you're working on a document upstairs on your desktop and you want to move to the den with your laptop, you'll need the proper infrastructure working in the background to enable that kind of wizardry. So, how can we create this "digital bookshelf?" Can you go out and buy it now? Can you build it in your garage? As it turns out, the answer is "yes" on all counts. You could go out and buy a Drobo device but in this case, we're going to assemble our own. And we're going to do that with the help of an open source storage platform called FreeNAS. So how involved a process is that? Meet us after the break to find out.

What is FreeNAS you say? Put simply, it's is an operating system based on FreeBSD that brings with it a snazzy web interface for management, and all the protocols you need to share files between Windows, Mac and Linux. In other words, a perfect solution for your digital bookshelf. Let's get to it.

Here's what you'll need, hardware-wise:
  • A 64-bit Intel or AMD processor. (While FreeNAS does support 32-bit environments, you'll want 64-bit to utilize the ZFS file system to it's potential. More on that later.)
  • A system board with a decent amount of SATA ports.
  • At least 4GB of RAM. FreeNAS documentation recommends a minimum of 6GB of RAM for best performance with ZFS. We found 4GB worked just fine. A general rule of thumb is 1GB of RAM for every 1TB of storage.
  • At least three SATA hard drives. (As with RAM, the more hard drives you have, the better.)
  • One CAT5 cable. (This thing needs to connect to your home network, obviously.)
  • One USB thumb drive to install the FreeNAS OS image.
  • One blank CD-R / CD-RW for writing the FreeNAS ISO in preparation for the installation.
  • Oh yeah, the 64-bit FreeNAS ISO image itself, which you can snag here. (Version 8.0.3-p1 at the time of this writing.)
However, since the economy is tough and budgets are tight, we wanted to show that you don't necessarily need the bee's knees of hardware to get FreeNAS up and running. We had the following components lying around, and they worked stupendously:
  • One AMD Phenom 8650 triple-core CPU
  • 4GB RAM (2x 2GB DIMMS)
  • Gigabyte GMA-MA770-UP3 System Board
  • One 150GB SATA DRIVE
  • One 250GB SATA DRIVE
  • One 8GB SanDisk Cruzer USB thumb drive
  • One CD / DVD-ROM combo drive
Sidenote: Drives are supremely important here. Ideally, you would have at least five 1TB SATA HDDs and a separate SSD for the ZFS Intent Log (ZIL). If you wanted to take it one step further, you could mirror the ZIL with two solid-state drives. This would provide a very redundant and high-performing NAS. However, the scope of this how-to is strictly getting a cheap FreeNAS environment up and running with the most basic of hardware. Especially since flooding in the Asia-Pacific areas have caused HD prices to nearly double in price, 1TB drives do not come cheap compared to a year ago.

If you're one of those extremely cautious people who has to double check everything, here's a URL to the FreeNAS hardware requirements. We recommend you at least glance at them if you're going to go out and hunt down shiny new hardware.

Once you've got your hardware squared away we have to get some things out in the open:
  • FreeNAS needs to be installed on a USB drive separate from the disks you intend to use for your storage volumes. Put simply, if you were to install FreeNAS (which only requires 2GB of storage) on a spankin' new 1TB HD, you'd lose 1022GB of said hard disk. FreeNAS can not utilize the drive on which it's installed for storage. So, that's why you need that USB stick.
  • Think about where you want to keep your FreeNAS box. Once you install the OS you can throw the box in a closet with power and a network connection, and let 'er run. Once the initial setup is complete, you can manage the configuration using the web interface. Just a thought.
  • Forget about WiFi. We know your little wheels are spinning -- just forget it. Trust us on this one.
Other than those three items, there's not much more to worry about -- it's time to install FreeNAS. To make things extra simple, we'll break this into numbered steps for you.

FreeNAS Installation
1. The very first step is to download the FreeNAS ISO image and burn it to a blank CD-R/CD-RW. You can get the file here.

2. Place the USB stick into a USB port that's attached directly to your system board. Don't insert it into one of those front panel sockets; to be safe it should be in the back of the PC. Yours truly had some weird results using front panel USB ports, which included installations crashing and very slow operation.

3. Power up your machine and head directly to your BIOS config. Do not pass go, do not collect $200. We have to be sure to set the boot devices in the proper order. Since BIOS options vary from device to device, here's the basic the order you want: CD/DVD drive, USB HDD, disable all other devices. Save your settings, place the freshly baked CD in your drive and reboot.

4. If everything went well with the last step you should now be booting to the first bootloader. You'll see some text scrolling and gibberish like so:

Next you'll get to the bootloader, which looks like this:

5. At this point you can either press Enter or allow the timer to count down. Whichever you choose, you'll end up in the actual FreeNAS installer here:

You'll be selecting the first option:"Install / Upgrade..."

6. Odds are your device will be listed as da0 on this screen as well. Double check the description and size to be sure. As you can see, in our case it plainly reads, "SanDisk Cruzer 8.02 -- 7.5GiB," the name of our USB Stick. Select your device and press Enter.

7. The installer here gives us a nice little warning which states that all data will be wiped from your drive for installation. Hit "Yes" to proceed.

8. As soon as you press Enter you'll notice the dialogue beginning at the bottom of the screen. Man, that's flashy. Eventually, you'll see a message reassuring you the installation is complete and that it's time to reboot again.

9. It does as it's told. Hit Enter and remove the CD from your drive so you boot to your newly minted FreeNAS installation. Once your computer reboots, you'll be inside the FreeNAS OS.

At this point, if you see this screen, go ahead and let out a single "woot!" You deserve it. Congratulations, you've now got FreeNAS installed. Okay, now get a hold of yourself, as we've still gotta carve out some disk volumes and share 'em.

Create disc volumes

1. Make note of the next-to-last line on the screen (highlighted in green below): That's telling us the URL through which we can access the FreeNAS management interface.

Sidenote: By default, FreeNAS utilizes DHCP for obtaining IP addresses; your IP is almost certainly going to be different. In most home environments, DHCP is used for serving out IP addresses, so it's easiest to leave the FreeNAS configuration as is to avoid any IP conflicts on your home network. If a storm knocks out power to your home and everything reboots, you may have to check this screen again if your DHCP client tables gets wiped out, as the address may change. If you happen to be running a network where you statically set IP addresses, good for you. You'll of course need to set a static address on your FreeNAS system by choosing option one on the Console Setup Screen. We won't cover configuring static addresses in this how-to, so you're on your own there.

2. Let's open up the management interface now. From another computer on your network, open up a web browser and enter the address you see on your FreeNAS machine. You should see this:

3. Notice in the top right you see that red "Alert" light blinking. Click it now.

FreeNAS is warning us there's no password. Thanks, FreeNAS! Anyway, let's go ahead and set one. Select "Account" over on the left, then "My Account", then "Change Password". Enter a password that's not "password" and click "Change Admin.." Simple enough, right?

Create a user
Next up, we need to create a regular, non-administrator user. In the left menu, expand "Account", then "Users" and click "Add User." Fill in the details required: username, real name and password, with the primary group set to "wheel." (We complete this step on the off chance you'll get prompted for credentials when you connect to your share later on.)

With that business out of the way, it's time to set up our disks and file sharing. But first, we need to make sure you understand two key points. For starters, FreeNAS supports two types of file systems and three sharing protocols. Let's discuss the two file systems first.
  • UFS. An old stand-by, the Unix File System. Don't get us wrong, it's a solid system; we just don't want to use it here. For one thing, it lacks the volume management, RAID and pooling options we can get with our second option, ZFS.
  • ZFS. The hot new kid on the block. This is the file system we want to use, mostly because of ZFS' data integrity, which promises safer, more resilient storage. Not an insignificant factor if you're trying to preserve a lifetime's worth of photos, or hundreds of tracks that cost you $0.99 apiece. We could spend a great deal of time talking about ZFS, but that's a topic for another day. For now, let's get on with it and talk about FreeNAS' sharing protocols.
As we said, FreeNAS supports three sharing methods:
  • CIFS/SAMBA. Open-source implementation of Microsoft's SMB (Now mainly referred to as CIFS)
  • AFP. Apple Filing Protocol
  • NFS. Network File System
All three of these have their advantages and trade-offs. For simplicity's sake, we're going to show you how to set up a CIFS share. This is because Windows, OS X and your favorite GNU/Linux distro all offer support for this protocol out of the box.

1. First, we have to set up our disk volumes. In the left menu, expand "Storage," then "Volumes" and select "Create Volume." You should see this screen:

Before you check any disks, give the volume a name and click "ZFS." This will show the ZFS Extra section. Notice iyou can select None, Log, Cache or Spare for each disk listed. You would use these options if you wished to host your ZFS Log data or cache on a separate drive, like an SSD, to increase performance. The spare option would allow the drive to operate as a backup in the event one of the other drives failed. For the purpose of this guide, we'll leave them all set to "None."

2. Check all of the disks in the "Member disks" section.

  • Notice the "Group Type" there? FreeNAS is asking us what type of volume we want. Since we only have three disks, our available options are: ZFS Mirror, ZFS Stripe or RAID-Z. Remember, we aren't focusing on UFS file systems here.
  • A ZFS mirrored volume would create a volume of the three drives above limited to the space of the smallest drive. So, we'd get a 71.4GB volume that had a one-to-one copy on our 250GB drive and 160GB drive. In case one of the drives died, we'd still have a backup copy on the other. This would be a poor choice with the combination of drives we're using, since we'd lose so much available storage. Also not a wise choice with the availability of RAID-Z.
  • A striped volume creates a volume which has an available size of all disks combined. So in this case we'd get 442.5GB of storage available, with no redundancy. Not the best setup for redundancy, because if a drive fails, your volume goes offline and you'll have possible data loss. Always remember: it's never a question of if a hard drive will fail, but when. This is, however, the best setup for providing the maximum amount of storage space.
  • A RAID-Z1 Volume, in the most basic of terms, is an advanced mirror. Yours truly could write a whitepaper on RAID-Z, but it's really beyond the scope of this how-to. However, this is the best option if you've got at least three drives of the same size.
In our case, we'll go with ZFS Stripe. If you have a better disk setup than us -- say, three 1TB drives -- you'll want to choose RAID-Z or ZFS Stripe with two drives and configure the third drive as a spare in the ZFS Extra settings.

Finishing up

At last, we click "Add volume" and the volume is created. Next, change the permissions on that volume so that anyone can read and write to it.

1. On the left, under Storage > Volumes, you should now see it listed as /mnt/myvolname, where "myvolname" is the name you gave to your newly minted volume . In our case, it's /mnt/data. Expand that menu and click "Change Permissions."

2. Under the "Mode" section, select both unchecked boxes beside "Write" and select "Set permission recursively."

3. Click the "Change" button to set the permissions.

Now it's time to share that volume and get on with the exciting business of saving your data.
The very first thing we need to do is enable the services required to share our files. Since we're using CIFS specifically, we want to enable the service required for that particular protocol. So, click on the "Services" button with the gears icon at the top of the page, and you should see this:

Hit the "OFF" button to enable CIFS. Here, you can also enable any other protocol you'd like, such as SSH, NFS, AFP, et cetera. The slider should be flipped to "ON" when you're done.

Next, click the wrench icon to bring up the CIFS service options. We want to check the "Allow guest access" checkbox and click OK.

Now, let's create our CIFS share. On the left menu, expand "Sharing", then "CIFS Shares" and click "Add CIFS Share."

Give your CIFS share a name, and select the path to the volume you just created. In our case /mnt/data not /mnt/vol1. Basically prepend "/mnt/" to the name you gave your volume. Make sure to check "Browsable to Network Clients," "Allow Guest Access." Scroll down and click "OK."

Ta-da! you can now access your share from your clients. From a windows host: Type "\\ " in either the Start menu search bar or an Explorer bar. Example: "\\ \ datacifs ." If you're using a Mac, meanwhile, go to Finder, hit "Go," click "Connect to server" and type smb:// . For example: "smb:// / datacifs /." And from a Linux host, simply smbmount // / datacifs /path/to/mountpoint.

Now you can enjoy your FreeNAS storage. Start copying over your music, pictures and movies. And hey, now you can enable UPnP in FreeNAS and pickup a media player that supports DLNA. There's really so much you can do with a home NAS. Exploring is half the fun.

All products recommended by Engadget are selected by our editorial team, independent of our parent company. Some of our stories include affiliate links. If you buy something through one of these links, we may earn an affiliate commission.

Popular on Engadget

The 2020 Engadget Holiday Gift Guide

The 2020 Engadget Holiday Gift Guide

Scientists find neutrinos from star fusion for the first time

Scientists find neutrinos from star fusion for the first time

The best Black Friday tech deals that are already available

The best Black Friday tech deals that are already available

Apple's Intel-powered MacBook Air falls to $799 ahead of Black Friday

Apple's Intel-powered MacBook Air falls to $799 ahead of Black Friday

'Marvel's Avengers' hasn't turned a profit yet

'Marvel's Avengers' hasn't turned a profit yet


From around the web

Page 1Page 1ear iconeye iconFill 23text filevr