栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux iscsi命令

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux iscsi命令

首先在服务端设置

[root@localhost ~]# yum -y install targetd targetcli 下载targetd targetcli 这两个软件
[root@localhost ~]# systemctl start targt 
[root@localhost ~]# systemctl enable target
 Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.
[root@localhost ~]#  firewall-cmd --add-port=3260/tcp --permanent 设置防火墙3260端口
[root@localhost ~]#  firewall-cmd --reload 重启防火墙 (一般我喜欢关闭防火墙)
[root@localhost ~]#  firewall-cmd --list-ports  查看端口可不可用 端口号是绿色是可用的
使用targetcli 命令
[root@localhost ~]# targetcli 
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.fb46
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
你要发布的磁盘
/>  /backstores/block create yousa /dev/sdb Created block storage object yousa using /dev/sdb.
创建iqn名字 创建iscsi
/> /iscsi create iqn.2020-05.com.bdqn:disk1 Created target iqn.2020-05.com.bdqn:disk1. Created TPG 1. Global pref auto_add_default_portal=true Created default portal listening on all IPs (0.0.0.0), port 3260.
设置acl 将iacsi和客户端绑定
/> /iscsi/iqn.2020-05.com.bdqn:disk1/tpg1/acls create iqn.202005.com.bdqn:client1 Created Node ACL for iqn.2020-05.com.bdqn:client1

绑定lun块
/> /iscsi/iqn.2020-05.com.bdqn:disk1/tpg1/luns create /backstores/block/yousa Created LUN 0. Created LUN 0->0 mapping in node ACL iqn.2020-05.com.bdqn:client1

客户端

[root@localhost ~]#  yum -y install iscsi-initiator-utils 安装工具
[root@localhost ~]# vim /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2020-05.com.bdqn:client1  给initiator命名 
[root@localhost ~]# systemctl start iscsi 启动服务
[root@localhost ~]#  systemctl enable iscsi 重启服务
[root@localhost ~]# systemctl status iscsi 
 iscsi.service - Login and scanning of iSCSI devices
   Loaded: loaded (/usr/lib/systemd/system/iscsi.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at 四 2022-04-28 15:01:46 CST; 5h 33min ago
     Docs: man:iscsid(8)
           man:iscsiadm(8)
发现硬盘
[root@localhost ~]# iscsiadm -m discovery -t st -p 192.168.1.60
192.168.1.60:3260,1 iqn.2020-05.com.bdqn:disk1
登陆存储
[root@localhost ~]#  iscsiadm -m discovery -t st -p 192.168.1.60 -l 
192.168.1.60:3260,1 iqn.2020-05.com.bdqn:disk1 Logging in to [iface: default, target: iqn.2020-05.com.bdqn:disk1, portal: 192.168.1.60,3260] (multiple) Login to [iface: default, target: iqn.2020-05.com.bdqn:disk1, portal: 192.168.1.60,3260] successful
验证
[root@localhost ~]#lsscsi
[0:0:0:0]    disk    VMware,  VMware Virtual S 1.0   /dev/sda 
[2:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0
 [3:0:0:0]    disk    LIO-ORG  server0.disk1    4.0   /dev/sdb

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/844334.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号