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:

  1. 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
  2. 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
  3. Load the kernel module and launch the multipathing service.

    # modprobe dm-multipath
    # systemctl start multipathd; systemctl enable multipathd
  4. If necessary, enable CHAP parameters node.session.auth.* and discovery.sendtargets.auth.* in /etc/iscsi/iscsid.conf.
  5. Launch the iSCSI services:

    # systemctl start iscsi iscsid
    # systemctl enable iscsi iscsid
  6. Discover all targets by their IP addresses. For example:

    # iscsiadm -m discovery -t st -p 3260,1 \
    # iscsiadm -m discovery -t st -p,1 \
    # iscsiadm -m discovery -t st -p,1 \
  7. Log in to the discovered targets. For example:

    # iscsiadm -m node -T -l
    # iscsiadm -m node -T -l
    # iscsiadm -m node -T -l
  8. 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 ID 61c9d567-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:

  1. Make sure the iSCSI device is not in use.
  2. Disable multipathing to the device. For example:

    # multipath -f /dev/mapper/360000000000000000000b50326ea44e3
  3. Log out of the iSCSI targets. For example:

    # iscsiadm -m node -T -p -u
    # iscsiadm -m node -T -p -u
    # iscsiadm -m node -T -p -u
  4. Delete the iSCSI targets. For example:

    # iscsiadm -m node -o delete -T \
    -p # iscsiadm -m node -o delete -T \
    -p # iscsiadm -m node -o delete -T \