How to Make a FreeNAS Box
Pox and Ragble give an in depth guide for making your own Network Attached Storage device.
FreeNAS Install
Check Hardware Compatibility List
Don't make the assumption that your hardware will work under FreeNAS. Take the time and verify all necessary components of your system are supported.
First, check the HCL on the FreeNAS site:
http://www.freenas.org/index.php?option=com_openwiki&Itemid=30&id=freenas_users_hardware
Secondly, search around the forums for your specific piece of hardware you're checking and see if anybody else is having problems.
Lastly, search around Google the same way but with FreeBSD or FreeNAS attached at the end of the search string.
Parts we used from NewEgg:
1 |
Intel BOXD945GCLF Intel Atom processor 230 Mini ITX Motherboard/CPU Combo |
$64.99 | ||
1 |
SYBA SD-CF-IDE-DI IDE to Compact Flash Adapter ( Direct Insertion Mode ) |
$6.99 | ||
2 |
SAMSUNG 500GB 3.5" SATA 3.0Gb/s Internal Hard Drive |
$99.98 | ||
1 |
IN WIN BP655 Black Computer Case |
$39.99 | ||
1 |
SanDisk Ultra II 2GB Compact Flash (CF) Flash Card |
$14.49 | ||
1 |
Kingston ValueRAM 512MB 240-Pin DDR2 SDRAM DDR2 400 (PC2 3200) System Memory |
Taking this time will save you from potentially head wrenching headaches later on.
Install Points
An install point is where the embedded OS will reside that hosts the configuration file. Upon boot everything is loaded into a RAMdisk and only changes to the configuration file are written. This is ideal for a CF card as it minimizes writes and prolongs the life of the card. There are several choices for an install point. The following are recommendations.Recommended:
- USB stick
- CF Card
HDD install is not recommended for the following reasons:
- Partitioning of data drives is messy
- HDD replacement is messy
- An install HDD requires another bay, which are limited in a slim PC case
Advantages/Disadvantages Of Install Points
- Cheapest solution
- Easiest install
USB Stick Cons:
- Potential loss of configuration due to loss of USB stick
- NOTE: This can be alleviated with the use of a USB pin header to Type A adapter for $15
- Integrated and permanent
- Larger storage capacity
CF Card Cons:
- DMA adapters/cards are expensive
- Non DMA adapters/cards require complex install process
- Potential for adapter+card being taller than case
- Cheaper Non DMA cards are still more expensive than a USB adapter
Deployment Methods
- Install via LiveCD with CD/DVD drive
- If you don't have an existing internal/external CD/DVD drive this adds $20 to project total
Write image file to install point
- If you don't have a CF reader already, this can add around $10 to project total
USB Stick Installation
This is the easiest installation method, and the cheapest. However, loss of USB stick is a loss of the configuration file.
Firstly, determine the deployment method:
- Boot off of a LiveCD is the easiest and quickest way
- Requires an external CD/DVD drive
- Or your case has a full sized for a CD/DVD drive
- Or your case has a bay for a slim CD/DVD drive
- NOTE: Adding a drive may increase the cost, but it makes the install much easier now, and in the future.
Write image file to the USB stick
- Working method requires Windows machine or virtual install
LiveCD Install
- Download LiveCD install from FreeNAS (http://www.freenas.org/index.php?option=com_versions&Itemid=51)
- Configure BIOS to boot off DVD/CD drive
- After booting type 9 to select Option "9" to install FreeNAS
- Type 1 to select Option "1" to install on USB Stick
- Select the Source CD drive (e.g. acd0)
- Select da0
Write Image File
- Download IMG file from FreeNAS (http://www.freenas.org/index.php?option=com_versions&Itemid=51#FreeNAS%20Images)
- If on Linux or Mac install and setup a Windows Virtual machine with Parallels or Vmware Fusion
- Download physdiskwrite (http://m0n0.ch/wall/physdiskwrite.php)
NIC Support Install
If you manage to end up with a board with an embedded chipset not supported under FreeNAS, but is still supported by FreeBSD then you'll have to manually copy over the necessary kernel module and add a PostInit command to have it loaded.When checking compatibility you should check across the two available versions of FreeNAS; one is based on FreeBSD 6 and the other FreeBSD 7. In the instance of the chipset on my Intel Atom (RTL8102EL) the driver worked under version 6 of FreeBSD, but not 7.
A compile version of the RealTek kernel module is available through this forum post:
http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=9&t=192&hilit=realtek+kernel+module
If in the situation there is no support for your embedded chipset in FreeBSD, you'll have to find/buy a supported NIC. If you purchased a micro case then you'll have to make sure the NIC includes a low-height faceplate.
Options to transfer Kernel Module to Install Point.
- Upload via a service on the FreeNAS box (FTP, SMB, etc.)
- Transfer directly to the install point through a FreeBSD LiveCD
Upload via FreeNAS
NOTE: This requires a spare NIC on hand that is supported in FreeNAS.Configure Network
- Plug in the spare NIC. You may have to take off the faceplate of the card if your case doesn't support a full-height faceplate. But don't worry, it's only temporary!
- Start up FreeNAS
- Type 1 to select option "1", "Assign Interfaces"
- The NIC we just plugged in should be listed and highlighted, press Enter
- Select "none finish and exit configuration" as we don't need an optional name
- A summary screen will show the interface being assigned to the LAN, select Yes and press Enter
- Back at the menu type 2 to select option "2", "Set LAN IP address"
- If you have DHCP enabled on your network (most likely), select "Yes"
- If not, then you'll be guided through a few screens asking for basic IP information. If you're not running DHCP then I'll assume you know what this is all about.
- The only "gotcha" is that the subnet mask is asked for in bits. For a typical home network this is 255.255.255.0 which is 24 bits
Select "No" to skip configuration of IPv6
The network now has a basic configuration and the Web UI can now be accessed.
Configure Share
Configure FreeNAS to Load Module at Run time
FreeNAS System Configuration
- Access the WebUI using the IP address reported when the LAN interface was configured.
- The default username and password is: admin/freenas
- The left hand side is the navigation for all the configuration options in FreeNAS. The right hand side is for viewing and updating the settings for an option.
- Change the default username and password.
- Click the System->General link in the Navigation side of the WebUI
- Type in a new admin user name
- Type in a new password and verify
- Click the "Apply Changes" button
Set up a RAID array
- NOTE: BEFORE AN ARRAY CAN BE SETUP DISKS MUST FIRST BE ADDED TO MANAGE
- NOTE: TO KNOW WHICH DISK TO SELECT USE TABLE 1 ON FREEBSD DEVICE NAMING
- Add Disks
- Click the Disks->Management link in the Navigation side of the WebUI
- Click the "plus" graphic image to add a disk
- In the "Disk" drop-down box, select the first HDD (See above NOTE)
- Leave other options at their defaults
- Click the "Add" button
- Repeat steps 4 and 5 for the number of HDDs in the system, probably 2 or more.
- After all devices have been added, click the "Apply Changes" button at the top of the "Disks: Management" screen.
Format the disks
- Click the Disks->Format link in the Navigation side of the WebUI
- In the "Disk" drop-down box select the first HDD to format
- In the "File System" drop-down box select "Software RAID"
- Click the "Format disk" button
- Repeat this step for all disks to be added to the RAID array
Create the Software RAID Array
- Click the Disks->Software RAID link in the Navigation side of the WebUI
- Click a tab along the top to select a RAID configuration setup. In our instance, we're doing a RAID 1 (Mirror) so we click on Geom Mirror
- Click the "plus" graphic image to add an array
- In the "Raid name" textbox give the array a meaningful name
- Check the boxes next to each drive listed. It will only list the disks formatted as "Software RAID"
- Click the "Add" button
- The array has been added, click the "Apply Changes" button
- The array will now start to be initialized
- NOTE: DEPENDING ON THE SIZE AND TYPE OF RAID ARRAY, THIS CAN TAKE A WHILE. H-O-U-R-S
- NOTE: EVEN DURING A BUILD FREENAS DOCUMENTATION STATES THAT THE ARRAY CAN STILL BE USED. WTF?!
Format the RAID Array
- Make sure the status of the array is "Up" or "Rebulding"
- You can check this under the "Disks->Software RAID" link, the array will be listed with the status to the right.
- The page does not auto-refresh, so you'll have to manually refresh the page to get the latest status of the array
Click the Disks->Format link in the Navigation side of the WebUIThe RAID array should now be listed in the "Disks" drop-down menu, select it.Leave the "File System" option at the default of "UFS"Click the "Format Disk" buttonCreate a Mount Point: this mounts the volume within FreeBSD which will enable it to be visible to the system
- Click the Disks->Mount Point link in the Navigation side of the WebUI
- Click the "plus" graphic image to add a mount point
- In the "Disk" drop-down box select the RAID array
- In the "Partition" drop-down box select "EFI - GPT"
- In the "File System" select "UFS"
- In the "Share Name" text box give the mount point a meaningful name
- In the "Description" text box you can elaborate on the share name and purpose further’
- Click the "Add" button
- Click the "Apply Changes" button
Configure a Service: this will enable a mounted drive/array to be visible across the network
- Since SMB is lowest common denominator for a mixed environment, it's the safest one to setup
- Click the Services->CIFS/SMB link in the Navigation side of the WebUI
- If you have an existing NetBIOS network in place:
- Give a more meaningful NetBIOS name for your FreeNAS box if you wish to in the "NetBiosName" text box
- Change the "Workgroup" text box to match the name of your network
- Click the "Save and Restart CIFS" button
Click the "Shares" tab to go to the share management pageClick the "plus" graphic image to add a share
Table 1. Disk Naming Convention in FreeBSD
-
/dev/ad0 : Is the First ATA hard drive on the ATA channel 1
-
/dev/ad1 : Is the Second ATA hard drive on the ATA channel 1
-
/dev/ad2 : Is the First ATA hard drive on the ATA channel 2
-
/dev/acd0: Is the first ATA CD/DVD drive detected
-
/dev/da0: Is the first SCSI hard drive. USB key device under FreeBSD are using an SCSI driver, then this name can link to your USB key/drive too.
-
/dev/da0p1: The ‘p’ represents an EFI/GPT partition type, and ‘1’ represents the first partition on the device. This is the new standard starting from version 0.684
-
/dev/da0s1: The ‘s’ represents the old standard partition type. For any filesystem other that UFS you should look for an ‘s’ type partition.
-
/dev/raid5/RAIDname: ‘RAID’ is only the array device.
-
/dev/raid5/RAIDp1: This is the filesystem on the RAID device.