Operating Systems‎ > ‎Linux‎ > ‎


From MaximumPC

How To: Build A NAS Box

Posted 09/26/08 at 11:00:00 AM  by Michael Brown

How To Build a NAS Box Opener

Crush the performance of consumer network-attached storage devices by building your own! And you can use a number of legacy parts to do this on the cheap!

Time: 3 Hours

What You Need

A network-attached storage (NAS) device is the Robin to a LAN’s Batman. The two should be inseparable, and for good reason. A NAS box gives you a guaranteed way to store all of your files and stream your media. Running a NAS box also means that you don’t have to boot your power-leeching desktop rig every time you want to access your files from another device.

But you don’t have to go out and purchase a NAS device. You can build a superior alternative using spare parts left over after upgrading your PC.

We recently gathered a bunch of components that had been gathering dust in the Lab and built a FrankenNAS that absolutely pulverized its admittedly budget retail competitor, the $135 Linksys NAS200. Using an Asus A8N32 SLI Deluxe motherboard and a dual-core 2.6GHz AMD Athlon 64 FX-60 CPU, we were able to shorten our transfer speeds to one-sixth of the NAS200’s on small transfers and around one-seventh on larger file moves. Note that you don’t even need top-of-the-line hardware for your device. Our open-source operating system, FreeNAS, will run on almost anything.

But just because it’s free doesn’t mean it’s simple. So we’re going to walk you through the finer points of setting up a FreeNAS-based network storage device of your very own. You’ll be streaming your favorite movies in no time!

1.Burn the FreeNAS ISO to CD

Step One

The first step in the process is building the physical NAS box, but since it’s no different from assembling a PC, we’re skipping ahead to the installation of the operating system. In order to do that, you’ll first want to set your NAS motherboard’s BIOS to boot from an optical drive.

FreeNAS is based on FreeBSD, a Unix-like open-source OS developed in the early 1990s. It’s not Linux and it’s definitely not Windows, so you should be aware that using the OS as the backbone of your file storage is going to first wipe out anything that might be on the hard drives you use. On the upside, FreeNAS itself requires no hard drive space for installation. It’s so compact, we’ll be using an embedded version that can run off a USB thumb drive or a CompactFlash card as small as 32MB.

Download the FreeNAS ISO and drop a CD in your burner. If you don’t already have software capable of burning an ISO image to a CD, download and install the free utility ISO Recorder. If you’re using ISO Recorder, right-click the file you just downloaded and choose the option “Copy image to CD.”

Once you’ve burned the image, put the CD in your NAS box’s optical drive, restart your computer, and boot FreeNAS from the CD. One caveat: Make sure your motherboard’s BIOS is configured to boot from a USB device, as we’ll be installing the operating system to a thumb drive.

2. Install FreeNAS on a USB Thumb Drive

Step 2

We’re going to set up our NAS to boot from a USB thumb drive so we don’t limit our upgrade options. If you didn’t listen to us in the last step and are using an old mobo that just won’t boot from a removable device, you have two options. You can boot from the CD and store your configuration file on a USB thumb drive or CompactFlash card or you can partition your hard drive, copy the OS to that partition, and boot from there. Be aware, however, that you cannot use the resulting storage partition for RAID: FreeNAS allows only whole drives in an array.

Quick Tip: Double-check whether FreeNAS offers support for your hardware by checking the compatibility lists at http://www.freenas.org/index.php?option=com_openwiki&Itemid=30.

When the FreeNAS Console Setup menu appears (tap the Escape key if the FreeNAS splash screen doesn’t disappear on its own), plug a thumb drive into the NAS box’s USB port and choose the menu item “Install/Upgrade to a hard drive/flash device, etc.” At the next prompt, choose the first option: “Install ‘embedded’ OS on HDD/Flash/USB.” Choose the optical drive containing the FreeNAS ISO image and hit Enter. Next, select the USB thumb drive on which you want to install the OS. Note that the installation process’s default choice is the hard drive, so make sure you’ve changed it to your thumb drive before you hit the Enter key.

After you’ve installed the operating system on the thumb drive, remove the CD and reboot your NAS box.

3 Configure Your Network Settings

Step 3

When your NAS box has rebooted, choose item 1 from the Console Setup menu: Assign Interface. Unplug the NAS box’s Ethernet cable and choose the OS’s Auto Detection option. When prompted, plug the Ethernet cable back in and hit the Enter key. You should get a message that reads “Detected link-up on interface XX,” where “XX” is the name of your Ethernet interface (in our example, the name was “nve0”). Hit the Enter key again.

The next screen will read “Configure OPT interface.” This enables you to configure a second Ethernet port, assuming your motherboard has one. For now, choose the option that reads “Finish and exit configuration” and hit the Enter key. Accept the naming scheme presented in the next screen and hit Enter.

Next, type the number 7 and hit Enter to reboot the computer. When the machine has finished rebooting, choose item 2 from the Console Setup menu: Set LAN IP Address. The OS will ask if you want to use DHCP. Choose Yes unless your network is set up with static IP addresses. At the next prompt, select “AutoConfiguration for IPv6.”

The OS will then give you the IP address that’s been assigned to the NAS box. You can now ping your NAS box to verify that it has joined your network and you can manage its settings using your web browser. Just type the NAS box’s IP address into your browser’s address bar. The default user name is “admin” and the password is “freenas.”

4. Configure Your Drive

Step 4

Once you’ve logged into the web GUI, you’ll want to take a whack at a few important configuration steps: Change the name of the NAS; set the correct date, time, and time zone; and create a unique username and password. Start by clicking General (in the left-hand menu stack, under the System heading) and change the desired information in the large pane on the right.

Click the Password tab, type in the existing password (“freenas”), and enter your new password in the two boxes provided.
You’re now ready to prepare your hard drive. Go back to the left-hand menu and choose Management under the Disks heading. The plus sign inside the circle on the right-hand pane indicates that you can add an element to the NAS. In this case, we’re going to add a hard drive. Click the plus symbol and all the drives in your system (including the optical and USB thumb drive) will appear in the window next to the Disk heading. Be sure to choose your hard drive.

You might want to experiment with some of the options on this page (especially “hard disk standby time,” “advanced power management,” and “acoustic level”), but leave them at their default values for now. Do make sure that the value for “Preformatted file system” is set to “unformatted” before you click the Add button; then click Apply Changes.


5. Format and Mount the Hard Drive

Step 5

Ready to wipe your drive? Return to the Disks heading in the left-hand column of the NAS box’s administrative options and click Format. Make sure you’re ready to proceed, as the option will erase any information previously stored on the drive. Choose your hard drive from the drop-down menu, enter a volume label, and accept the remaining default choices: “File System: UFS (GPT and Soft Updates),” “Minimum Free Space (8),” and “Don’t Erase MBR (unchecked).” Click the Format Disk button.

A drive must be mounted before it can be accessed, so go back to the left-hand Disks menu and click Mount Point. Click the circled plus sign, select Disk from the drop-down Type menu, and choose your hard drive from the drop-down Disk menu. Choose EFI GPT from the Partition menu and UFS for the File System value. Click the Add button when you’re finished. An OK message in the Status window indicates that the drive was successfully mounted.

6. Enable Services and Create Shares

Step 6

We need to access our NAS box using computers running Windows, so it’s essential that we enable the SAMBA networking protocol on our NAS box. Look in the left-hand column for the heading labeled Services and click the CIFS/SMB menu item. Place a check mark next to Enable in the main window but leave all the values at their default settings. Click the Save and Restart button.

Now that SAMBA’s up and running, you’ll need to create one or more network shares that allow your remote computers to treat the NAS box’s hard drive(s) as though they’re a local resource. Click the Shares tab in the “Services: CIFS/SMB: Settings” window and click the circled plus button. In the screen that appears next, give the share a name, add a comment describing the purpose of the share, set the path, and click the Add button. Click the Apply Changes button on the next screen.

When you’ve finished configuring FreeNAS, click the Backup/Restore button to create a backup of your configuration. You should now be able to find your NAS and your newly created shared folders listed in Windows XP’s “My Network Places” (or Vista’s “Network”).

How to Stream from Your NAS Box

Now that your new NAS box is ready to go, getting all your movies and photos to stream to your media device of choice is extraordinarily easy. Here’s how you do it. Pull up your FreeNAS administrative options page and click UPnP under the Services menu. Click the Enable check box and assign a name to your device. Then select the NIC you’ll be using. Add the directories you want to share and pick a component profile that best matches your UPnP device—like your Xbox 360, for instance. Click Save and Restart, and you’ll be ready for some movie-watching!