This section mainly learns about iSCSI overview and experimental iSCSI service experiment
Table of contents
iSCSI: transmission of scsi data based on IP protocol
2. Use the targetcli tool to enter the iscsi server management interface
I. Overview
Full name: Internet Small Computer System Interface - Internet small computer interface
Obtain the disk device through the network for local storage.
iSCSI: transmission of scsi data based on IP protocol
IP/SAN network
Storage Network Based on Twisted Pair as Transmission Medium
fiber storage network
The storage network based on optical fiber transmission is extremely expensive
Method to realize
Software form Hardware form
default port number
3260
related name
iscsi initiator | iscsi client |
iscsi target | iscsi server |
lun | a block device storage |
iqn | iscsi name iqn.time.domain name reverse writing: define identification |
2. Experiment
1. Build iSCSI
2. Use the targetcli tool to enter the iscsi server management interface
targetcli | Enter the iscsi command configuration information on the server side |
o- / .................... [...] | top level directory |
o- backstores ............... [...] | Backup storage, main and backup storage space, the device or partition to be shared must be added here first |
| o- block .............. [Storage Objects: 0] | Block storage, o- backstores subdirectory |
| o- fileio ............. [Storage Objects: 0] | File storage, o- backstores subdirectory |
| o- pscsi ................. [Storage Objects: 0] | Real physical scsi device, o- backstores subdirectory |
| o- ramdisk ................ [Storage Objects: 0] | flash, o- backstores subdirectory |
o- iscsi ................ [Targets: 0] | Share the directory of the storage device in the way of ISCSI |
o- loopback ................. [Targets: 0] |
Implementation steps
Service-Terminal
Go to the /backstores/block directory to add devices to the block device list | create disk0 /dev/sdb1 |
Go to the iscsi directory to generate iqn tags | create |
Go to the /iscsi/iqn.20...909/tpg1/luns> directory to create a logical unit | create /backstores/block/disk0 |
Go to the /iscsi/iqn.20...909/tpg1/acls> directory to create access control rules | create iqn.20...... |
Go to the /iscsi/iqn.20.../tpg1/portals> directory to create a port | create 192.168.1.1 3260 |
exit to exit, otherwise the settings will not be saved | |
Into the iqn number in the certification document | vim /etc/iscsi/initiatorname.iscsi |
Change the original certification number to the newly generated number | |
start service | systemctl start iscsi |
systemctl start iscsid |
edit /etc/iscsi/initiatorname.iscsi
client
install software | yum -y install iscsi-initator-utils |
Generate iqn number in certification file | vim /etc/iscsi/initatorname.iscsi |
Change the original certification number to the newly generated number | |
Start the client service | systemctl start iscsi |
systemctl start iscsid | |
Find a list of available iscsi resources | iscsiadm -m discovery -t st -p 192.168.1.1:3260 |
-m specifies the mode | |
-t specifies the action type, st, sendtargets | |
-p specify server and port | |
Access to shared resources on the server | iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3f2f0c3bd909 -l |
-T targetnameiqn | |
-l login |
编辑vim /etc/iscsi/initatorname.iscsi
启动服务
编辑分区
格式化分区,挂载
注意实项
1、自动挂载时必须使用UUID,否则会出问题,同时在参数中添加_netdev,如UUID=33899a29-9f9e-476f-b8e9-cc9ad0986dac /mnt xfs defaults,_netdev
2、开机启动关闭防火墙,因为当计算机开机首先是bios自检查找硬盘中的操作系统引导启动,但是当系统没有完全启动时计算机就没有通过网络通讯,而iscsi是基于网络的共享存储,所以开机重启需要告诉内核这条开机挂载是基于网络的存储