Installation guide

3. Exp o rt t h e iSCSI t arg et an d LUN s
For Red Hat Enterprise Linux 5, several tgtadm commands are required to create a target
and associate the storage volumes created earlier. First, the following command adds a
target using an iSCSI Qualified Name (IQN):
# tgtadm --lld iscsi --op new --mode target --tid 1 --targetname \
iqn.2004-04.rhel:rhel5:iscsi.kvmguest
Now the storage volumes must be associated with LUNs in the iSCSI target with these two
commands:
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 \
--backing-store /var/lib/tgtd/kvmguest/rhelx86_64.img
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 \
--backing-store /var/lib/tgtd/kvmguest/shareddata.img
Important
Add the previous 3 tgtadm commands to the end of the /etc/rc.local file to ensure
normal operation upon restarting of the system.
To confirm the successful operation of the previous commands, query the iSCSI target setup:
tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2004-04.rhel:rhel5:iscsi.kvmguest
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 10737 MB, Block size: 1024
Online: Yes
Removable media: No
Readonly: No
Backing store type: rdwr
Backing store path: /var/lib/tgtd/kvmguest/rhelx86_64.img
Backing store flags:
LUN: 2
Type: disk
SCSI ID: IET 00010002
SCSI SN: beaf12
Size: 537 MB, Block size: 512
Online: Yes
Red Hat En t erp rise Lin ux 5 Virt ualizat ion Guid e
250