iscsiadm常用命令
Posted iouwenbo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iscsiadm常用命令相关的知识,希望对你有一定的参考价值。
iscsiadm常用命令:
# iscsiadm -m discovery -t st -p IP:port //发现iSCSI存储
# iscsiadm -m node -o delete -T TARGET -p IP:port //删除iSCSI发现记录
# iscsiadm -m node //查看iSCSI发现记录
# iscsiadm -m session //查看会话情况
# iscsiadm -m node -T TARGET -p IP:port -l //登录iSCSI存储
# iscsiadm -m node -T TARGET -p IP:port -u //登出iSCSI存储
iSCSI客户端操作:
[[email protected] ~]# iscsiadm -m discovery -t st -p 192.168.4.10 //发现iSCSI存储
192.168.4.10:3260,1 iqn.2018-12.com.oven:master
[[email protected] ~]# iscsiadm -m node //查看iSCSI发现记录
192.168.4.10:3260,1 iqn.2018-12.com.oven:master
[[email protected] ~]# iscsiadm -m session
iscsiadm: No active sessions.
删除操作 :# iscsiadm -m node -o delete -T iqn.2018-12.com.oven:master -p 192.168.4.10:3260
[[email protected] ~]# iscsiadm -m node -T iqn.2018-12.com.oven:master -p 192.168.4.10 -l //登录iSCSI存储。没有添加认证,登录失败。
Logging in to [iface: default, target: iqn.2018-12.com.oven:master, portal: 192.168.4.10,3260] (multiple)
iscsiadm: Could not login to [iface: default, target: iqn.2018-12.com.oven:master, portal: 192.168.4.10,3260].
iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)
iscsiadm: Could not log into all portals
[[email protected] ~]# vim /etc/iscsi/initiatorname.iscsi //添加客户端认证
InitiatorName=iqn.2018-12.com.oven:client //名称与服务端acl设置的名称一致
[[email protected] ~]# iscsiadm -m node -T iqn.2018-12.com.oven:master -p 192.168.4.10 -l //仍登录失败。因为未更新IQN
Logging in to [iface: default, target: iqn.2018-12.com.oven:master, portal: 192.168.4.10,3260] (multiple)
iscsiadm: Could not login to [iface: default, target: iqn.2018-12.com.oven:master, portal: 192.168.4.10,3260].
iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)
iscsiadm: Could not log into all portals
[[email protected] ~]# systemctl restart iscsid //更新IQN
[[email protected] ~]# iscsiadm -m node -T iqn.2018-12.com.oven:master -p 192.168.4.10 -l //更新IQN后登录成功
Logging in to [iface: default, target: iqn.2018-12.com.oven:master, portal: 192.168.4.10,3260] (multiple)
Login to [iface: default, target: iqn.2018-12.com.oven:master, portal: 192.168.4.10,3260] successful.
[[email protected] ~]# iscsiadm -m node session //查看会话情况
192.168.4.10:3260,1 iqn.2018-12.com.oven:master
[[email protected] ~]# iscsiadm -m session -P 3 | grep -i attached // 验证会话状态
Attached SCSI devices:
Attached scsi disk sdb State: running
以上是关于iscsiadm常用命令的主要内容,如果未能解决你的问题,请参考以下文章