Cheap and NASty - How to Build an Open Source FreeNAS Server

norman

Don't want to pay for Windows Home Server? We show you how FreeNAS lets you create a server for storing, sharing, and streaming all your digital content—for free!

Back in the day, the average nerd household had one or two computers, a printer, and a game console. If you were lucky, you had an Internet connection on one of those computers—forget about the printer; forget about the console. And forget about home networking. But now, the average geek household has a multitude of machines: desktop computers, laptops, netbooks, Wi-Fi-enabled smartphones, and networked game consoles—not to mention terabytes of ripped movies, music, and photos. Wouldn’t it be nice to have a central location where all of those files lived that was accessible to all your computing devices? A place where you could back up all of your computers, host your media files for streaming to your console or other computers, and use as a file share for your whole network? Yes. Yes, it would.

A few months ago, we showed you how to set up a Windows Home Server to enable such a scenario. But a Windows Home Server license costs 100 bucks, and doesn’t necessarily play well with non-Windows machines. FreeNAS, on the other hand, is a free, open-source FreeBSD derivative, and though it can be a little more complex under the hood, it’s as powerful as Windows Home Server and runs well on salvaged hardware. And FreeNAS plays well with Windows, Apple, and *nix systems.

We’ll show you what hardware you’ll need for a FreeNAS server, how to install and configure your server, and then help you choose between FreeNAS and WHS.

Free to Be FreeNAS

Five ways the no-cost server software can benefit your home network

1. Storage

Let’s face it: A family’s worth of home movies, music collections, photos, school assignments, and ripped DVDs takes up a lot of room. Rather than keeping all that content scattered among four computers and six external hard drives, centralize! Use FreeNAS as a central repository for your family’s media, so everyone can access it.

2. Media Server

A FreeNAS server isn’t just a place to store your media—it’s also a fully featured media streaming machine in its own right. The built-in Firefly media streamer creates a library in iTunes that anyone on the network can access. And with FUPPES, the open-source UPnP server, you can transcode and stream movies to your networked computers, HTPC, Xbox 360, PlayStation 3, or any other UPnP or DLNA-enabled media player. It also streams photos and music!

3. BitTorrent Downloading Machine

Rather than wasting your personal machine’s processor cycles and bandwidth, use your FreeNAS server to automatically download and seed .torrent files. We’ll show you how to set a watch folder so that your NAS will immediately download any torrent it finds there.

4. Web Server

FreeNAS is configured through a web GUI, which means FreeNAS has a built-in web server. You can use FreeNAS to host your own websites—and even access them from outside your home network!

5. Backup Server

Back up all your computers to your NAS box—whether you’re an advanced Unix user and back up using FreeNAS’s built-in rsync support, or you merely point your backup software toward your FreeNAS user folder, a FreeNAS server is a great centralized location for data archives.

Hardware Requirements

One of the biggest advantages of FreeNAS is that it will run on virtually any hardware, so you have the potential to build a new file server without laying out any cash. At the bare minimum, FreeNAS requires just 128MB of RAM, an x86- or AMD64-compatible CPU, a bootable CD-ROM drive, and at least one bootable hard drive. So if you have a computer built within the past 10 years, it probably qualifies, though you might want to add a SATA controller.

If you’re buying new hardware, aim for a low-voltage processor (less than 50W), and the more RAM the better. Integrated graphics are fine, and you’ll only need a mouse, keyboard, and monitor for the initial setup.

The Parts List

Case: Antec 200
$49, www.antec.com

Motherboard: Asus M4A78 Pro
$110, www.asus.com

Processor: AMD Athlon X2 240
$55, www.amd.com

RAM: 2GB Corsair DDR2
$40, www.corsair.com

Storage: (2) 2TB Western Digital Caviar Green
$280, www.wdc.com

Power Supply: Rosewill RP550-2
$55, www.rosewill.com

We used the same hardware as for our Windows Home Server build . Briefly, that’s an Asus M4A78 Pro motherboard, AMD Athlon X2 240 CPU, 2GB Corsair DDR2 RAM, two 2TB Western Digital Caviar Green drives, and a Rosewill 550W PSU. We installed the OS with a USB CD-ROM drive we had lying around, since we’re not going to need an optical drive on the server once it’s built. To ensure compatibility with FreeNAS, you should check your hardware against the FreeBSD hardware compatibility list .

Building Your FreeNAS Box

1. Prep the Case

We picked the Antec 200 because it’s an inexpensive chassis with six 3.5-inch drive bays. It also one-ups other budget cases by including an external easy-swap SATA bay, which is convenient if you plan on frequently replacing your server's drives. The included 14cm fans also have adjustable rpm switches, so you can turn them down to keep the system whisper-quiet. To start, you’ll have to snap in the motherboard’s included I/O shield in the back of the case (image A), and then screw nine motherboard stands into the belly of the chassis (image B). We also took this opportunity to install the power supply (image C).


(image A)

(image B)

(image C)

2. Insert the CPU

Next, place the motherboard on a static-free surface and install the CPU. Make sure to align the CPU properly (matching the triangle on one of its corners to the mark on the motherboard) before locking it into the socket (image A). Once the CPU is in place, plant the stock cooler on top of the proc and clamp it into the plastic bracket (image B). Then plug the cooler’s three-pin fan connector into the motherboard.


(image A)

(image B)

3. Drop in the Motherboard and RAM

With the case flat on its side, carefully place the mother-board inside, aligning its screw holes on top of the standoffs (image A). The Asus M4A78 is a full ATX-size motherboard with six SATA ports. It also has onboard video output, which we’ll use to access the BIOS and also install the WHS software. With the motherboard screwed into place, insert your two 1GB RAM modules into slots 1 and 3, which allows the DIMMs to run in dual-channel mode (image B).


(image A)

(image B)

4. Mount the Drives

Now it’s time to install your server's hard drives. With the case side panels removed, slide each drive into an open bay until its screw holes are visible from the side. Affix each drive using four screws. We went with two large-capacity drives to give our server ample storage space without having to worry about replacing drives anytime soon.

5. Attach SATA Cables

Use the included SATA data cables to connect both of the drives to the motherboard (image A). We also connected a third SATA cable to the case’s easy-swap drive slot, which rests right above the internal drive bays. After the data cables are attached, connect the SATA power cables from the power supply to the drives as well (image B).


(image A)


(image B)

6. Wire It Up!

With all of the physical hardware in place, it’s time to wire up the loose ends. We want to be able to plug USB keys and portable hard drives into the front of our server, so we plugged the case’s two front-panel USB cables into the motherboard (image A). The other front-panel connectors, including the power switches and LEDs, are easily attached to the motherboard using Asus’s motherboard adapter (image B). You’ll also want to direct power to the case fans using four-pin Molex connectors from the power supply (image C). Finally, give your motherboard some juice by attaching both the main 24-pin ATX connection and four-pin CPU power connector to the motherboard (image D).


(image A)

(image B)

(image C)

(image D)

Installing FreeNAS

Don’t let the ancient UI fool you; it’s not as scary as it looks

Download and Burn the LiveCD

You’ll need the latest LiveCD for your processor—either 64-bit (AMD64) or 32-bit (i386). Download the LiveCD ISO from FreeNAS.org or SourceForge and burn it to a CD using image-burning software such as ImgBurn . There’s also a method for flashing a FreeNAS image directly to a bootable CompactFlash card— instructions can be found here .

Boot from LiveCD

Go into the BIOS (usually by hitting Del or F10 during startup) and give boot priority to the CD drive. FreeNAS will load from the disc and present a numbered menu labeled Console Setup.

Select Install Type

Select option 9) Install/Upgrade to hard drive/flash device, etc. In the next screen, pick option 3) Install ‘full’ OS on HDD + DATA + SWAP. You’ll be prompted to select the CD drive containing the LiveCD, which should be cd0, then the destination media—ad4, in our case. (FreeNAS, as a FreeBSD distro, uses device codes, not drive letters, for its drives.)

Next, you’ll be prompted to set a size for the OS partition. We chose the minimum size: 128MB, which is plenty—all your data will be stored on a separate partition. Now you’ll set your swap partition size. We went with the default again here, which gave us a swap size of 1,684MB.

Write it Down!

After you’ve chosen your OS and swap-partition sizes, FreeNAS will install on your system. Once it’s finished, the screen will display some important information. Specifically, make note of the instructions for mounting the data and swap partitions. And make note: The data partition has been formatted in UFS, so don’t reformat it unless you want to use ZFS (see sidebar). After you’ve written down the information on the screen (which we’ll cover again later, don’t worry), you can remove the CD and restart the computer.

Reboot

Once you’ve restarted the machine, go back into the BIOS. Go to the Boot menu and change the boot priority back to your hard drive. Save your changes and exit the BIOS. FreeNAS should boot from the disk and return to the original Console Setup menu. Before we head over to FreeNAS’s WebGUI, where we’ll do most of the configuration, we have a few more things to do here.

Set Web Interface

Select option 1) Assign interfaces, just to make sure your Ethernet connection is detected and working. Your Ethernet interface name will probably be the first two or three letters of your chipset, followed by a number. Ours is ale0 . After you’ve assigned the first port, you can assign others (if you have more than one Ethernet port on your motherboard), or finish and exit the configuration.

Set LAN IP Address

You’ll want to give your FreeNAS server a static IP address, to prevent your DHCP server from assigning it a different IP every time the server reboots. First, go to a computer on your local network and run cmd.exe. Enter the command line ipconfig
/all
and make note of that computer’s IP address, subnet mask, DNS server, and default gateway.

Now go back to the NAS. Select option 2) Set LAN IP address. FreeNAS will ask if you want to use DHCP for this interface. Select No. The next screen will prompt you for a new LAN IPv4 address. Use something in the same subnet as your other computers—often, this will be some variant on 192.168.1.* or 192.168.0.*. (You'll need to go into your router's config and reserve the IP you chose.)

In the next screen, use the subnet mask bit count that corresponds to your other computers’ subnet mask (most users will use 24). And in the next screen, when it asks for your default gateway, enter your router’s IP address. Finally, you’ll set your DNS IPv4 address, which is the DNS Server address you got from ipconfig on your Windows machine.

Once all this is completed, make note of the new IP address. You’ll use that to access the WebGUI. And now it’s configuration time!

Using FreeNAS's Multi-Drive File System

By default, FreeNAS formats its data storage with UFS (Unix File System). FreeNAS actually warns against formatting in NTFS, the default Windows file system, and you won’t want to format your NAS in FAT32—not if you have any files larger than 4GB, that is. So UFS is the best option for most people. But FreeNAS recently implemented support for ZFS, the Zettabyte File System. Instead of being a single-drive file system, ZFS manages a pool of virtual devices, which can be partitions or whole drives.

Advantages include one file system for all your storage, seamless addition of devices, and the ability to set up RAID-Z redundancy easily. Unfortunately, ZFS is still experimental on FreeNAS, and it does have limitations—the biggest of which is that it is a local file system and doesn’t handle multiple access requests well. There’s also no provision
for defragmentation.

If you do choose to try ZFS on your FreeNAS server, you should configure it from the beginning. You can do so under Disks › ZFS in the WebGUI.

Configuring FreeNAS

A not-always-intuitive WebGUI is the key to FreeNAS’s powerful features

Once you’ve finished your initial FreeNAS setup, you shouldn’t need a connected mouse, keyboard, or monitor anymore (unless your mobo won’t boot without a keyboard). The rest of the configuration process, as well as any maintenance you’ll perform from now on, will be done through the WebGUI using any computer on your home network. To access the WebGUI, type your server’s internal IP address into a browser window. In our previous example, that means http://192.168.1.250:80 . Log in with username “admin” and password “freenas.” We’ll change this in the next step.

Change Admin Password

The first thing you’ll want to do is change the password. Go to the System drop-down menu and pick General, then click the Password tab. Type in the default admin password (“freenas”) at the prompt, then pick a new password. (If you forget it, you can reset the password to a default later, but you’ll need physical access to your server.) While you’re here, don’t forget to go back to the General tab and enable HTTPS login.

Add a Data Disk

Remember those instructions we told you to write down in Step 4 of the installation process? Well, now you’re gonna use them. In the WebGUI, go to Disks > Management. Click the plus button to add a disk, then pick your primary disk from the drop-down menu. Ours was ad4, which is FreeBSD jargon for ATA Disk 4—it’s attached to SATA controller 4. Give it a description so you’ll remember which drive is which, then click the radio button to activate S.M.A.R.T. disk management. That’s useful. Hit Save, and don’t forget to Apply Changes back at the Disk Management screen.

Set Up a Mount Point

Next, we’ll set up a mount point. You won’t be storing anything on your FreeNAS partition; there’s only 128MB of space there and most of it is full already. Instead, all your disks will be mounted as subdirectories of your /mnt/ folder. Go to Disks > Mount Point, and click the plus button, just like you did to mount the disk itself. For Type, select Disk. From the drop-down menu, choose the disk you mounted in the previous step (ad4, in our case).

Provided you’re adding the data partition you set up in the installation process, you’ll choose MBR partition as the Partition Type. For Partition Number, choose 2 (1 is the OS partition you created earlier—you can’t configure that). Name your mount point something memorable. Last, you can set up access restrictions by group or by user. It’s always better to assign group permissions and then make users part of specific groups, rather than assign specific permissions to each user.

Set Up Windows Sharing

Now that you have a mounted drive, it’s time to configure it. Navigate to the Services menu and go to CIFS/SMB. Click the Enable button under Settings. Choose your authentication method; we’re going with Anonymous for now, since all the computers we’re using are on the same network and we’re not worried about other people accessing the server. Set your NetBIOS name and workgroup name (if you have a home workgroup). We used freenas and WORKGROUP, respectively. In Advanced Settings, check “Enable large read/writes” and “Enable use sendfile.”

Now go to the Shares tab. Create a new share by clicking the plus icon. We’ve called ours Aleph, the same as our data partition, because that’s what we’ll be mounting. At the Path menu, enter your mount point from earlier—in our case, that’s /mnt/aleph. We’ll check the boxes for “Set browseable,” and “Create recycle bin.” Click Save and then Apply Changes. For Apple sharing, enable AFP; for Linux/unix, enable NFS.

Map Network Drives

Next, we’ll map drives in Windows Explorer. Go to the address bar and type \\[servername]. In our case, that’s \\freenas. You should see the share folder you named (Aleph, in our case). Right-click it and select Mount Network Drive. Now you can access your FreeNAS server’s storage area directly from My Computer. If you want, you can create separate network shares for your media folders: We created Music, Movies, TV Shows, Photos, and others. Create subdirectories of your main share, then repeat the steps we just described to set them up as shares and map them.

Create Users

FreeNAS is still a work in progress, and the version we are using (0.7RC2) doesn’t have an easy way to set per-user and per-group permissions for individual files and folders. However, you can control how much access users get to the web panel. Go to Access > Users and Groups. There’s not much to do here yet, but you can still create a group called Users, and then add individual users to that group. You can assign each user a home directory, as well as additional user groups.

Set Up iTunes Streaming

A NAS is a perfect place to store a unified music library, and FreeNAS ships with Firefly, an open-source media server for iTunes.

Go to Services > iTunes / Daap. Click the box for Enable, then name your server (we called ours freebird, and that’s what shows up in iTunes). Choose a directory to store the music database, and directory or directories to watch. In our case, that’s /mnt/aleph/music. Set a scan frequency (in seconds), then save and restart. You should see the name of your music server in the Shared section of iTunes. Make sure you have Zeroconf/Bonjour set up in (System > Advanced), so FreeNAS will broadcast its services. You can access the Firefly media server via the web by connecting to port 3689 at your server’s IP address.

Set Up UPnP/DLNA for Streaming

Turning your FreeNAS server into a UPnP streaming media library is just as easy as setting up iTunes streaming, thanks to the included FUPPES UPnP media server software. Go to Services > UPnP, and click the Enable box. Name your server, keep the default interface and port unless you have a reason not to. Choose a directory for the UPnP database, just like you did for iTunes streaming, and set directories to watch. We created separate directories for movies, television, and photos. The Profile setting is device-specific, though we found the Xbox 360 profile worked fine for the WD TV Live we tested it with, as well as with our test computers. Click the checkbox to enable the WebGUI, then hit Save and Restart to activate the service.

Set Up the BitTorrent Client

Another perk of a dedicated media server is that you can also use it as a torrenting box. FreeNAS ships with the Transmission client, which you can configure to automatically download .torrents it sees in its watch folder. Create two subdirectories in your share; one for Transmission to watch for .torrent files, and the other for finished torrents. Go to our old friend the Services menu and select Transmission. Click the Enable checkbox. Point the Download Directory to the folder for finished torrents (ours is called Finished Torrents) and the Watch directory to your watch directory. Set minimum and maximum upload and download speeds, then click Save and Restart. Any .torrent file you save in the watched folder will automatically be downloaded by Transmission; alternately, you can log into the Transmission WebGUI ( http://serverIP:9091 ) and upload torrents from your local machine or from the web.

Configure Web Services

The FreeNAS server can also be configured as a web server. In the Services menu, go to Webserver, click Enable, set a TCP port for the web server and a parent directory for the web server, and hit Save and Restart. Drag your website files to that subdirectory and you’re ready to go.

For FTP access, go to Services > FTP, and click Enable. Leave the default settings unless you have reason to change them. We checked “Only allow authenticated users” and left the rest at their default settings.

To access your FreeNAS server from outside your home network, you must forward certain ports from your router to your NAS—the defaults are 80 for the web and 21 for FTP. For step-by-step instructions for your router, go to portforward.com .

Add Another Disk

To add another disk to your FreeNAS installation, shut down the server and install the disk, then restart. Essentially, you’ll repeat the steps you took to create the first data disk: Go to Disks > Management and click the plus sign to add a disk. Select the one that isn’t already mounted (ad6, in our case), give it a description, set its power management levels, and enable S.M.A.R.T. Unlike the first disk, you’ll have to format this one, so under Preformatted File System, leave it unformatted. Next, go to Disks > Format, select the disk you’re adding, and UFS (GPT and Soft Updates) as the file system. Give it a label, and hit Format disk. It may take a few minutes.

Once the disk is formatted, go to Disks > Mount Point and add it. Follow the previous instructions for mounting a disk, except the Partition Type will be GPT partition, and the partition number will be 1. Add it, apply the changes, and make it into a share. Voilà!

Advanced Steps

Because FreeNAS is based on FreeBSD, a Unix variant, it has an array of advanced features that aren’t necessarily easy for the *nix newbs among us. If you want to SSH into your FreeNAS server remotely, use rsync or Unison, set up a RAID array, or use the command-line interface to set permissions for files and folders individually, you’ll find plenty of help and documentation at the FreeNAS knowledgebase , forums , and tutorial websites like LearnFreeNAS.com . It might not always be simple, but FreeNAS is powerful, flexible, and free, and that’s a winning combination in our book.

FreeNAS vs. Windows Home Server

WHS: Windows Home Server trumps FreeNAS with its ease of use. You can schedule hassle-free automated backups for up to 10 Windows PCs without learning complicated scripts or using BSD.

FreeNAS: FreeNAS might not be as easy to set up as Windows Home Server, but it’s more powerful: Does WHS have a built-in BitTorrent client and iTunes library? Plus, it plays better with Macs and Linux/Unix machines.

WHS: WHS’s library of Add-ins lets you add functionality like automatic Flickr uploads and advanced power management. Plus, since WHS runs on top of a Windows kernel, you can use remote desktop to install additional server software for features like real-time video transcoding.

FreeNAS: FreeNAS has lower system requirements than WHS, which needs at least a 1GHz PIII and 512MB of RAM, as well as an 80GB primary hard drive. FreeNAS can be run from a CD, CompactFlash card, or USB stick, and requires just 128MB of space for its OS partition and 128MB of RAM.

WHS: A WHS machine has huge upgrading potential. Microsoft’s software makes it easy to add or swap out hard drives to expand server capacity without messing up your existing backups.

FreeNAS: FreeNAS is free. WHS costs around $100.

Around the web

by CPMStar (Sponsored) Free to play

Comments