17.7.1 Configuring an iSCSI Target

An iSCSI target is typically a dedicated, network-connected storage device but it can also be a general-purpose computer. The procedure in this section demonstrates how to set up a simple iSCSI target.

To configure an Oracle Linux system as an iSCSI target:

  1. Install the scsi-target-utils package:

    # yum install scsi-target-utils
  2. Edit /etc/tgt/targets.conf and create entries for the iSCSI target and the storage devices (LUNs) that it will make available, for example:

    <target iqn.2012-01.com.mydom.host01:target1>
        direct-store /dev/sdb # LUN 1
        direct-store /dev/sdc # LUN 2

    The /etc/tgt/targets.conf file contains several sample configurations that you can use as templates.

    In the example, the target is uniquely identified by its iSCSI Qualified Name (IQN), which takes the format:




    Specifies the year and month that the naming authority took ownership of the domain.


    Specifies the reverse fully qualified domain name of the naming authority.


    Specifies an optional target name, which identifies the target at a site.

  3. Start the iSCSI target service, tgtd, and configure it to start after the system reboots:

    # service tgtd start
    # chkconfig tgtd on
  4. Use the tgtadm command to verify that the iSCSI target is available:

    # tgtadm -o show -m target
    Target 1: iqn.2012-01.com.mydom.host01:target1
        System information:
            Driver: iscsi
            State: ready
        I_T nexus information:
        LUN information:
            LUN: 0
                Type: controller
                SCSI ID: deadbeaf1:0
                SCSI SN: beaf10
                Size: 0 MB
                Online: Yes
                Removable media: No
                Backing store: No backing store
            LUN: 1
                Type: disk
                SCSI ID: deadbeaf1:1
                SCSI SN: beaf11
                Size: 10737 MB
                Online: Yes
                Removable media: No
                Backing store: No

You can use the tgtadm utility to monitor and configure iSCSI targets. In addition, the tgt-admin script provides a simplifed interface to the tgtadm commands that create, delete, and show target information. The tgt-setup-lun script allows you to create targets, add devices to targets, and define which iSCSI initiators are allowed to connect to a target.

For more information, see the targets.conf(5), tgt-admin(8), tgt-setup-lun(8), and tgtadm(8) manual pages.