How to modify the iSCSI initiator ID in Linux?

In our environment, we have duplicate initiator id in /etc/iscsi/initiatorname.iscsi due to multiple iSCSI implementations. How can we Create Different ISCSI Initiator ID for the hosts?

 

Solution

 

Sometimes, when systems are mass deployed using the same Linux image, you may have duplicate initiator IDs in all the systems. The initiator ID for the system is mentioned in the file /etc/iscsi/initiatorname.iscsi file. In order to modify or create a new iSCSI initiator ID, follow the steps given below.

 

1. Move the existing /etc/iscsi/initiatorname.iscsi to other temporary directory (or back it up somewhere).

# mv /etc/iscsi/initiatorname.iscsi /var/tmp/initiatorname.iscsi.backup

 

2. Run following on the command line.

# echo "InitiatorName=`/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi

 

The command ‘/sbin/iscsi-iname‘ generates a new iSCSI initiator ID, which in turn is overwritten in the file /etc/iscsi/initiatorname.iscsi.

 

Note:

you can run above command line multiple times to create a different id.

 

3. Make sure you make corresponding changes in the iSCSI target ACLs to accommodate the new iSCSI initiator ID and allow access using the new initiator ID. This step is required only if you have any existing iSCSI targets and target ACLS configured using the old iSCSI initiator ID.

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)