Article Directory
0 Experimental environment
- Server side: node1: 192.168.43.101
An iSCSI Target
is an iSCSI target. It is a server component of an iSCSI network, usually a storage device, used to contain required data and respond to requests from an iSCSI initiator.
- Client: node2: 192.168.43.111
iSCSI Initiator:
iSCSI initiator, essentially, an iSCSI initiator is a client device that connects and initiates requests to the server (iSCSI target)
1. Introduction to iscsi
SCSI (Internet Small Computer System Interface, Internet Small Computer System Interface) is an IP SAN technology researched and developed by IBM. This technology combines the existing SCSI interface with Ethernet technology and is based on a TCP/IP protocol Connect the iSCSI server (Target) and the client (Initiator), so that the encapsulated SCSI data packet can be transmitted on the general Internet, and finally realize the mapping of the iSCSI server to a storage space (disk) for the client after authentication.
2. iscsi configuration
2.1 Server configuration:
fdisk /dev/sdb
:Division partition ===>/dev/sdb1dnf install targetcli -y
:installationsystemctl enable --now target
: Start the target servicetargetcli
#查看可用的命令
===>help
#查看
===>ls
#
===>/backstores/block create westos:storage1 /dev/sdb1
===>/iscsi create iqn.2020-12.org.westos:storage1
===>iscsi/iqn.2020-12.org.westos:storage1/tpg1/luns create /backstores/block/westos:storage1
===>iscsi/iqn.2020-12.org.westos:storage1/tpg1/acls create iqn.2020-12.org.westos:westoskey
#退出
===>exit
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload
2.2 Client configuration:
dnf search iscsi
: Find
dnf install iscsi-initiator-utils.x86_64 -y
: Installtree /var/lib/iscsi/
vim /etc/iscsi/initiatorname.iscsi
:
InitiatorName=iqn.2020-12.org.westos:westoskey
systemctl restart iscsid
fdisk -l
: No /dev/sdbiscsiadm -m discovery -t st -p 192.168.43.101
iscsiadm -m node -T iqn.2020-12.org.westos:storage1 -p 192.168.43.101 -l
: Synchronized /dev/sdb (because there is already /dev/sda)fdisk /dev/sdb
: Create partition ===>/dev/sdb1mkfs.xfs -K /dev/sdb1
:formatmount /dev/sdb1 /mnt/
: Mount
#开机自动挂载
vim /etc/fstab
/dev/sdb1 /mnt xfs defaults,_netdev 0 0
3. Completely delete iscsi
3.1 Client delete:
iscsiadm -m node -T iqn.2020-12.org.westos:storage1 -p 192.168.43.101 -u
iscsiadm -m node -T iqn.2020-12.org.westos:storage1 -p 192.168.43.101 -o delete
(If you don't execute this command, you will only uninstall it, delete the partition, and resynchronize after -u, systemctl restart iscsi)
3.2 Server delete:
targetcli
> clearconfig confirm=true
> exit