Today, I’m going to guide you through the process of creating an iSCSI target / extent on FreeNAS-9. This will also work on previous versions of FreeNAS, such as version 7 and 8. There are a few different ways you can go about creating an iSCSI share. You can dedicate an entire device (Hard drive, or RAID array) to the iSCSI share, or you can simply create a Volume, and create multiple iSCSI shares and each is simply a file on the volume. This approach works well because you can use part of a volume as an NFS share, part of it as a CIFS share for Windows, and if you want a few separate iSCSI targets you can just create a single file for each. Lets get started.
How to create an iSCSI Target / Share on FreeNAS
First, we need to add a volume using your hard drive or RAID array that is connected to your FreeNAS server. If you have already done this, you can skip this step. Let’s get started with the rest.
Log into your FreeNAS web interface, and go to Storage > Volumes > Volume Manager. Fill in a volume name (make sure it starts with a letter, and NOT a number, otherwise you will get an error). Add one or more of your Available Disks (by clicking the + sign). Select a RAID type if you wish to do so. In my case, I’m using hardware RAID, so I will leave the default (single drive stripe, IE, JBOD). Now click Add Volume.
Now that we have added a volume, we can begin the process of creating an iSCSI share. This process required multiple steps, in the following order:
- Add a Portal
- Add an Initiator
- Add a Target
- Create an Extent (the file that corrasponds to the iSCSI share)
- Link the Target and the Extent together
- Start the iSCSI service
Lets get started. Navigate to Sharing > Block (iSCSI) > Portals > Add Portal. Give it a name in the Comment field, then be sure to select the IP address of your network adapter. If you are using a separate network for storage traffic, be sure to select it. Otherwise, select the IP of the FreeNAS server. Go ahead and click “OK” after doing so.
Now we will add an initiator. Navigate to Sharing > Block (iSCSI) > Initiators > Add Initiator. All you need to do here is click “OK” unless you want to lock down iSCSI access to a single server. Otherwise, leaving it set to “ALL” is perfectly fine in a lab environment.
Next we need to add a target. Navigate to Sharing > Block (iSCSI) > Targets > Add Target. Give the target a name, then select the Portal Group we created earlier, as well as the Initiator Group (there should only be one). We will not be configuring CHAP authentication in this tutorial, so leave both authentication fields set to “None.” Go ahead and click “OK” to proceed.
Now we need to create an Extent. An extent, in this case, is a file that will will reside on our volume. This single file will be your entire iSCSI share. Think of it as a disk image file. Navigate to Sharing > Block (iSCSI) > Extents > Add Extent. Give your extent a name. You will need to select a path to the volume we created. The easiest way to do this is the click “Browse” and select the mount point there. After the path is populated, add a file name to the end (don’t put a slash at the end). A file name is required. No file extension is needed, just type a name in. I used the file name “200GB” so my “Path to the extent” is /mnt/SAS-300GB-RAID0/200GB. Next, specify the size you want the iSCSI share to be. You can use GB and TB to simplify things. Also, be sure to select your “LUN RPM” at the bottom. I’m using 15,000 RPM SAS drives, so I selected 15,000. After filling in all needed fields, click “OK.”
The hard part is over. Now we need to link the target with the extent we just created. Navigate to Sharing > Block (iSCSI) > Targets / Extents > Add Target / Extent. Select the Target we created, then the Extent we created and click “OK.”
That’s it! All that needs to be done now is to turn on the iSCSI service itself. Navigate to Services > Control Services and slide the toggle switch for “iSCSI” to “ON.” After this, you will be able to see your iSCSI target / share from your hypervisor or workstation.
I’m accessing my iSCSI share from a VMware ESXi hypervisor. So, I’m going to rescan my iSCSI adapter, which has already been configured to point to the IP of my FreeNAS server, and make sure my new iSCSI target is showing up.
As you can see, it’s showing up just as it should. If you have any questions, please feel free to ask in the comments below. Thanks for reading and have a great day!