Sharing the same VMFS volume across multiple hosts offers the following advantages: VMotion, HA, FT, DRS, SDRS etc, VMFS datastores serve as repositories for virtual machines. As a cluster file system, VMFS lets multiple ESXi hosts access the same VMFS datastore concurrently.

To ensure that the same virtual machine is not accessed by multiple servers at the same time, VMFS provides on-disk locking. You can set up VMFS datastores on any SCSI-based storage devices that the host discovers, including Fibre Channel, iSCSI, and local storage devices.

Here we are creating iSCSI storage software SAN with the help of FreeNAS v.11 and connecting to ESXi 6.5 by using Software iSCSI Adapter.

Please follow the following steps:

1. ENABLING iSCSI Service

Once logged in to FreeNAS web console navigate to services >> Enable ISCSI service “start on boot” >> click “start now” to start the service [ To install and configure Free NAS-11 please click here ]

2. ADD New Volume

Navigate to Storage >> volumes >> volume manager, Then give a name for Volume. And you can see a list of available disks, Here I have three disks with size 21.5GB. Use drag and drop option/add button “+” to add the multiple disks to the volume. Here I added 2 disks with mirror.

Volume Manager only allows choosing a configuration if enough disks have been selected to create that configuration. These layouts are supported:

Stripe: requires at least one disk
Mirror: requires at least two disks
RAIDZ1: requires at least three disks
RAIDZ2: requires at least four disks
RAIDZ3: requires at least five disks
log device: requires at least one dedicated device, a fast, low-latency, power-protected SSD is recommended
cache device: requires at least one dedicated device, SSD is recommended

Then click on the “Add Volume” to finish the volume creation.

3. Create Zvol to share through iSCSI

ZFS (Zettabyte File System) is a combined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include protection against data corruption, support for high storage capacities, snapshots and continuous integrity checking and automatic repair, RAID-Z and Simplified Administration
A zvol is a feature of ZFS that creates a raw block device over ZFS. This allows you to use a zvol as an iSCSI device extent.

Then select the volume you created and click on create new zvol button showing at the bottom side. So you will get a window like shown below. Fill the zvol name & comment box >> zvol size in Gib >> enable force size (this will allow zvol to consume more than 80% of available space) >> select any of compression method >> select Block size
>> click on “Add zvol”

[NOTE: specify size and value such as 10Gib; if the size is more than 80% of the available capacity, the creation will fail with an “out of space” error]

[NOTE: Sparse volume checkbox used to provide thin provisioning; use with caution for when this option is selected, writes will fail when the pool is low in space]

Next share this zvol over ISCI protocol. You might want to acquaint yourself with ISCSI concepts before configuring this. Some of the concepts are discussed below.

Initiator: a client which has authorized access to the iSCSI storage The client requires initiator software to initiate the connection to the iSCSI storage share.

Target: A storage resource on the storage server (FreeNAS), Every Target have a unique name called IQN ( ISCSI Qualified Name).

Internet Storage Name Service (iSNS): protocol for the automated discovery of iSCSI devices on a TCP/IP network.

Extent: the storage unit to be shared. It can either be a file or a block device (Eg: zvol).

Portal: indicates which IP addresses and ports to listen on for connection requests on storage device side.

LUN: Logical Unit Number representing a logical SCSI device. Rather than mounting remote directories, initiators format and directly manage filesystems on iSCSI LUNs.

4. Creating iSCSI Target Configuration

Navigate to Sharing >> Block (iSCSI) >> Target Global Configuration. You can see auto-generated Base name/ IQN.

Do not edit anything, just save the configuration as it is.

5. Create iSCSI Portal

The Next needs to configure a portal for iSCSI, portal means it’s a combination of IP address and port number to access the shared storage

Sharing >> Block (iSCSI) >> Portals >> Add portal, Brings up the screen shown below. And click OK to finish the portal configuration. The settings that can be configured when creating a portal is following

Comment: optional description; portals are automatically assigned a numeric group ID

Discovery Auth Method: configures the authentication level required by the target for discovery of valid devices,
where None will allow anonymous discovery while CHAP and Mutual CHAP require authentication

IP address: select the IP address associated with an interface or the wildcard address of 0.0.0.0 (any interface)

Port: TCP port used to access the iSCSI target; default is 3260

If you need to assign additional IP address you can use “ Add extra portal IP” option

6. Create Initiators for iSCSI

The next step is to configure Initiator, To configure which systems can connect to this share. Navigate through Sharing >>
Block (iSCSI) >> Initiators >> Add Initiators.
Inside Initiators Text box we can mention the keyword “ALL”, this will allow connecting any clients to this iSCSI share.

Or else we can mention Initiator hostname separated by space. Authorized network: use ALL keyword or a network address who all are authorized to access this share.

7. Create Target for iSCSI

Target is a combination of portals, valid initiators, and authentication methods. Settings that can be configured when creating a Target is following

Target Name: required value; the base name will be appended automatically if it does not start with iqn
Target Alias: optional user-friendly name
Portal Group ID: leave it empty or select number of existing portal to use
Initiator Group ID: select which existing initiator group has access to the target

create a Target using Sharing >> Block (iSCSI) >> Targets >> Add Target, as shown in below image.

8. Create Extents

iSCSI targets provide virtual access to resources, Extents are used to define resources to share with clients. There are two types of extents: device and file

Device extents provide virtual storage access to zvols, zvol snapshots, or physical devices like a disk, an SSD, a hardware RAID volume etc

File extents provide virtual storage access to an individual file.

Here we already created zvol with name “volume1”, so this is going to share as Device extents. Create extent using Sharing >> Block (iSCSI) >> Targets >>Add Targets. And the settings that can be configured when creating an extent is following

Extent Name : name of the extent
Extent Type : select from File or Device
Device : select the unformatted disk, zvol, file etc
Serial : unique LUN ID; the default is generated from the system’s MAC address

Read-only: check this box to prevent the initiator from initializing this LUN

Here you can see our pre-created 10 GB “volume1” added as Device extents

9. The last step of iSCSI creation is associating an extent to a target within Sharing >> Block (iSCSI) >> Associated Targets >> Add Target/Extent.

Target: select the pre-created target

LUN ID: select the value to use or type in a value between 1 and 1023

Extent: select the pre-created extent

10. Configure

Now we move to the VMware vCenter Server / ESXi Host to add the iSCSI volume as a VMFS data store. (We will be using ESXi version 6.5 with Web Interface.)

Login to Vcenter Server and select the host which to add the iSCSI resource / Login to ESXi host
Navigate to Storage section and Storage adapters subsection
Click on add / “+” button And add iSCSI Software Initiator.
Select the Software iSCSI Initiator >> and click Configure iSCSI will brings the blow screen >> click on enable button

We can use Static Targets or Dynamic Target, If you use Static Discovery, you should provide the iSCSI storage IQN name, IP & port number. For easy configuration use “Add dynamic target” button and provide the IP address and Port only. It will automatically scan and detect the all iSCSI targets belongs to that IP & port. Click “Save configuration” to Save the current configuration.

11. Creating New VMFS DataStore with iSCSI LUN

Navigate Host >> Storage >> Datastore >> Create New Data store >> Create New VMFS Data Store

Precreated iSCSI LUN will be List like shown in below, Select the LUN and give a Name to Datastore then click Next.

12. In Next Screen We can Change the Datastore Size And Filesystem (VMFS) Version also, The Screen will be like below Image.

Select Custom Option from the first Dropdown menu and select the VMFS version from the second Dropdown option. And select left side Disk (Mentioned Like “Before, select a partition”) It will display an option for resizing the Datastore. Click Next and Finish the configuration.
Here I created 5GB Datastore out of 10GB LUN.

Then you can see this Datastore will display under Datastore Option like shown in below image.

For any technical assistance to Create ISCSI Storage for VMware ESXi with Free NAS 11

Feel free to contact us

Thanks for dropping by. Ready for the next blog?

11 Tips To Improve Your Web Performance

  • Shirik

    Hi,

    Thank you for the nice article.

    Just have 1 question. Is it possible to mount the 5gb that left as a separate(2nd) Datastore? I can’t seem to find this option.

    • AskAlly

      Thank for the feedback Shirik.
      Assuming that,
      1. You have created and shared iSCSI storage with more than 5GB in free NAS.
      2. You have created one datastore in this LUN and you want to mount remaining 5GB as a different data store.

      iSCSI is a block-level storage protocol, you can create multiple partitions on the iSCSI devices.

      Here you can repeat the step “Creating New VMFS DataStore with iSCSI LUN” to create a second data store.
      It will list the all attached storage devices, from that list select your iSCSI device and check the available free space and click next. Like this, you can create multiple data store on the same iSCSI device.
      Screenshot for the reference – http://examplesite.me/screenshots/iscsi.png

Vineesh
Author : Vineesh
Written on : 5 Apr, 2018

Who we are ?

Founded in 2010, we are a team of a sysadmins with super awesome server management skills who likes to give super quality support at super affordable price.

Services