How to Setup a Home File Server Using FreeNAS

What is FreeNAS you say? 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.
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.

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."

          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://" And from a Linux host, simply smbmount // /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. 
          Powered by Blogger.