User Tools

Site Tools


XigmaNAS Guide for creating an iSCSI target from a ZFS volume

My Setup

Here is my current setup: Intel(R) Core(TM) i7 CPU 960 @ 3.20GHz. 512MB of RAM. 4 x 2TB Hard drives. Running NAS4Free Sandstorm - Beta (Revision 49) from VMware Workstation.

My 4 x 2 Terabyte drives are in no HARDWARE RAID configuration. This is important as ZFS employs its own RAID structure in its file system so the Mother Board BIOS had its RAID settings disabled (this is what worked for me).

Adding Discs to XigmaNAS

1 - Pull down the “DISKS” Menu from the top navigation bar and then select “MANAGEMENT”. See SUG Section 5.1 - Disks Management for details.

2 - Click the Plus sign “+” this will load up the Disk Add Page.

3 - Using the drop down Menu, select the drive you are adding.

4 - Give it a Description

5 - I left the following settings in their default positions, but depending on your configuration you can change them.

  • A - Transfer Mode at Auto.
  • B - Hard Disk Standby Time to “Always on”.
  • C - Advanced Power Management to “Disabled”.
  • D - Acoustic Level.
  • E - S.M.A.R.T NOT Ticked.

6 - Preformatted file System was left to Unformatted. By setting this to Unformatted we can use the format option in NAS4Free.

7 - Click the “ADD” Button.

8 - Click the “APPLY CHANGES” Button.

I repeated this process (steps 2 – 8) for the remaining three drives. I DID NOT ADD MY USB stick as this holds the NAS4Free OS and I don’t want that to be formatted by ZFS etc.

All drives should now appear in the disc Management Page. All Drives should have a “STATUS” of “ONLINE

Formatting Drives

When all the drives are added I now format them into ZFS.

1 - Pull down the “DISKS” Menu on the top Navigation Bar and select “FORMAT”.

2 - Select Drive which should now appear in the dropdown.

3 - Select ZFS Storage Pool Device for the File System.

4 - I erased my MBR so left the “Don’t Erase MBR” Setting UNCHECKED.

5 - Click the “FORMAT DISK” Button.

Repeat steps 2-5 for all additional drives that you have.

Pull down the “DISKS” Menu on the top Navigation Bar and then select “MANAGEMENT” again to check that the formatting of all drives was successful.

Creating a ZFS Virtual Device.

Once you have gotten NAS4Free to recognise, format and present your drives in the WebGUI, you will now proceed to create a virtual device consisting of these drives.

1 - Go to “DISKS” Tab at the top navigation bar and then select “ZFS”.

2 - Click on the “Virtual Device” Tab.

3 - Click the Plus sign “+”.

4 - Enter a Name (I called mine VD01).

5 - Select a Type (I personally selected Single Parity Raid 5 which is RAIDz1 in ZFS speak).


7 - I didn’t select Advanced Format.

8 - Enter a Description.

9 - Click the “ADD” Button. After clicking the “ADD” Button you will be returned to the Virtual Device page in ZFS.

Now the drives have been added to NAS4Free they still have to be made available for NAS4Free to manage.

Pull down the “STATUS” Menu on the top navigation bar and select “SYSTEM”, you will see the Disc you have been setting up are still not here “No Disc Configured”.

Adding device to ZFS Management page

1 - Pull down the “DISKS” Menu on the top Navigation Bar and select “ZFS”. This will load up the management page.

2 - Click the Plus sign “+” .

3 - Enter a Name ( I gave mine the exact same name as what I gave the Virtual Device: VD01)


5 - I kept these options as default:

  • A - Root.
  • B - Mount Point.

6 - I entered a name for the Description. Click the “ADD” Button. You will then be returned to the Management Page.


7 - Click the “APPLY CHANGES” Button!

8 - Now all the values should have changed and the virtual device is now online. Just to make sure, Pull down the “STATUS” Menu on the top navigation bar and select “SYSTEM”, you should now see the Disc.

9 - Take note of the FREE space! You will need this value for later.

Create an iSCSI target

Now with the disc managed and configured correctly in ZFS we are now going to create an iSCSI Target.

1 - Pull down the “SERVICES” Menu on the top Navigation Bar and select “iSCSI target”.

2. Click the “ENABLE” checkbox for iSCSI Target in the upper right corner of the page.

3. Leave everything else alone, change nothing.

4. Click the “Save and Restart” Button.

Adding a Portal

This will allow you to configure how the iSCSI target will be seen or reported on the network.

Now click the “PORTALS” tab.

1 - Click the Plus sign “+”.

2 - For the benefit of this document I left it at its default which is to allow it to be accessed VIA any IP address that the NAS4Free server is configured with.

3 - Click the “ADD” Button.

4 - Click the “Apply Changes” Button in the Portal Group Page.

Adding an Initiator

Initiators are systems that can access an iSCSI target (in this case the ZFS storage we created above) here you can specify which machines via IP can initiate a communication with the iSCSI target.

1 - Click on the “Initiators” Tab.

2 - Click the Plus sign “+”.

3 - Here again I left all settings at their defaults and clicked the “ADD” Button. (Anything can access it).

4 - Click the “Apply Changes” Button.

Create an Extent

To create an iSCSI Target you must create an Extent first.

1 - Go to the “Targets” Tab.

2 - Click the Plus sign “+” for creating an Extent.

3 - Give the Extent a name I left mine as “extent0”.

4 - In 0.7.2 of NAS4Free with ZFS the “TYPE”, “ZFS Volume” option in the Drop-down Menu did not work for me! SO KEEP IT AS “File”.

5 - Click on the Button at the end of the Path text box. This will bring up a simple file system browser. Since we cannot use the ZFS volume, we have to point to the correct directory and create a file which will essentially be the drive you will be writing to.

6 - Earlier we created a device called VD01 which is presented here as a folder. Select VD01 or the name of your Virtual Device.

7 - This will change the path from /mnt/ to /mnt/VD01/ in the address bar at the top. Click the “OK” Button once you have selected the path.

This will appear in the Target Add page.

8 - Add to the path field “extent0”

9 - File Size: Here is the big problem DO NOT USE AUTO it does not work with ZFS. You will get an:

Error: The changes could not be applied (error code 1).

message later on when trying to “Apply Changes” and in the logs (Top Pull Down Menu Diagnostics > Logs) you will get messages such as:

 Apr 4 15:13:37  nas4free  root: Failed to restart service iscsi_target 
 Apr 4 15:13:37  nas4free  istgt[19293]: istgt.c:1618:main: ***ERROR*** istgt_lu_init() failed 
 Apr 4 15:13:37  nas4free  istgt[19293]: istgt_lu.c:1863:istgt_lu_init: ***ERROR*** lu_add_unit() failed 
 Apr 4 15:13:37  nas4free  istgt[19293]: istgt_lu.c:1604:istgt_lu_add_unit: ***ERROR*** LU1: LUN0: Auto size error (/mnt/VD01/extent0) 
 Apr 4 15:13:37  nas4free  istgt[19293]: istgt version xxxxxxxxxx (xxxxxxxx) 
 Apr 4 15:13:37  nas4free  istgt[19165]: istgt version xxxxxxxxxx) exiting 

You must put in an approximate size. So do you remember earlier, when I asked you to note down the free space in the Status System Page?

Here I have 5.34T which is 5.34 TB of free space, this is what we will present to the iSCSI Initiators as free space.

10- In “File Size” as it only accepts whole numbers and no Decimal points, enter the value as a whole number with the correct units attached. I cannot add 5.34TB so I added 5468GB (5.34 x 1024(number of GB in a TB), I might lose a tiny bit of space but for this document I will allow it.

11- Add a comment, then click the “Save” Button

12- Click “Apply Changes” on the Services| iSCSI Target | Target page.

Adding a Target

All that is left is to add a target.

  1. Click the Plus sign “+” to add a target.

  1. Give it a Target Name if you want to, I called mime LUN0 or you can leave it as disk0.
  2. Leave all settings at their defaults and click the “ADD” Button at the bottom.

  1. Click the “Apply Changes” Button.

That is it! All that is left is connecting to the iSCSI Target. There is a wealth of information on this, so I will leave you to Google that one.

Cheers again.


YouTube: Preview of ZFS on FreeNAS 0.7 Server : Author - learnfreenas (Gary Sims)

Articles: Setting-Up iSCSI Drives Using FreeNAS : Posted by Oliver Hewitt

documentation/howto/create_iscsi_target_from_zfs_volume.txt · Last modified: 2018/07/13 02:56 by zoon01

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki