The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.
To configure an Oracle Linux system as an iSCSI initiator:
Install the
iscsi-initiator-utils
package:#
yum install iscsi-initiator-utils
Use the SendTargets discovery method to discover the iSCSI targets at a specified IP address:
#
iscsiadm -m discovery --type sendtargets -p 10.150.30.72
Starting iscsid: [ OK ] 10.150.30.72:3260,1 iqn.2012-01.com.mydom.host01:target1 10.150.30.72:3260,1 iqn.2012-01.com.mydom.host01:target2NoteAn alternate discovery method is Internet Storage Name Service (iSNS).
The command also starts the
iscsid
service if it is not already running.The following command displays information about the targets that is now stored in the discovery database:
#
iscsiadm -m discoverydb -t st -p 10.150.30.72
# BEGIN RECORD 2.0-872.41.el6 discovery.startup = manual discovery.type = sendtargets discovery.sendtargets.address = 10.150.30.72 discovery.sendtargets.port = 3260 discovery.sendtargets.auth.authmethod = None discovery.sendtargets.auth.username_in = <empty> discovery.sendtargets.auth.password_in = <empty> discovery.sendtargets.timeo.login_timeout = 15 discovery.sendtargets.use_discoveryd = No discovery.sendtargets.discoveryd_poll_inval = 30 discovery.sendtargets.repoen_max = 5 discovery.sendtargets.timeo.auth_timeout = 45 discovery.sendtargets.timeo.active_timeout = 30 discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768Establish a session and log in to a specific target:
#
iscsiadm -m node --targetname iqn.2012-01.com.mydom.host01:target1
\-p 10.150.30.72:3260 -l
Login to [iface: default, target: iqn.2012-01.com.mydom.host01:target1, portal: 10.150.30.72:3260] successful.Verify that the session is active, and display the available LUNs:
#
iscsiadm -m session -P 3
Target: iqn.2012-01.com.mydom.host01:target1 Current Portal: 10.150.30.72:3260,1 Persistent Portal: 10.150.30.72:3260,1 ********** Interface: ********** Iface Name: default Iface Transport: tcp Iface Initiatorname: iqn.1988-12.com.mydom:392a7cee2f Iface IPaddress: 192.0.2.101 Iface HWaddress: <empty> Iface Netdev: <empty> SID: 1 iSCSI Connection State: LOGGED IN iSCSI Session State: LOGGED IN Internal iscsid Session State: NO CHANGE . . . ************************ Attached SCSI devices: ************************ Host Number: 4 State: running scsi10 Channel 00 Id 0 Lun:0 scsi10 Channel 00 Id 0 Lun:1 Attached scsi disk sdb State: running scsi10 Channel 00 Id 0 Lun:2 Attached scsi disk sdc State: runningThe LUNs are represented as SCSI block devices (
sd*
) in the local/dev
directory, for example:#
fdisk -l | grep /dev/sd[bc]
Disk /dev/sdb: 10.7 GB, 10737418240 bytes Disk /dev/sdc: 10.7 GB, 10737418240 bytesTo distinguish between target LUNs, examine their paths under
/dev/disk/by-path
:#
ls -l /dev/disk/by-path/
lrwxrwxrwx 1 root root 9 May 15 21:05 ip-10.150.30.72:3260-iscsi-iqn.2012-01.com.mydom.host01:02: 084591f8-6b8b-c857-f002-ecf8a3b387f3-lun-1 -> ../../sdb lrwxrwxrwx 1 root root 9 May 15 21:05 ip-10.150.30.72:3260-iscsi-iqn.2012-01.com.mydom.host01:02: 084591f8-6b8b-c857-f002-ecf8a3b387f3-lun-2 -> ../../sdcYou can view the initialization messages for the LUNs in the
/var/log/messages
file:#
grep -i scsi /var/log/messages
Apr 8 15:08:53 host02 kernel: scsi12 : iSCSI Initiator over TCP/IP Apr 8 15:08:53 host02 kernel: sd 4:0:0:1: [sdb] Attached SCSI disk Apr 8 15:08:53 host02 kernel: sd 4:0:0:2: [sdc] Attached SCSI diskYou can configure and use a LUN in the same way as you would any other physical storage device. For example, you can configure it as an LVM physical volume, file system, swap partition, Automatic Storage Management (ASM) disk, or raw device.
Specify the _
netdev
option when creating mount entries for iSCSI LUNs in/etc/fstab
, for example:UUID=084591f8-6b8b-c857-f002-ecf8a3b387f3 /iscsi_mount_point ext4 _netdev 0 0
This option indicates the file system resides on a device that requires network access, and prevents the system from attempting to mount the file system until the network has been enabled.
NoteSpecify an iSCSI LUN in
/etc/fstab
by usingUUID=
UUID
rather than the device path. A device path can change after re-connecting the storage or rebooting the system. You can use the blkid command to display theUUID
of a block device.Any discovered LUNs remain available across reboots provided that the target continues to serve those LUNs and you do not log the system off the target.
For more information, see the iscsiadm(8)
and
iscsid(8)
manual pages.