Targetcli sets up the fiber Channel (FC) target and targetclifire

Source: Internet
Author: User

Targetcli sets up the fiber Channel (FC) target and targetclifire


Hardware information
  • To obtain WWN, run the following command:
    cat /sys/class/fc_host/host*/port_name | sed -e s/0x// -e 's/../&:/g' -e s/:$//
  1. As the target machine
    • System: Ubuntu 14.04 Server
    • HBA: QLogic ISP2432
    • WWN1: 21: 01: 00: 1b: 32: 31: 43: XX
    • WWN2: 21: 00: 00: 1b: 32: 11: 43: XX
  2. Machine as initiator
    • System: Ubuntu 14.04 Server
    • HBA: QLogic ISP2432
    • WWN1: 21: 00: 00: 1b: 32: 11: 64: XX
    • WWN2: 21: 01: 00: 1b: 32: 31: 64: XX
  3. Vswitch
    • Brocade 200E

Preparations for installing lio-utils and targetcli
sudo apt-get install lio-utils targetcli
Mount configFS
  • If configFS is not mounted,/etc/init. d/target is automatically mounted.

ConfigFS is required for LIO and targetcli configurations. Therefore, the configFS module must be loaded into the kernel. Mount configFS to/sys/kernel/config:

mount -t configfs configfs /sys/kernel/config

You can also add it to fstab to automatically load it when the system starts.
configfs /sys/kernel/config configfs default 1 1
Modify driver configurations

Modify qla2xxx. conf to the target mode.

options qla2xxx qlini_mode="disabled" 

Update initramfs and restart the machine
sudo update-initramfs -u -k allsudo reboot

Target end configuration (ACL mode) Use targetcli for configuration to start targetcli
sudo targetcli

After the targetcli Initialization is complete, RTSlib loads the installed modules according to the related spce file (/var/target/fcbic/*. spec.
Five backstores are supported for creating backstore. IBLOCK and FILEIO are introduced here.
  1. IBLOCK
    Block devices are mainly used here. Generally, using IBLOCK as the backstore provides better performance.
    • For example, use the/dev/sdb device:
      /> cd backstores//backstores> iblock/ create name=block_backend dev=/dev/sdbGenerating a wwn serial.Created iblock storage object block_backend using /dev/sdb./backstores>
    • Or use the LVM logical volume.
      /backstores> iblock/ create name=block_backend_lvm dev=/dev/vg0/lv1Generating a wwn serial.Created iblock storage object block_backend_lvm using /dev/vg0/lv1./backstores>
  2. FILEIO
    Create a FILEIO backstore using a file.
    Note: Do not use FILEIO with buffer when using it. Create a FILEIO backuend with buffer using the buffered = true parameter. Although it can provide better performance, it will also cause serious data integrity problems: if the system crashes for some reason, data not written into the hard disk will be lost, resulting in incomplete data.
    • Create a file/usr/src/fileio. The file size is 2 GB.
      /> cd backstores//backstores> fileio/ create name=file_backend file_or_dev=/home/kyle/backstore/fileio_1 size=2GGenerating a wwn serial.Not using buffered mode.Created fileio file_backend./backstores>
Create WWN's in targetcli

We need to call targetcli on the storage server to create WWN's

/qla2xxx create 21:01:00:1b:32:31:43:XX
Use WWN's to instantiate Targets

Here we need to establish a connection between the created WWN's and the created backstore. Use commands in luns

/qla2xxx/21:01:00:1b:32:31:43:XX/luns/ create /backstores/fileio/file_backend
Create ACL's

We need to create an Access Control List (ACL's), so that the machine that needs this storage can have the permission to use this luns.
Here we need the WWN to access the luns machine, not the local

/qla2xxx/21:01:00:1b:32:31:43:XX/acls create 21:00:00:1b:32:11:64:XX/qla2xxx/21:01:00:1b:32:31:43:XX/acls create 21:01:00:1b:32:31:64:XX
Check and save Configuration

In the top-level directory of targetcli, execute ls to view all the configurations.

/> lso- / ........................................................................................... [...]  o- backstores ................................................................................ [...]  | o- fileio .................................................................... [1 Storage Objects]  | | o- file_backend_  .................................... [/home/kyle/backstore/fileio_1 activated]  | o- iblock ..................................................................... [0 Storage Object]  | o- pscsi ...................................................................... [0 Storage Object]  | o- rd_dr ...................................................................... [0 Storage Object]  | o- rd_mcp ..................................................................... [0 Storage Object]  o- ib_srpt ............................................................................. [0 Targets]  o- iscsi ............................................................................... [0 Targets]  o- loopback ............................................................................ [0 Targets]  o- qla2xxx ............................................................................. [1 Targets]  | o- 21:00:00:1b:32:11:43:38 ............................................................. [enabled]  | | o- acls ............................................................................... [2 ACLs]  | | | o- 21:00:00:1b:32:11:64:33 .................................................... [1 Mapped LUN]  | | | | o- mapped_lun0 ................................................................. [lun0 (rw)]  | | | o- 21:01:00:1b:32:31:64:33 .................................................... [1 Mapped LUN]  | | |   o- mapped_lun0 ................................................................. [lun0 (rw)]  | | o- luns ................................................................................ [1 LUN]  | |   o- lun0 ............................ [fileio/file_backend  (/home/kyle/backstore/fileio_1)]  o- tcm_fc .............................................................................. [0 Targets]/>

After the check is complete, run the saveconfig command to save the configuration. Otherwise, the configuration will be lost.

Target end configuration (DEMO mode) Use targetcli for configuration to start targetcli
sudo targetcli

After the targetcli Initialization is complete, RTSlib loads the installed modules according to the related spce file (/var/target/fcbic/*. spec. Create backstore

Create a FILEIO backstore using a file.

/> cd backstores//backstores> fileio/ create name=file_backend file_or_dev=/home/scutech/backstore/fileio_1 size=2GGenerating a wwn serial.Not using buffered mode.Created fileio file_backend./backstores>

Create WWN's in targetcli

We need to call targetcli on the storage server to create WWN's

/qla2xxx create 21:01:00:1b:32:31:43:XX
Set WWN's attributes
/qla2xxx/21:01:00:1b:32:31:43:XX set attribute \        demo_mode_write_protect=0 \        generate_node_acls=1 \        cache_dynamic_acls=1\        demo_mode_login_only=0
Use WWN's to instantiate Targets

Here we need to establish a connection between the created WWN's and the created backstore. Use commands in luns

/qla2xxx/21:01:00:1b:32:31:43:XX/luns/ create /backstores/fileio/file_backend


Check and save Configuration

Run ls in the top-level directory of targetcli to obtain the configuration.

o- / ................................................................................. [...]  o- backstores ...................................................................... [...]  | o- fileio ........................................................... [1 Storage Object]  | | o- file_test ...................................... [/home/kyle/backstore/fileio_test activated]  | o- iblock ........................................................... [0 Storage Object]  | o- pscsi ............................................................ [0 Storage Object]  | o- rd_dr ............................................................ [0 Storage Object]  | o- rd_mcp ........................................................... [0 Storage Object]  o- ib_srpt ................................................................... [0 Targets]  o- iscsi ..................................................................... [0 Targets]  o- loopback .................................................................. [0 Targets]  o- qla2xxx .................................................................... [1 Target]  | o- 21:00:00:1b:32:11:43:38 ................................................... [enabled]  |   o- acls ..................................................................... [0 ACLs]  |   o- luns ...................................................................... [1 LUN]  |     o- lun0 ...................... [fileio/file_test (/home/kyle/backstore/fileio_test)]  o- tcm_fc .................................................................... [0 Targets]

Run saveconfig to save the configuration and make it take effect.

========================================================== ============== Gorgeous split line ================================= ======================================


Configure the configuration scan target in Ubuntu on the initiator side. Run the following command to find the fc target.
echo 1 > /sys/class/fc_host/host<N>/issue_lip

If an error similar to qla2xxx [. 0]-2064: 4: SNS scan failed -- assuming zero-entry result. is found in/var/log/syslog after the name is executed,
Two issues need to be considered:
  1. Optical Fiber Connection error?
  2. Whether the zoning of the vswitch is set. (There will be a solution at the end of this wiki)
    After scanning, you can use fdisk to see a new disk/dev/sdb (depending on the actual situation)
Use Storage

Use the fdisk and mkfs commands to partition and format the hard disk (if the target uses IBLOCK, you are not sure whether to partition or format it ).
It can be used after mounting.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.