0% found this document useful (0 votes)
31 views3 pages

Iscsi Configuration

asd

Uploaded by

nifonab253
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Iscsi Configuration

asd

Uploaded by

nifonab253
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Chapter

Initiator 27. Set up an iSCSI Target and


Note
When using the hal daemon with a large number of iSCSI LUNs, over several thousand, the --
child-timeout option should be used in order to avoid boot failures. The --child-
timeout option sets the number of seconds to wait for all disk probes to run. For example, to
force the hal daemon to wait 10 minutes and 30 seconds, the option would read --child-
timeout=630. The default time is 250 seconds. While this means the hal daemon will take longer
to start, it will give enough time for all disk devices to be recognized and avoid boot failures.
The reason for this work around is because in 2003 when the hal daemon was created, it was
unusual to have more than a dozen iSCSI disks. It is for this reason, the hal daemon has been
removed in Red Hat Enterprise Linux 7 and replaced with udisks.
For more information, see the following Red Hat Knowledgebase solution: haldaemon fails to
start on system with a large number of disks in RHEL 5 and RHEL 6
27.1. iSCSI Target Creation
An iSCSI target can be a dedicated physical device in a network, or it can be an iSCSI software-
configured logical device on a networked storage server. The target is the end point in SCSI bus
communication. Storage on the target, accessed by an initiator, is defined by LUNs.
Procedure 27.1. Create an iSCSI Target
• Install scsi-target-utils.
~]# yum install scsi-target-utils
• Open port 3260 in the firewall.
• ~]# iptables -I INPUT -p tcp -m tcp --dport 3260 -j ACCEPT
• ~]# service iptables save
• Start and enable the target service.
• ~]# service tgtd start
• ~]# chkconfig tgtd on
• Allocate storage for the LUNs. In this example a new partition is being created for block
storage.
Expand
~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table


Building a new DOS disklabel with disk identifier 0x43eb8efd.

Command (m for help): n


Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): *Enter*
Using default response p
Partition number (1-4, default 1): *Enter*
First sector (2048-2097151, default 2048): *Enter*
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +250M
Partition 1 of type Linux and of size 250 MiB is set

Command (m for help): w


The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.
• Edit the /etc/tgt/targets.conf file to create the target.
• ~]# cat /etc/tgt/targets.conf
• ...
• default-driver iscsi
• <target iqn.2015-06.com.example.test:target1>
• backing-store /dev/vdb1
• initiator-address 10.10.1.1
• </target>
In the above example a simple target containing one backing store and one allowed
initiator has been created. It must be named with an iqn name in the format of iqn.YYYY-
MM.reverse.domain.name:OptionalIdentifier. The backing store is the device the
storage is located on. The initiator-address is the IP address of the initiator to access the
storage.
• Restart the target service.
• ~]# service tgtd restart
• Stopping SCSI target daemon: [ OK ]
• Starting SCSI target daemon: [ OK ]
• Check the configuration.
Expand
~]# tgt-admin --show
Target 1: iqn.2015.06.com.example.test: server
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
Prevent removal: 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: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/vdb1
Backing store flags:
Account information:
ACL information:
10.10.1.1
• PREVIOUS
27.2. iSCSI Initiator Creation
An iSCSI initiator is the client who wishes to access the storage on a target, or
server. The IP address of the target needs to be known for this process.
Procedure 27.2. Create an iSCSI Initiator
• Install iscsi-initiator-utils.
~]# yum install iscsi-initiator-utils
• Discover the target. Use the target's IP address, the one used below
serves only as an example.
• ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.1
• Starting iscsid: [ OK ]
• 192.168.1.1:3260,1 iqn.2015-06.com.example.test:target1
The above shows the target's IP address and IQN address. It is the IQN
address that is needed for future steps.
• Connect to the target.
• ~]# iscsiadm -m node -T iqn.2015-06.com.example:target1 --login
• Logging in to [iface: default, target: iqn.2015-06.com.example:target1,
portal: 192.168.1.1,3260] (multiple)
• Login in to [iface: default, target: iqn.2015-06.com.example:target1, portal:
192.168.1.1,3260] successful.
• Find the iSCSI disk name.
• ~]# grep "Attached SCSI" /var/log/messages
• Jun 19 01:30:26 test kernel: sd 7:0:0:1 [sdb] Attached SCSI disk
• Create a file system on that disk.
~]# mkfs.ext4 /dev/sdb
• Mount the file system.
• ~]# mkdir /mnt/iscsiTest
• ~]# mount /dev/sdb /mnt/iscsiTest
• Make it persistent across reboots by editing the /etc/fstab file.
• ~]# blkid /dev/sdb
• /dev/sdb: UUID="766a3bf4-beeb-4157-8a9a-9007be1b9e78" TYPE="ext4"
• ~]# vim /etc/fstab
UUID=766a3bf4-beeb-4157-8a9a-9007be1b9e78 /mnt/iscsiTest ext4 _netdev 0
0

You might also like