Saturday, January 16, 2010

Howto: Create 'LiveCD' (ISO) file of FreeNAS

1. Presentation

I'm using the embedded version of FreeNAS that I'm starting from an 512Kb USB-stick. I found out that you can install packages with the LiveCD full install, but ofcourse not with the embedded version.

Last December (27/12/2009) I wanted to have an upgrade of my Transmission package in FreeNAS. The latest build contained Transmisson 1.72 and I wanted to upgrade to Transmission 1.76. At that time the latest stable version was 0.7 (from 6/11/2009) and the latest nightly build was version 0.7.1 (from 15/12/2009). Due to the openness of the FreeNAS project (many credits to the FreeNAS team) I thought that it shouldn't be too hard to make my own build.

It took some time, but I got it working. Although when I finished the new nightly build already contained Transmission 1.76 (FreeNAS 0.7RC2 from 5/1/2010). Yet I wrote this howto which may help others.

For this howto first looks at parts of http://freenas.org/documentation:howto:installing_freebsd_under_qemu_for_compiling_freenas by Oliver. Especially these sections are useful: Section 4. FreeBSD Installation and 5. Finalising installation. I will recap sections 4 and 5 and will continue where section 6. Compiling FreeNAS left of.

2. Recap FreeBSD Installation
Download and Install FreeBSD 7.2 and select the express install option.

When finished install the following packages: bash, cdrtools, subversion and portupgrade. You need cdrtools to be able to run the sysutil mkisofs and you need subversion to retrieve the sources.

Login with root rights and type: sysinstall.

Now choose Configure and select Packages:

 
And choose your installation medium (1 CD/DVD).



Now select the necessary packages. Choose bash, cdrtools, subversion and portupgrade like below.

Now install the packages.

3. Compiling FreeNAS

3.1 Getting the sources
Login with root rights and do the following commands to get the sources.

mkdir /usr/local/freenas
cd /usr/local/freenas
svn co https://freenas.svn.sourceforge.net/svnroot/freenas/branches/0.7 svn

We choose the 0.7 branch which contains the latest updates. The trunk tree is too experimental and doesn't compile at the moment. When subversion finishes do the following commands.

cd /usr/local/freenas/svn/build
./make.sh

The following compilation menu is presented. You can select menu item 2 - Build system from scratch.

3.2 Build system from scratch

Start with 1 - Update source tree and ports collection. Choose cvsup and wait as the source tree for the kernel is checked out (this may take some time).


And wait until the checkout has finished succesfully.


Now do the same with freebsd-update, portsnap and portupgrade.

After this choose 2 – Create filesystem structure and 3 - Build kernel and process prebuild, build and install. With prebuild choose all kernel patches. Then choose 4 - Build world.

Leave the menu and  run the command: portsnap extract. Now select menu item 5 - Build ports, however I encountered the following failed ports, which you may need to deselect: inadyn-mt, rsync, scponly. Edit 11/1/2010: The failed ports have been resolved by the FreeNAS team now.

Now install ports and also deselect the failed ports. Continue choosing 6 - Build bootloader and 7 - Add necessary libraries and 8 - Modify file permissions. Then choose * - Quit and go back to the main menu.


3.3  Create 'LiveCD' (ISO) file
Now the system building is finished. From the menu choose 11 Create 'LiveCD' (ISO) file.

In the directory /usr/local/freenas there are two new files now. The FreeNAS-i386-LiveCD.. and FreeNAS-i386-embedded... files. The LiveCD file can be used as an image or can be burned on a CD and the embedded file can be used in FreeNAS under System|Firmware to upload and use as new version to run your FreeNAS server.

NAS/FreeNAS running for a year now

My NAS server has been running for a year now. The system is build into a modded case with a green radioactive logo (see below). These are the other hardware components:

CPU: AMD Sempron(tm) Processor LE-1300
Motherboard: ASUS M3N78-VM AM2+/AM2 NVIDIA GeForce 8200 HDMI Micro ATX
Memory: 1GB Kingston (kit of 2x512MB) KHX6400D2LLK2_1G
Harddisk: 1TB Samsung HD103UJ
PSU: standard noname 350W

The power usage is on average 56 Watt. It is configured with Wake-On-Lan and it is additionally scheduled to start at 10:30 and stop at 23:30 to save costs of electricity.

I have installed FreeNAS and the system boots from a 128KB usb-stick. This is the latest welcome screen.