# # # #iscsi # #
SCSI supports sending SCSI commands to iSCSI storage devices (targets) on remote servers from the client (initiator) via IP.
The iSCSI interface displays: Blue for directories, pink for commands
iSCSI port defaults to 3260 for shared devices (disks)
iSCSI Initiator: Clients that need access to raw SAN storage
iSCSI Target: A remote hard disk that is provided from an iSCSI server, or a "target portal"
iSCSI Target Portal: The server that provides the target to the initiator through the network
1. Software Installation and service-side setup (on server)
Create a shared partition Fdisk-l view partition table
Partprobe
Fdisk/dev/vdb Creating a partition of size 2G
Yum Install Target-y
TARGETCLI # #进入, turn on iSCSI and enter the interface
LS # #显示, showing a new zone that does not contain a shared disk
/backstores/block CREATEWESTOS:STORAGE1/DEV/VDB1 # #共享分区
/ISCSI Createiqn.2018-08.com.westos:storage1 # #生成对外名称
/iscsi/iqn.2018-08.com.westos:storage1/tpg1/acls Createiqn.2018-08.com.westos:key1 # #创建key
/iscsi/iqn.2018-08.com.westos:storage1/tpg1/luns create/backstores/block Create Westos:storage1 # #建立对外名称和共享分区联系
/iscsi/iqn.2018-08.com.westos:storage1/tpg1/portals create172.25.254.210 # #开启链接端口
Ls
Exit # #退出保存
2. The device is used remotely, the client uses the shared device (tested with desktop)
Close both sides of the firewall
Yum Install Iscsi-initiator-utils-y
Note: the Iscsi-initiator-utils (initiator) is a client-side software that connects iSCSI Target, which is iSCSI storage, on the client server
Iscsi-m discovery-t st-p172.25.254.210 # #查看一下是否能找到共享-M Specify mode-p specify ip-t type
Iscsi-m node-tiqn.com.westos:storage1-p 172.25.254.210-l # #登陆 node One of the nodes a host
Note: Login is not now, because key is not written to the configuration file, so can't get into
Vim/etc/iscsi/initiatorname.iscsi
Initiatorname=iqn.2018-08.com.westos:key1
Systemctl Restart iSCSI
Iscsi-m node-tiqn.com.westos:storage1-p 172.25.254.210-l # #再次登陆就会显示login
Create the disk partition again FDISK/DEV/SDA
Partprobe
Mkfs.xfs/dev/sda1
MOUNT/DEV/SDA1/MNT # #暂时挂载
Df-h # #此时显示的就是服务端的共享磁盘的大小
# #这里编辑/mnt is equivalent to editing/dev/sda1, and editing/dev/sda1 is equivalent to editing a server-shared disk
Permanent Mount:
Vim/etc/fstab
/dev/sda1/mnt XFS Defaults,_netdev 0 0
# #这个文件是在系统初始化之前启动的, so it means there is no network, it can not be mounted, so add _netdev
Mount-a
3. Removing iSCSI information
(1) Client:
Yum Install Tree-y
tree/var/lib/iscsi/
Iscsi-m node-tiqn.com.westos:storage1-p 172.25.254.210-u # #撤销登陆
iscsi-m node-tiqn.com.westos:storage1-p 172.25.254.210-o Delete # #删除
tree/var/lib/iscsi/
Systemctl Restart iSCSI
Fdisk-l # #新建的磁盘分区也不见了
(2) Server
Targetcli
Ls
Clearconfig Confirm=true
Ls
Exit
Linux from getting started to mastering--ISCSI