Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Вы можете установить и настроить таргет COMSTAR Internet SCSI (iSCSI) и сделать его доступным в сети. iSCSI может работать по обычному Интернет-соединению (такому как Ethernet), используя стандартный протокол iSCSI. Протокол iSCSI также поддерживает сервисы naming и discovery, сервисы аутентификации с использованием CHAP и RADIUS, и централизованное управление через iSNS.

Если в системе есть хотя бы один InfiniBand (IB) Host Channel Adapter (HCA) и имеется соединение инициатор-таргет, то iSCSI соединение использует iSCSI Extensions for RDMA (iSER) для расширенной передачи данных. При использовании из IB HCA, iSER обеспечивает широкую полосу пропускания, низкую загрузку CPU и единственное сетевое соединение, которое может использоваться одновременно несколькими протоколами.

Оба - и таргет, и инициатор iSER - используют компоненту под названинем iSCSI Data Mover для обеспечения iSCSI соединения. iSER подключается автоматически, когда и таргет, и инициатор настроены на работу с IP адресом, соответствующим IB-устройству.

  1. Установите ПО сервера хранения данных COMSTAR.

    Code Block
    target# pkg install group/feature/storage-server
                  Packages to install:    75
               Create boot environment:    No
                   Services to restart:     7
    DOWNLOAD                                  PKGS       FILES    XFER (MB)
    Completed                                75/75   9555/9555  105.7/105.7
    
    PHASE                                        ACTIONS
    Install Phase                            13347/13347 
    
    PHASE                                          ITEMS
    Package State Update Phase                     75/75 
    Image State Update Phase                         2/2 
    Loading smf(5) service descriptions: 17/17
    Loading smf(5) service descriptions: 3/3
    
    PHASE                                          ITEMS
    Reading Existing Index                           8/8 
    Indexing Packages                              75/75
    Indexing Packages                              75/75
    Optimizing Index...
    
    PHASE                                          ITEMS
    Indexing Packages                            573/573 
  2. Перезагрузите систему или запустите сервис stmf.

    Code Block
    target# svcadm enable stmf
    # svcs stmf
    STATE          STIME    FMRI
    online         09:42:32 svc:/system/stmf:default

Как сделать резервную копию и восстановить конфигурацию COMSTAR

После создания конфигурации COMSTAR сделайте её резервную копию, чтоб при необходимости её можно было восстановить.

  1. Станьте администратором.

  2. Сделайте экспорт текущей конфигурации COMSTAR.

    Code Block
    # svccfg export -a stmf > COMSTAR.backup
  3. При необходимости восстановите экспортированную ранее конфигурацию.

    Code Block
    # svccfg import COMSTAR.backup

Как создать iSCSI LUN

Провайдер логических устройств для создания LUN-ов типа диск называется sbd. Конечно, перед тем, как расшарить LUN дискового типа, необходимо инициализировать хранилище логического устройства.

Предоставляемый сервером дисковый том называется target. Когда LUN будет ассоциирован с таргетом iSCSI, инициатор iSCSI может получить доступ к нему.

Процесс создания SCSI LUN выглядит примерно так:

  • Инициализируйте хранилище LUN, известное также как backing store.

  • Создайте SCSI LUN с использованием backing store.

При создании LUN он получает глобальный уникальный идентификатор (GUID), например, 600144F0B5418B0000004DDAC7C10001. Этот GUID используется для ссылки на LUN в последующих задачах, таких как мапирование LUN на выбранные хосты.

Следующие шаги нужно выполнить на системе, которая предоставляет запоминающее устройство.

  1. Создайте ZFS pool.

    Code Block
    target# zpool create sanpool mirror c2t3d0 c2t4d0
  2. Создайте том ZFS, который будет использоваться как SCSI LUN.

    Code Block
    target# zfs create -V 2g sanpool/vol1
  3. Создайте LUN для тома ZFS.

    Code Block
    target# stmfadm create-lu /dev/zvol/rdsk/sanpool/vol1
    Logical unit created: 600144F0B5418B0000004DDAC7C10001

    Путь к тому ZFS Вы можете найти в директории /dev/zvol/rdsk/pool-name/ .

  4. Проверьте, что LUN создался.

    Code Block
    target# stmfadm list-lu
    LU Name: 600144F0B5418B0000004DDAC7C10001
  5. Добавьте LUN view.

    Эта команда сделает LUN доступным для всех систем.

    Code Block
    target# stmfadm add-view 600144F0B5418B0000004DDAC7C10001

    Если Вам нужно ограничить доступ к LUN view для отдельных систем, ознакомьтесь с How to Restrict LUN Access to Selected Systems.

  6. Проверьте конфигурацию LUN.

    Code Block
    target# stmfadm list-view -l 600144F0B5418B0000004DDAC7C10001
    View Entry: 0
        Host group   : All
        Target group : All
        LUN          : 0

How to Create the iSCSI Target

This procedure assumes that you are logged in to the local system will contains the iSCSI target.

  1. Enable the iSCSI target service.

    Code Block
    target# svcadm enable -r svc:/network/iscsi/target:default

    Confirm that the service is enabled.

    Code Block
    target# svcs -l iscsi/target
    fmri         svc:/network/iscsi/target:default
    name         iscsi target
    enabled      true
    state        online
    next_state   none
    state_time   Mon May 23 14:48:59 2011
    logfile      /var/svc/log/network-iscsi-target:default.log
    restarter    svc:/system/svc/restarter:default
    dependency   require_any/error svc:/milestone/network (online)
    dependency   require_all/none svc:/system/stmf:default (online)
    
  2. Create the iSCSI target.

    Code Block
    target# itadm create-target
    Target iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405 successfully created
    
  3. Display the iSCSI target information.

    Code Block
    target# itadm list-target -v
    TARGET NAME                                                  STATE    SESSIONS 
    iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405  online   0        
            alias:                  -
            auth:                   none (defaults)
            targetchapuser:         -
            targetchapsecret:       unset
            tpg-tags:               default
    

How to Configure an IB HCA for iSER

An InfiniBand (IB) Host Channel Adapter (HCA) is required to take full advantage of the iSCSI Extensions for RDMA (iSER) capabilities. To use iSER, you must configure the HCA on both the target and the initiator.

  1. Become an administrator on the host (initiator) system.

  2. Connect the HCA to an IB switch.

    See the vendor documentation for details.

  3. Configure the target and the initiator for the HCA.

    The target and the initiator must be on the same subnet. This example uses ibd0 as the driver.

    Code Block
    # ipadm create-addr ibd0
  4. Configure the IP address and port combination for the HCA.

    Code Block
    # ipadm create-addr -T static -a local=10.1.190.141/24 ibd0/v4addr
  5. Verify the interface configuration.

    Code Block
    # ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           127.0.0.1/8
    e1000g0/_b        dhcp     ok           10.1.190.141/24
    lo0/v6            static   ok           ::1/128
    e1000g0/_a        addrconf ok           fe80::214:4fff:fe27:360c/10
    
  6. Become an administrator on the target system and repeat steps 3-5 for all other HCA hosts on the network.

  7. Verify connectivity on both the target and the initiator.

    Code Block
    target# ping initiator-ip
    initiator# ping target-ip
    

How to Configure an iSCSI Initiator

Part of the initiator configuration process is to identify the iSCSI target discovery method, which presents an initiator with a list of available targets. You can configure iSCSI targets for static, SendTargets, or iSNS dynamic discovery. Dynamic discovery using the SendTargets option is the optimum configuration for an iSCSI initiator that accesses a large number of targets, such over an iSCSI to Fibre Channel bridge. SendTargets dynamic discovery requires the IP address and port combination of the iSCSI target for the iSCSI initiator to perform the target discovery. The most common discovery method is SendTargets.

When configuring the target discovery method, you must provide the following information, depending on which method you choose:

  • SendTargets – Target IP address

  • iSNS – iSNS server address

  • Static – Target IP address and target name

For more information about configuring target discovery methods, see Configuring Dynamic or Static Target Discovery.

  1. Enable the iSCSI initiator service.

    Code Block
    initiator# svcadm enable network/iscsi/initiator
  2. Verify the target's name and IP address while logged in to the server that is providing the target.

    Code Block
    target# ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           127.0.0.1/8
    e1000g0/_b        dhcp     ok           10.80.227.189/24
    lo0/v6            static   ok           ::1/128
    e1000g0/_a        addrconf ok           fe80::214:4fff:fe27:360c/10
    target# itadm list-target -v
    TARGET NAME                                                  STATE    SESSIONS 
    iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405  online   0        
            alias:                  -
            auth:                   none (defaults)
            targetchapuser:         -
            targetchapsecret:       unset
            tpg-tags:               default
    
  3. Configure the target to be statically discovered.

    Code Block
    initiator# iscsiadm add static-config iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405,
    10.80.227.189
    
  4. Review the static configuration information.

    Code Block
    initiator# iscsiadm list static-config
    Static Configuration Target: iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405,
    10.80.227.189:3260
    

    The iSCSI connection is not initiated until the discovery method is enabled. See the next step.

  5. Configure one of the following target discovery methods:

    • If you have configured a dynamically discovered (SendTargets) target, configure the SendTargets discovery method.

      Code Block
      initiator# iscsiadm add discovery-address 10.80.227.189
    • If you have configured a dynamically discovered (iSNS) target, configure the iSNS discovery method.

      Code Block
      initiator# iscsiadm add isns-server 10.80.227.189
  6. Enable one of the following the target discovery methods:

    • If you have configured a dynamically discovered (SendTargets) target, enable the SendTargets discovery method.

      Code Block
      initiator# iscsiadm modify discovery --sendtargets enable
    • If you have configured a dynamically discovered (iSNS) target, enable the iSNS discovery method.

      Code Block
      initiator# iscsiadm modify discovery --iSNS enable
    • If you have configured static targets, enable the static target discovery method.

      Code Block
      initiator# iscsiadm modify discovery --static enable
  7. Reconfigure the /dev namespace to recognize the iSCSI disk, if necessary.

    Code Block
    initiator# devfsadm -i iscsi

How to Remove Discovered iSCSI Targets

The associated targets are logged out after you perform any of the following actions:

  • Remove a discovery address

  • Remove an iSNS server

  • Remove a static configuration

  • Disable a discovery method

If these associated targets are still in use, for example, they have mounted file systems, the logout of these devices will fail, and they will remain on the active target list.

This optional procedure assumes that you are logged in to the local system where access to an iSCSI target device has already been configured.

  1. Become an administrator.

  2. (Optional) Disable an iSCSI target discovery method by using one of the following:

    • If you need to disable the SendTargets discovery method, use the following command:

      Code Block
      initiator# iscsiadm modify discovery --sendtargets disable
    • If you need to disable the iSNS discovery method, use the following command:

      Code Block
      initiator# iscsiadm modify discovery --iSNS disable
    • If you need to disable the static target discovery method, use the following command:

Info

Note - If you attempt to disable or remove a discovery entry that has an associated logical unit (LUN) in use, the disable or remove operation fails with the following message:

logical unit in use

If this errors occurs, stop all associated I/O on the LUN, unmount the file systems, and so on. Then, repeat the disable or remove operation.

  1. Remove the iSCSI target device.

    For example:

    Code Block
    target# itadm delete-target target-IQN

    This command might error if the target is still online or busy:

    Code Block
    The target is online or busy. Use the -f (force) option, or 'stmfadm offline-target 
    iqn.1986-03.com.sun:02:99619b8a-a4dc-4cfb-93f0-ee3debe7b0c8'
    itadm delete-target failed with error 16
    

Creating iSCSI Target Portal Groups

You can create a target portal group (TPG) to manage the discovery of multiple iSCSI and iSER targets. A TPG is a list of IP addresses to determine upon which interfaces a specific iSCSI target will listen.

A TPG contains IP addresses and TCP port numbers. To use this capability, you need to do the following:

  • Create a TPG as a list of ip-address:port specifiers by using the itadm create-tpg command.

  • Bind a specific iSCSI target to a TPG by using the itadm modify-target -t command.

  • When an iSCSI target is made active, an iSCSI listener is created for each IP address and port belonging to a TPG associated with that target.

A TPG is an efficient way to control which targets are discovered through specific ports. For example, you could restrict your iSCSI target so that it is available only through one specific IP address or only through a set of iSER-capable IP addresses.

Info

Note - Do not confuse target portal groups with target groups. A target group is a list of SCSI target ports that are all treated the same when creating views. Creating a view can help you facilitate LUN mapping. Each view entry specifies a target group, as host group, and a LUN. For more information on Target Groups and LUN mapping, see Making SCSI Logical Units Available and stmfadm(1M).

To learn about static and iSNS target discovery, see Configuring Dynamic or Static Target Discovery. The iSCSI initiator uses the iscsiadm command to discover TPGs. For more information, see iscsiadm(1M) and itadm(1M).

Using TPGs with iSER

When you use the SendTargets discovery and iSER at the same time, a common convention is to use a TPG to associate a specific iSCSI target port with only iSER-capable IP addresses. For example, if a target system has four IP addresses, A, B, C, and D, and only addresses B and C are iSER-capable, then addresses B and C could be added to a TPG, and assigned to a target T.

An iSCSI initiator with both Ethernet and InfiniBand (IB) interfaces could use the SendTargets discovery method to discover the possible storage targets. Without the use of TPGs, the initiator might always prefer the use of the Ethernet interfaces over the IB interfaces. By associating target T only with the IB interfaces, the initiator correctly prefers using its IB-capable interface when connecting to target T.

How to Create a Target Portal Group for iSCSI Targets

You can create a target portal group (TPG) by providing a unique name, and a TPG Tag (ranging from 2–65535) is automatically generated. TPG Tag 1 is reserved for the default TPG that is used when you do not explicitly set a TPG on the target. The portal for the default TPG matches requests from all network interfaces on port 3260.

The following steps shows how to create two TPGs, TPGA and TPGB, that use port 8000 for the IP addresses in TPGB.

  1. Become an administrator.

  2. Create two TPGs.

    Code Block
    target# itadm create-tpg TPGA 192.168.0.1 192.168.0.2
    target# itadm create-tpg TPGB 192.168.0.2:8000 192.168.0.2:8000
    

    Note - IPv4 portals are specified in dotted address notation (for example, 192.168.0.1). IPv6 portal addresses must be enclosed in square brackets.

  3. Configure an existing iSCSI target to use the TPGs, TPGA and TPGB.

    Code Block
    # itadm modify-target -t TPGA,TPGB eui.20387ab8943ef7548
  4. Verify the TPGs that you created.

    Code Block
    # itadm list-tpg -v

    You can remove a TPG with the itadm delete-tpg command.

How to Access iSCSI Disks

After the devices have been discovered by the Oracle Solaris iSCSI initiator, the login negotiation occurs automatically. The Oracle Solaris iSCSI driver determines the number of available LUNs and creates the device nodes. Then, the iSCSI devices can be treated as any other SCSI device.

You can create a ZFS storage pool on the LUN and then create a ZFS file system.

You can view the iSCSI disks on the local system by using the format utility.

  1. Review the iSCSI LUN information in the format output.

    Code Block
    initiator# format
           0. c0t600144F0B5418B0000004DDAC7C10001d0 <SUN-COMSTAR-1.0 cyl 1022 alt 2 hd 128 sec 32>
              /scsi_vhci/disk@g600144f0b5418b0000004ddac7c10001
           1. c8t0d0 <Sun-STK RAID INT-V1.0 cyl 17830 alt 2 hd 255 sec 63>
              /pci@0,0/pci10de,375@f/pci108e,286@0/disk@0,0
           2. c8t1d0 <Sun-STK RAID INT-V1.0-136.61GB>
              /pci@0,0/pci10de,375@f/pci108e,286@0/disk@1,0
           3. c8t2d0 <Sun-STK RAID INT-V1.0-136.61GB>
              /pci@0,0/pci10de,375@f/pci108e,286@0/disk@2,0
           4. c8t3d0 <Sun-STK RAID INT-V1.0 cyl 17830 alt 2 hd 255 sec 63>
              /pci@0,0/pci10de,375@f/pci108e,286@0/disk@3,0
    Specify disk (enter its number): 0
    selecting c0t600144F0B5418B0000004DDAC7C10001d0
    [disk formatted]
    

    In the above output, disk 0 is an iSCSI LUN under MPxIO control. Disks 1-4 are local disks.

  2. You can create a ZFS storage pool and ZFS file systems on the iSCSI LUN.

    Code Block
    initiator# zpool create pool-name c0t600144F0B5418B0000004DDAC7C10001d0
    initiator# zfs create pool-name/fs-name
    

    The ZFS file system is automatically mounted when created and is remounted at boot time.

Making SCSI Logical Units Available

Simply registering a logical unit (LUN) with the STMF framework does not make it available to hosts (initiators) on the network. This section describes how to make LUNs visible to initiator hosts for the following configurations.

For iSCSI, Fibre Channel, and FCoE configurations, a LUN must be mapped before it can be accessed. You can choose one of the following methods, both of which use the stmfadm command:

  • Simple mapping – Exposes the LUN to all initiators through all the ports, using one command. Making LUNs available to all hosts uses this method.

  • Selective mapping– Enables you to specify the hosts that can access the LUN. Making LUNs available to selected hosts uses this method. This process includes the following steps:

    1. Defining host groups – A host group is a name given to a set of hosts (initiators) that are allowed to access the same LUNs. This step is not needed if the same set of LUNs is visible to all the hosts, as in simple mapping.

    2. Defining target groups – A target group is a name given to a set of target ports that export the same set of LUNs to the same set of host groups. This step is not needed if the same set of LUNs is visible to all the hosts, as in simple mapping.

    3. Adding one or more views for each logical unit – Adding a view creates a bridge between the LUN and the host initiator. When an initiator from the host group logs in to a target port contained in the target group, the LUN is visible.

Info

Note - Don't confuse a target group with a target portal group (TPG). A TPG is a list of IP addresses that an iSCSI target listens to. A TPG can help you restrict an iSCSI target so that it is available only through one specific IP address. For more information on target groups, see stmfadm(1M).

A view entry consists of four components: host group, target group, logical unit (LUN), and LUN identifier. Of these four components, only the LUN identifier is required. If the other components are omitted, the following default values are assumed:

  • If the host group is omitted, the all initiators value is assumed.

  • If the target group is omitted, the all targets value is assumed.

  • If the LUN is omitted, the system chooses a suitable LUN for the entry.

How to Make a Logical Unit Available to All Systems

This procedure makes a LUN available to all initiator hosts on a storage network.

  1. Obtain the Global Unique Identification (GUID) number for the LUN.

    Code Block
    # stmfadm list-lu -v
  2. Add a view for the logical unit.

    Code Block
    3 # stmfadm add-view GUID-number

How to Restrict LUN Access to Selected Systems

Use this procedure to restrict LUNs to selected hosts on a storage network. If you are using Fibre Channel ports, first identify the World Wide Names (WWN). Then, selectively map a logical unit number (LUN) to the ports on host-a, for example. A target group (targets-0) is also defined for a given set of target ports that export the same set of LUNs to the same host group.

For information about configuring a target group, see stmfadm(1M).

  1. Become an administrator.

  2. Identify the Fibre Channel (FC) port on the initiator.

    Code Block
    initiator# fcinfo hba-port
    HBA Port WWN: 210000e08b195dae
            Port Mode: Initiator
            Port ID: 0
            OS Device Name: /dev/cfg/c8
            Manufacturer: QLogic Corp.
            Model: 375-3108-xx
            Firmware Version: 03.03.28
            FCode/BIOS Version:  fcode: 1.13;
            Serial Number: not available
            Driver Name: qlc
            Driver Version: 20100408-3.01
            Type: unknown
            State: offline
            Supported Speeds: 1Gb 2Gb 
            Current Speed: not established 
            Node WWN: 200000e08b195dae
            NPIV Not Supported
    .
    .
    .
    
  3. Create a host group.

    Code Block
    target# stmfadm create-hg host-a 210000e08b195dae 210100e08b395dae
  4. Add the WWNs identified in the preceding output as members of the host group.

    Code Block
    target# stmfadm add-hg-member -g host-a
  5. Create a target group.

    Code Block
    target# stmfadm create-tg targets-0
  6. Specify the target group members by adding the target names.

    Each SCSI target can be a member of only one target group.

    Code Block
    target# stmfadm add-tg-member -g targets-0 wwn.guid-number
  7. Identify the GUID number for the LUN.

    Code Block
    target# stmfadm list-lu -v
  8. Make the LUN available by adding a view entry, specifying the host group name and the LUN GUID number.

    Code Block
    target# stmfadm add-view -h host-a -t targets-0 -n 1 guid-number
Code Block