.. _Creating and Running Virtuozzo Infrastructure Platform iSCSI Targets:

Creating and Running Virtuozzo Infrastructure Platform iSCSI Targets
--------------------------------------------------------------------

.. note::

   1. Each iSCSI target must be assigned at least one unique IP address from frontnet's static pool.

   2. The name of each iSCSI target must be unique in the Virtuozzo Infrastructure Platform cluster.

   3. Virtuozzo Infrastructure Platform iSCSI targets support persistent reservations to allow iSCSI initiators obtain exclusive access to the specified target's LUNs.

To create and start a target ``test1`` with the size of 100 GB, the LUN of 1, and the IP address of 192.168.10.100, execute the following commands:

::

    # vstorage-iscsi create -n test1 -a 192.168.10.100
    IQN: iqn.2014-04.com.vstorage:test1
    # vstorage-iscsi lun-add -t iqn.2014-04.com.vstorage:test1 -l 1 -s 100G
    # vstorage-iscsi start -t iqn.2014-04.com.vstorage:test1

.. note::

   1. If you need to change target's IP address, stop the target as described in :ref:`Stopping Virtuozzo Infrastructure Platform iSCSI Targets`, then run the command ``vstorage-iscsi set -t <target_name> -a <new_IP_address>``.

   2. If you need to increase the size of a LUN, stop the target as described in :ref:`Stopping Virtuozzo Infrastructure Platform iSCSI Targets`, then run the command ``vstorage-iscsi lun-grow -t <target_name> -l <lun_ID> -s <new_size>``.

To check that the target is up, run the ``vstorage-iscsi list`` command with the target's name as the option. For example:

::

    # vstorage-iscsi list -t iqn.2014-04.com.vstorage:test1
    Target iqn.2014-04.com.vstorage:test1:
     Portals:     192.168.10.100
     Status:      running
     Registered:  yes
     Host:        fefacc38a2f140ca
     LUN:   1, Size:  102400M, Used:     1M, Online: Yes

For information about the command output, see :ref:`Listing Virtuozzo Infrastructure Platform iSCSI Targets`.

iSCSI initiators can now access the target ``iqn.2014-04.com.vstorage:test1`` via the portal 192.168.10.100.

**Performance Tips**

-  Spread iSCSI targets evenly across Hardware Nodes in the cluster. For example, 10 Hardware Nodes with 1 iSCSI target per each will perform better than a single Hardware Node with 10 iSCSI targets on it.

-  More LUNs per fewer iSCSI targets will perform better than fewer LUNs per more iSCSI targets.
