How To Connect a Linux servers to a VPSA using CHAP auth

Install Open-iSCSI initiator

If open-iscsi is not installed yet on your Server, please follow the procedure to install Open-iSCSI as described in http://zadarastorage.zendesk.com/entries/20883066-how-to-install-iscsi-initiator-in-linux

Run the following commands as sudo:

 

$ iscsiadm -m node -T <target> -p <portal> --o new

$ iscsiadm -m node -T <target> -p <portal> --o update -n node.session.auth.authmethod -v CHAP

$ iscsiadm -m node -T <target> -p <portal> --o update -n node.session.auth.username -v <username>

$ iscsiadm -m node -T <target> -p <portal> --o update -n node.session.auth.password -v <secret>

$ iscsiadm -m node -T <target> -p <portal> --login

 

For example:

 

$ iscsiadm -m node -T iqn.2011-04.com.zadarastorage:vsa-000001f2:1 -p 170.70.2.126 --o new

New iSCSI node [tcp:[hw=,ip=,net_if=,iscsi_if=default] 170.70.2.126,3260,-1 iqn.2011-04.com.zadarastorage:vsa-000001f2:1] added

$ iscsiadm -m node -T iqn.2011-04.com.zadarastorage:vsa-000001f2:1 -p 170.70.2.126 --o update -n node.session.auth.authmethod -v CHAP

$ iscsiadm -m node -T iqn.2011-04.com.zadarastorage:vsa-000001f2:1 -p 170.70.2.126 --o update -n node.session.auth.username -v user

$ iscsiadm -m node -T iqn.2011-04.com.zadarastorage:vsa-000001f2:1 -p 170.70.2.126 --o update -n node.session.auth.password -v 123456789012

$ iscsiadm -m node -T iqn.2011-04.com.zadarastorage:vsa-000001f2:1 -p 170.70.2.126 --login

Logging in to [iface: default, target: iqn.2011-04.com.zadarastorage:vsa-000001f2:1, portal: 170.70.2.126,3260]

Login to [iface: default, target: iqn.2011-04.com.zadarastorage:vsa-000001f2:1, portal: 170.70.2.126,3260]: successful

 

Some additional useful commands:

 

  • To print out the soft links of the devices in the Linux host:

$ sudo ls -l /dev/disk/by-path/

  • If your machine is rebooted or the iscsi daemon is restarted, it is required to re-issue the --login part of the command. If you want the login to happen automatically after reboot (or iscsid restart), issue:

iscsiadm -m node -T <target name> -p <IP> --op update -n node.startup -v automatic

If you wish to have your volume mount after reboot it should be added to the local fstab configuration (/etc/fstab) , for example : 

/dev/sda1 /mnt/Zadara    ext4    defaults,_netdev    0    0

Adding _netdev option will prevent the system from attempting to mount these filesystems until the network has been enabled on the system.

  • If you detach a volume from the server (or delete it), the appropriate iSCSI block device on the server still exists (but returns IO errors). If you want to remove it, then locate the block device (following the link in /dev/disk/by-path) and issue:

$ echo 1 > /sys/block/<name>/device/delete

Be careful not to delete the wrong device!

  • If you add a new volume or expand an existing one, you should see the change automatically. If not, issue:

iscsiadm -m session -R

This command will rescan all iscsi sessions for changes.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.