Affordable NAS
Volume Number: 23 (2007)
Issue Number: 11
Column Tag: Networking
Affordable NAS
Integrating FreeNAS
appliance software
into a Mac environment
by Robert Staehl
What This Article Will Cover
The purpose of this article is to introduce the user to the potential of integrating a NAS device - an open source, Mac-friendly (AFP serving) NAS appliance - into a network environment. The article will focus on getting a FreeNAS device configured and running on a local network. FreeNAS includes several advanced features such LDAP and AD support that I do not cover in detail. This article will cover installation and configuration to a point allowing network access to the data stored on the device.
Why NAS?
NAS, or Network Attached Storage, is a means of sharing data and files via a network. A typical scenario is the use of a NAS device within a work group as a way to store information which allows multiple protocols access, such as NFS, SMB and AFP. As an example, in our office we work with applications that are specific to Mac or Windows systems that need to share common assets. A NAS is a logical solution that allows for the storage of such assets without the need to maintain a full file server. Even for a home network, a NAS appliance can be a rational location for the central storage of music and video libraries.
Why FreeNAS?
My personal experience started by attempting to use a boxed NAS solution available either on line or from the local computer shop. I found out the hard way that the major brands, while claiming to support OSX, integrate an older version of AFP that does not support long filenames. Being cheap to a fault and having extra Intel PC's hanging around my office, I decided to try out the Appliance Software route. There are other widely used NAS solutions that include 1u or 2u chassis preconfigured that only require adding drives: ReadyNAS looks to be a great solution. My goal was to build a cheap, massive (more than 4 drive) solution using mostly left over parts hanging around. To achieve this goal, FreeNAS fit my needs perfectly. An added benefit of using FreeNAS is that it is open source and can potentially be modified or expanded upon as my business evolves. A proprietary solution inherently lacks this flexibility.
Evolution of Appliance Software
Many specialized tasks have been distilled to a self-contained package of tools bundled with a compact version of an operating system (http://en.wikipedia.org/wiki/Software_Appliance). Appliance Software is perfect for dedicated tasks such as routers, mail servers, database applications, NAS systems and almost any other isolated task imaginable. There are various resources on the Internet for finding Appliance software but one of my favorites is the list hosted by VMWare (currently located at the following URL: http://www.vmware.com/vmtn/appliances/directory/). Appliance software can run the gamut from free open source, to commercial packages that can cost thousands of dollars. FreeNAS is an appliance software package. It is an open source initiative based on the FreeBSD kernel.
Getting FreeNAS
FreeNAS is available on the FreeNAS.org website. In the downloads section of site, there are several choices for versions and formats. Before downloading, it is best to consider how the appliance will be run. For my personal needs, a dedicated PC with a 3ware RAID card and 8 SATA drives is the plan. To save space in the case and avoid the added power demands of a dedicated hard drive for the OS, I've opted to run the operating system from a USB jump/thumb drive. The best option for this type of a setup is to obtain the .iso of the latest build of FreeNAS. Normally for a production environment I'd recommend only downloading the latest 'Stable' version of an open source package. But since FreeNAS is currently still in pre-release (there is no 1.0 version yet), beta is the only option. As with any new technology introduction, standard disclaimers apply: test, test, and test prior to deployment to production!
Target Box
My target machine is a standard Intel based PC with a 3ware 8500 series 8-port SATA card. Except for the RAID card, the PC is built with generic components (including motherboard, processor, ram and NIC). The power supply is 500 watt with lots of drive connectors. I found a 'RaidMax' chassis at a local Fry's store with lots of room for drives and good cooling. For purposes of installing the FreeNAS software, I included a CD-ROM drive in the machine build. The only potential 'gotcha' is the system BIOS will need to support booting from USB if the OS is to be installed on the jump/thumb drive.
Installation and Configuration
Burn a CD from the ISO image you downloaded from FreeNAS.org, and boot the PC from it - set the BIOS of the PC to boot from the CD if you must. The PC should boot with a FreeBSD kernel and detect the hardware connected. After the completion of the boot process, there should be a console setup menu with 9 choices. Insert the target USB jump/thumb drive, the console should return some messages that the drive has been detected. Since we plan to install to the USB drive we select item 9 in the list ('Install to a hard drive/memory drive/USB pen, etc.'). After some warning about erasing data on target drives there should be a submenu of 4 choices. Sub-item 1 will install the FreeNAS using all available space on the USB drive. After selecting a single or two partition install (Sub-item 2), the installer will ask for the location of the source data (the CD-ROM). In my case, device 'acd0' is my source drive. So, I type 'acd0' at the prompt (without the quotes). After hitting return, the installer lists all the potential target drives for installation. In my case, again, device 'da0' is the USB drive, so I type that name at the prompt. After a few minutes, the installation should complete and provide instructions for rebooting the system. The CD can also now be removed. The complete FreeNAS installation consumes less than 40 megabytes so it should fit on almost any spare or unused USB drive.
On the next reboot, the BIOS will need to be tweaked again to set the USB drive as the primary device. After proper configuration of the BIOS, the machine should boot into the FreeNAS OS from the USB drive (if your machine supports doing so). Otherwise, you can always install on a hard drive. When the system is booted, the original 9-item menu should present itself again. The first order of business will be to setup the network. Item 1 in the menu is used to Assign Interfaces. Meaning that if the system will have more than one NIC, this is where they could be set to WAN and LAN. For my purposes, the NAS device will only be used on the local network so I only need to configure a single NIC as the LAN. After assignment of the interface, the system may need to be rebooted. This should be the last reboot until the system needs to be taken offline for maintenance.
We should be back to the 9-item menu. This time select item '2', this is used to assign an IP address to the device. I like to manually assign an IP rather than use DHCP, that way, I can set my local DNS to point directly to the box and assign a name like nas.mydomain.com to the IP. Follow the on-screen instructions to assign an IP and subnet to the LAN. The last task at the console is assigning a webGUI password (item 3). Set an appropriate password by following the on screen instructions.
WebGUI
It's now safe to leave the console and return to a machine running a friendlier interface. From another machine on the same subnet, launch a browser and connect to the IP assigned to the FreeNAS box. An authentication window should be presented. The username is 'admin', the password should be whatever you assigned in the last step at the console. If everything worked correctly, there should be an interface that appears similar to that of figure 1.
Figure 1 - The FreeNAS web console
From this GUI, the appliance can now be configured for the installed drives and how the users on the network will see the drives. The first order of business is to show the FreeNAS OS the drives to share. One of the reasons I like 3ware RAID cards is that support for them is built into the kernel of FreeBSD (and hence into FreeNAS). 3ware has a BIOS-level interface that allows the drives to be configured as a RAID device. In my case, I used that interface to create a 7-drive raid 5 system with one hot spare. FreeNAS sees the 3ware card and all 8 drives as a single disk. From the left navigation tools, select the Disks > Management tool then click on the small plus symbol towards the right edge of the screen to add a drive to be managed by FreeNAS. A subsequent screen will appear that allows selection of all the drives seen by FreeNAS. If there is existing data on the selected drive that needs to be saved, there is an option at the bottom of this subsequent screen to allow selection of the preformatted file system. Be sure to use the 'Apply Changes' button or nothing will be modified.
Of note is that HFS or HFS+ are not options, since these are Apple-centric file systems. If the drives are using HFS or HFS+ and the data needs to be preserved, the drives will need to be backed up from a Mac then restored to the NAS after it has been configured.
Once a disk as been set in the Management panel it can then be formatted using the Disks > Format tool. There are also tools for the creation of Software RAID and data Encryption. In my personal experience, the Software RAID was not reliable and I wouldn't recommend its use for any data that isn't being replicated someplace else. After the Format command is initiated on one of the disks created in the Management section, which might take a few minutes to complete, the webGUI should return a window with the super-block data for the drive. At the bottom of that window (hopefully) will be a 'Done!' message. Using the Disks > Mount Points tool the newly formatted drive should be visible. It should be set with a Share Name.
Using the Access > Users and Groups command first create a Group (from the Group tab at the top of the screen). Then add a user. If your network has an LDAP or AD server, you can point the FreeNAS to that device for a list of users.
The last step in the process is to set up the sharing services. From the Services menu, select AFP (assuming the goal is to put the new NAS device on an Mac network). Click the 'Enable' checkbox in the upper right corner. Then assign a name to the server. Set the Authentication as appropriate. Don't forget to click the 'Save and Restart AFP' button.
Test the box by using the Finder > Go > Connect to Server menu and connect to afp://111.111.111.111 (substituting the IP address assigned to the FreeNAS device). If all went well, a standard OS X authentication will appear. The user name created in the webGUI should allow mounting of the shared drive.
Now What?
The beauty of FreeNAS solution is the unlimited potential to customize the device. There is no reason the kernel or installation environment could not be hacked to install almost any tool available in the FreeBSD ports collection. Some examples relevant to the example system would be installation of the 3ware command line tools to administer the RAID device. To be truly fancy, a full version of Apache could be installed and add the 3ware web administration tool. Ideas I've had, but haven't had the time to execute, would be to create an asset browser for image viewing on the network, or adding a subversion control database to the NAS for collaboration and project management.