/!\ Article in progress, not yet finish /!\
As I needed to create a iSCSI share for some VM on a private subnetwork, instead of using a simple NFS server configuration, I was looking to test a NAS distribution. I saw on Internet two different distributions, one based on OpenBSD named FreeNas (here in version 8), the other based on Linux OpenFiler (here in version 2.99). I will test both for creating this share.
FreeNas
FreeNas is a small distribution based on BSD with a configuration based on a well developed web interface. It’s light, it is working well and the interface is easy to understand even if you need to have some knowledge about system and NAS to correctly configure it. I hope this tutorial will help you that way. The version I tested is the 8.0.3.
One of the advantage of freenas is that it is supporting iSCSI to share block device over the network. It also support ZFS.
Installation
The installation iso is about 100MB so download is fast.
Installation is really simple, just have to put the CD in the virtual drive and boot. The process is basically to click on Next each time and wait for installation process to be done.
The VM handling the system is a 512Mb VM with a logical drive on file having 4Gb for the system and a second drive used to create the shares.
Once started, the following screen will proceed the installation once chosen the target drive:
This has taken about 30 minutes on my virtual environment.
Configuration
Configuration is easy, once boot for the first time, the console allow to configure the network and the WebUI credentials in text mode. Configuration is easy. Then reboot
All the advance configuration will be perform using the WebUI.
http://10.0.2.5/
Default login / password is admin/freenas
Configuration to create an iSCSI share
We have initially created 2 drives in the VM, one for the system and a second for the storage. Now we have to Add this volume by going to the following menu and click on Create Volume.
Name the volume as you want, here it is volume1, select the associated HD, here the second virtual HD we have previously created within the VM.
Choos ZFS filesystem type.
Click on Add Volume button and wait for its creation.
Now we can create a Sub ZFS volume in this volume to split it in different subvolume for the different block device we want to export. We are going to create a 5GB volume.
Click on the Create ZFS Volume menu entry.
Select the previously created Volume as a parent volume for this ZFS one.
Name it as you want here I choose block1.
Enter the size you want, here 5GB.
Then click on Add ZFS Volume button.
After the creation, your configuration should look like this.
Now we can start the iSCSI configuration. The first step is to start this service by clicking on the associated button in the Control Service menu.
If you see ON, it means the service is started.
We will, now configure the iSCSI service. We will configure it to not required any authentication. To get the error message in case of misconfiguration, you can go to settings and active a console in the web page. This is useful for debugging.
Set a base name following the iqn norm. Here I chosen iqn.2012-08.com.disk91
Because 2012-08 is the date and disk91.com is my domain.
Discovery Auth Method is set to None as Discovery Auth Group.
Other settings are left unchanged
The Controller Auth Method, as the Controller Auth Group are set to None
Other fields should be left unchanged.
Click on Save
Then go to Portal submenu and add a new portal like this :
Then go to Initiator submenu and add a new Authorized Initiator. (Rq : in the iSCSI norm an Initiator is a client – a server). This one is open for ALL, you can eventually restrict to certain server or network.
Then go to Target submenu and add a new Target. (Rq : in the iSCSI norm a Target is an object shared – a block device).
The target name follow the iqn norm, here it is :
iqn.2012-08.com.disk91:storage.disk1
The target alias is Target1, this name will be used as the iqn on the client side to identify the block device imported.
The type is Disk
The portal and initiator are the one previously created.
No Auth Method is used.
Now we need to create a Device Extents, this is to link the ZFS block device we have created as an iSCSI extents. Click on add on the submenu with this name.
Name the extent as you want, here I chosen block1 as for the ZFS volume.
Use the comment you want, here I chosen to note the size of the volume
Select in the list the ZFS volume created previously.
To finish we need to link the Target created with the Extent created. Go to Target / Extents submenu and click on Add.
Select the target previously created
Select the extents previously created
Click on OK
Now, the iSCSI block should be ready to be used from another machine. For the test, i used a MAC OS X machine where I installed globalSAN software.
Create a new Target using the iqn given previously to the block device.
Add the address of the server and standard port.
Change the iSCSI Options to set like in the screen capture.
Then connect to the Target.
At this point, the Mac should detect a new device and propose to initialize it … in this case, it looks good !
Configuration to create a NFS share
The first step is to go to Control Services to enable the NFS service.
The second step is to Add NFS Share. Click on the button in the menu.
Add the comment you want
Browse to get the path, choose /mnt/volume1 is good
All all you network to access it by setting something like 10.0.2.0/24
Then click OK
It is now possible to test this share by mounting it on a client PC with a command like mount -t nfs 10.0.2.5:/mnt/volume1 /mnt
OpenFiler
OpenFiler is a linux distribution. The installation iso is about 500MB.