After reviewing some of the basics on storage, as well as some specifics pertaining to VMware, let’s see next how to setup iSCSI on FreeNAS and present the volume to two ESXi Hosts – as it is my case since the hosts are clustered.
The instructions below show how to export/present an iSCSI volume to the outside world where, it could then be “found” by a client (ESXi host).
I. FREENAS & ISCSI TERMINOLOGY
- Portal – nothing more than an association between an IP Address and a TCP port number defining the interface on which to listen to incoming iSCSI connections
- iSCSI Target is the software, server component. This is configured within FreeNAS management web interface by setting up a Portal
- iSCSI Initiator is a software driver which is linked to a vSwitch/VMkernel interface. This is configured in vSphere via either the vSphere Windows client, or the vSphere Web-Client. This component is in fact the iSCSI client, hence it initiates iSCSI connection to an iSCSI target
- An extent is seen as the storage unit being shared; it can be a file, or it can be a device. Choosing file based extent vs. a device based extent shouldn’t be tricky – simply put, you should always choose file based extents since they are more flexible and offer identical performance to the device extents. Good documentation can be found here, including explanation on the difference between the two
- LUN is the Logical Unit Number of the volume being presented to the server by means of an extent. There must exist a iSCSI target set for each LUN. Also, multiple servers could connect to the same iSCSI target at the same time, effectively accessing the LUN/Volume simultaneously
- iSCSI Authentication is optional; when used, most likely we would use either CHAP (only the initiator authenticates) or Mutual CHAP (both initiator and server authenticate).
II. EXPORTING THE ISCSI LUN
1. Login to the web management interface of FreeNAS
2. Go to Services and enable the iSCSI service
3. Click on the little tool icon and then go to Target Global Configuration – I have changed the domain name part from example.com to home.cm; also make sure you check the LUC box. At last, I’ve chosen no authentication method to keep things simple. In real life, you would probably want storage access to be authenticated. Click Save.
4. Go to Portals and add a portal
5. Next, go to Initiators and allow connections from ALL initiators and ALL networks …
6. Jump straight to targets and add a target … Portal Group ID and Initiator Group ID must be populated as per steps done previously
7. You now need to create an extent … mine is called iscsi.extent
8. At last, we need to link the extent to the target; so go to Associated Targets and link the two …
III. VMWARE ISCSI INITIATOR
For additional reference, or a quick recap, please see my previous blog, Part I.
1. Going forward, we will have to setup the iSCSI Initiator. This will be a one step process … no wizards, no extra information needed – just click the plus button…
2. Next, while the newly added adapter is selected, go to Network Port Binding and add click the plus button …
3. … this will bring a pop-up similar to the one below; you will then have to select the correct VMkernel interface – the one which belongs to the vSwitch where your storage network is. In my case, this was vSwitch2, portgroup STORAGE-2-GW, and the vmk1 interface.
4. Next, point the initiator to the iSCSI target created previously; it will actually be automatically detected as soon as we add in the IP address of our storage:
5. … adding the IP (the hostname resolves to the correct IP) and press OK.
6. At last, rescan your storage devices and adapters …
… and job (nearly) done.
7. To finish off the job, just go and add a new datastore as you would normally do. You will see the new iSCSI device in your list of available devices.