Accessing iSCSI targets from Linux
To mount an iSCSI device to a storage node from another Virtuozzo Hybrid Infrastructure cluster, use the vinfra node iscsi target add/delete
commands, as described in the Administrator Guide.
To connect a Linux-based iSCSI initiator to iSCSI targets of Virtuozzo Hybrid Infrastructure working in the ALUA mode, do the following:
-
Make sure the required packages are installed.
-
On RPM-based systems (CentOS and other), run:
# yum install iscsi-initiator-utils device-mapper-multipath
-
On DEB-based systems (Debian and Ubuntu), run:
# apt-get install open-iscsi multipath-tools
-
-
Create and edit the configuration file /etc/multipath.conf as follows:
... devices { device { vendor "VSTORAGE" product "VSTOR-DISK" features "2 pg_init_retries 50" hardware_handler "1 alua" path_grouping_policy group_by_node_name path_selector "round-robin 0" no_path_retry queue user_friendly_names no flush_on_last_del yes failback followover path_checker tur detect_prio no prio alua } } ...
-
Load the kernel module and launch the multipathing service.
# modprobe dm-multipath # systemctl start multipathd; systemctl enable multipathd
- If necessary, enable CHAP parameters
node.session.auth.*
anddiscovery.sendtargets.auth.*
in /etc/iscsi/iscsid.conf. -
Launch the iSCSI services:
# systemctl start iscsi iscsid # systemctl enable iscsi iscsid
-
Discover all targets by their IP addresses. For example:
# iscsiadm -m discovery -t st -p 10.94.91.49 10.94.91.49 3260,1 \ iqn.2014-06.com.vstorage:target1 # iscsiadm -m discovery -t st -p 10.94.91.54 10.94.91.54:3260,1 \ iqn.2014-06.com.vstorage:target2 # iscsiadm -m discovery -t st -p 10.94.91.55 10.94.91.55:3260,1 \ iqn.2014-06.com.vstorage:target3
-
Log in to the discovered targets. For example:
# iscsiadm -m node -T iqn.2014-06.com.vstorage:target1 -l # iscsiadm -m node -T iqn.2014-06.com.vstorage:target2 -l # iscsiadm -m node -T iqn.2014-06.com.vstorage:target3 -l
-
Find out the multipath device ID. For example:
# multipath -ll 360000000000000000000b50326ea44e3 dm-10 VSTORAGE,VSTOR-DISK size=200G features='2 pg_init_retries 50' hwhandler='1 alua' wp=rw |-+- policy='round-robin 0' prio=50 status=active | `- 6:0:0:1 sdf 8:80 active ready running |-+- policy='round-robin 0' prio=1 status=enabled | `- 8:0:0:1 sdj 8:144 active ghost running `-+- policy='round-robin 0' prio=1 status=enabled `- 7:0:0:1 sdh 8:112 active ghost running # fdisk -l | grep 360000000000000000000b50326ea44e3 Disk /dev/mapper/360000000000000000000b50326ea44e3: 10.7 GB, \ 10737418240 bytes, 20971520 sectors
You can also find out the multipath device ID by adding
360000000000000000000
to the last six bytes of the volume ID. In the example above,360000000000000000000b50326ea44e3
is the multipath device ID mapped from the volume ID61c9d567-4666-4c16-8030-b50326ea44e3
.
Now you can create partitions on the iSCSI device (/dev/mapper/360000000000000000000b50326ea44e3
in this example), as well as format and mount it to your initiator node using standard Linux tools.
When you no longer need the external iSCSI device, you can remove it from the initiator node. Do the following:
- Make sure the iSCSI device is not in use.
-
Disable multipathing to the device. For example:
# multipath -f /dev/mapper/360000000000000000000b50326ea44e3
-
Log out of the iSCSI targets. For example:
# iscsiadm -m node -T iqn.2014-06.com.vstorage:target1 -p 10.94.91.49:3260 -u # iscsiadm -m node -T iqn.2014-06.com.vstorage:target2 -p 10.94.91.54:3260 -u # iscsiadm -m node -T iqn.2014-06.com.vstorage:target3 -p 10.94.91.55:3260 -u
-
Delete the iSCSI targets. For example:
# iscsiadm -m node -o delete -T iqn.2014-06.com.vstorage:target1 \
-p 10.94.91.49:3260 # iscsiadm -m node -o delete -T iqn.2014-06.com.vstorage:target2 \
-p 10.94.91.54:3260 # iscsiadm -m node -o delete -T iqn.2014-06.com.vstorage:target3 \
-p 10.94.91.55:3260