在Linux上设置Iscsi Initiator的Equallogic CLI命令

时间:2020-03-05 15:27:38  来源:igfitidea点击:

在本教程中,将介绍安装和配置Iscsi Initiator的命令,以连接Linux CLI上的equallogic目标。

我们正在使用Dell Equallogic HIT/KIT 1.2.0版本在CentOS 6.2上配置iscsi目标。
我们可以从equallogic下载并安装主机集成工具。

查询主机套件安装

[root@centos /]# rpm -qa | grep -i equ
equallogic-host-tools-1.2.0-1.epa.el6.x86_64
[root@centos /]#

检查ehcmd进程状态

[root@rhel62-eql /]# ps -ef | grep -i eh
root 2220 1 0 Oct10 ? 00:01:01 /usr/sbin/ehcmd --pidfile /var/run/ehcmd.pid
root 30257 2848 0 11:51 pts/0 00:00:00 grep -i ehcmd
[root@centos /]#

添加Equallogic组

[root@centos /]# rswcli -a --gn eqltest --gip 192.168.0.1 --noping
Processing add-group-access command...
Group Name: eqltest
Group IP Address: 192.168.0.1
The add-group-access command succeeded.
[root@ centos /]#

发现Iscsi目标

[root@centos /]# iscsiadm -m discoverydb
192.168.0.111:3260 via sendtargets
192.168.0.120:3260 via sendtargets
192.168.0.113:3260 via sendtargets
192.168.0.120:3260 via sendtargets
192.168.0.112:3260 via sendtargets
192.168.0.111:3260 via sendtargets
192.168.0.112:3260 via sendtargets
192.168.0.110:3260 via sendtargets
192.168.0.130:3260 via sendtargets
[root@centos /]#

显示Iscsi发现的目标

[root@centos ~]# iscsiadm -m node
192.168.0.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-506562a07-ceba51ba2104d70a-vss-control
192.168.0.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-1186b2a07-82258e655324f82a-testvolume
192.168.0.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-1186b2a07-82258e655324f82a- testvolume
192.168.0.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-1186b2a07-82258e655324f82a- testvolume
192.168.0.1:3260,1 iqn.2001-05.com.equallogic:0-8a0906-1186b2a07-82258e655324f82a- testvolume
[root@centos ~]#

登录目标

[root@centos ~]# ehcmcli login --target iqn.2001-05.com.equallogic:0-8a0906-1186b2a07-82258e655324f82a- testvolume
Login succeeded. Device to mount:
/dev/eql/testvolume
[root@centos ~]#

将新找到的Lun格式化为ext4文件系统

[root@centos ~]# mkfs.ext4 /dev/eql/testvolume
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
66240 inodes, 264960 blocks
13248 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=272629760
9 block groups
32768 blocks per group, 32768 fragments per group
7360 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@centos ~]#

挂载到目录

[root@centos /]# mount /dev/eql/testvolume /data/

显示所有安装点

[root@centos /]# mount
/dev/mapper/vg_rhel62eql-lv_root on/type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/eql-0-8a0906-1186b2a07-82258e655324f82a- testvolume on /data type ext4 (rw)
[root@centos /]#

MPIO设定

dm-switch内核模块将用于IO活动。
不需要Multipathd守护程序。
如果multipathd守护程序正在运行,请确保禁用equallogic设备(放入黑名单)。

检查交换机模块是否安装。
下面的命令显示“ switch”。
这意味着它已编译为内核。

[root@centos /]# dmsetup targets
switch v1.1.0
multipath v1.3.0
mirror v1.12.0
striped v1.4.1
linear v1.1.0
error v1.0.1
[root@centos /]#

添加两个Iscsi适配器

(与我们可以排除不在Iscsi子网中的其他接口相同)

[root@centos /]# rswcli --mpio-include --adapter=eth1 --force
Processing mpio-include command...
Adding 'eth1' to include list
Adapter Rules:
Included:
eth1
Excluded:
All Other
Default Rules:
All other subnets, adapters or ip addresses are excluded.
The mpio-include command succeeded.
[root@centos /]#
[root@centos /]# rswcli --mpio-include --adapter=eth2 --force
Processing mpio-include command...
Adding 'eth2' to include list
Adapter Rules:
Included:
eth2
Excluded:
All Other
Default Rules:
All other subnets, adapters or ip addresses are excluded.
The mpio-include command succeeded.
[root@centos /]#

设置连接数,会话数和负载平衡策略

[root@centos /]# rswcli -P --maxvols 2 --maxvole 6 --dlb RR --ip6
Processing mpio-parameters command...
Removed unnecessary IPv4 rules.
MPIO Parameters:
Max sessions per volume slice: 2
Max sessions per entire volume: 6
Minimum adapter speed: 1000
Default load balancing policy configuration: Round Robin (RR)
IOs Per Path: 16
Use MPIO for snapshots: Yes
Internet Protocol: IPv6
The mpio-parameters command succeeded.
New load-balancing policies will take effect on existing multipath devices in several seconds.

显示当前状态

[root@centos /]# ehcmcli status
Generating diagnostic data, please wait...
========================================================
Adapter List
========================================================
Name: eth2
IP Address: fe80::250:56ff:feab:6cd
HW addr: 00:50:56:AB:06:CD
Name: eth3
IP Address: fe80::250:56ff:feab:6ce
HW addr: 00:50:56:AB:06:CE
========================================================
Volume list
========================================================
Volume: testvolume
Target name: iqn.2001-05.com.equallogic:0-8a0906-1186b2a07-82258e655324f82a-testvolume
Device to mount: /dev/eql/testvolume
Status: No existing sessions found using currently configured IP protocol version
Resolution: Modify the IPv4/IPv6 settings with 'rswcli -P'.
Session: 5 /dev/sdb 192.168.0.206 -> 192.168.0.112 02:42:37
Session: 6 /dev/sdc 192.168.0.207 -> 192.168.0.111 02:42:31
========================================================
Summary
========================================================
Adapters: 2
Managed Volumes: 1
iSCSI Sessions: 2
Errors: 0
Warnings: 1
Suggestions: 0
[root@centos /]#