ISCSI 存储安装
环境:
系统:Centos 6.6
ip :172.20.10.240 (服务端) 172.20.10.241 (客户端)
- 服务端
1、安装软件包
[root@xuexi ~]# yum -y intall scsi-target-utils
2、配置
[root@xuexi ~]# vim /etc/tgt/targets.conf <target iqn.2017-09.com.xuexi.www:target_test> #iscsi格式 :iqn.年-月.主机名倒写:target端名称 backing-store /dev/sdb1 #用于存储的分区或磁盘 initiator-address 172.20.10.241 #允许连接的主机 vendor_id xuexi #供应商 product_id target1 #产品编号 </target>
3、启动服务
[root@xuexi ~]# service tgtd restart Stopping SCSI target daemon: [ OK ] Starting SCSI target daemon: [ OK ]
4、查看相关服务
[root@xuexi ~]# netstat -antul | grep 3260 tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN tcp 0 0 :::3260 :::* LISTEN [root@xuexi ~]# chkconfig tgtd on [root@xuexi ~]# tgt-admin --show
- 客户端
1、安装软件包
[root@localhost ~]# yum -y install iscsi-initiator-utils
2、启动服务
[root@localhost ~]# /etc/init.d/iscsi start [root@localhost ~]# /etc/init.d/iscsid start
3、发现存储
[root@localhost ~]# 172.20.10.240:3260,1 iqn.2017-09.com.xuexi.www:target_test
4、重启服务
[root@localhost ~]# /etc/init.d/iscsid restart [root@localhost ~]# /etc/init.d/iscsi restart [root@localhost ~]# chkconfig iscsi on [root@localhost ~]# chkconfig iscsid on
注:重启时先启iscsid在重启iscsi
5、查看是否正常
[root@localhost ~]# ls /dev/sdb* /dev/sdb
6、挂载使用
[root@localhost ~]# fdisk /dev/sdb [root@localhost ~]# fsck.ext4 /dev/sdb1 [root@localhost ~]# ll /dev/sdb* brw-rw---- 1 root disk 8, 16 Aug 30 15:54 /dev/sdb brw-rw---- 1 root disk 8, 17 Aug 30 15:56 /dev/sdb1
- 卸载存储
[root@localhost ~]# iscsiadm -m node -T iqn.2017-09.com.xuexi.www:target_test -u Logging out of session [sid: 1, target: iqn.2017-09.com.xuexi.www:target_test, portal: 172.20.10.240,3260] Logout of [sid: 1, target: iqn.2017-09.com.xuexi.www:target_test, portal: 172.20.10.240,3260] successful.
- 登陆
[root@xuexi ~]# iscsiadm -m node -T iqn.2017-09.com.xuexi.www:target_test -l Logging in to [iface: default, target: iqn.2017-09.com.xuexi.www:target_test, portal: 172.20.10.240,3260] (multiple) Login to [iface: default, target: iqn.2017-09.com.xuexi.www:target_test, portal: 172.20.10.240,3260] successful.
- 开机自动
[root@nnn ~]# iscsiadm -m node -T iqn.2017-09.com.xuexi.www:target_test --op update -n node.startup -v automatic
温馨提示:如无特殊说明,本站文章均为作者原创,转载请注明出处!