iscsi service (network-based block storage device)

Table of contents

1. Concept

2. Construction of services

1. Test whether the port number is enabled

 2. Related nouns

3. Build iscsi service

1. First add a disk to simulate 20G, then mount the partition and install yum -y install targetcil

 2. Enter this page, but no hard disks are added (some block devices in the current host are displayed). After viewing, enter exit to exit.

 3. Server setup process

4. Client building process

 1. Installation

 5. Login


Explanation: Since it is block device storage, it means that it is closely related to the disk. It is necessary to provide a part of the space to share with the network. The client searches for the shared resources and then mounts them for local use.

1. Concept

Full name: Internet Small Computer System Interface——Internet Small Computer System Interface

Obtain disk devices through the network for local storage.

Port number 3260 

2. Construction of services

1. Test whether the port number is enabled

 2. Related nouns

iscsi initiator iscsi client
iscsi target iscsi server
lun a block device storage
iqn iscsi name
                              iqn. time. domain name reverse writing: definition identification

iqn is more critical. It is an identifier for identifying this device. It must be matched before it can be used. If it is not matched, it cannot be used normally.

3. Build iscsi service

1. First add a disk to simulate 20G, then mount the partition and install yum -y install targetcil

lsblkView

Enter cd /sys/class/scsi_host

 2. Enter this page, but no hard disks are added (some block devices in the current host are displayed). After viewing, enter exit to exit.

 3. Server setup process

fdisk /dev/sdb

 wSave and exit

 That’s it for now

 The orange one is his next-level directory (corresponding to different types)

 Mainly focus on whether there is an information prompt after executing the command (marked in green)

If it's green, it's basically OK.

 ls to see if it was created successfully

 Go to the iscsi directory to generate iqn tags

Enter create in iscsi and it will be created by itself.

 

 Created an iqn tag (with time and domain name written in reverse, ip and port)

acls is the access control list (from which some access controls for this device are set)

luns is to set up some shared storage things

Portals create a port

The purple part in the picture below is the lower-level directory of portals (the port being monitored)

To create a logical unit, disk0 must be used. The previously created partition cannot be used because it has been simulated as disk0.

 First enter the directory as shown in the picture

 ls checks that it is empty.

Create a lun

 

 Created successfully

 Then enter acls

 Some access controls will be automatically generated

 Create port

 The red part prompts that it cannot be created because one already exists in the portals path. You need to delete it before creating and viewing it.

Share a 1.1 3260 port

exit (the green part indicates that it has been written)

 Then enter vim /etc/iscsi/initiatorname.iscsi (there will be an iqn number in the generated certification file under this path) to modify the certification number, enter the generated certification number and save and exit

Note that if you do not do this step, some authentication errors will be reported.

 Restart service

Enter netstat -anptl again to view

 Now it is prompted that it has been shared but the sharing cannot be seen and needs to be searched by the client.

4. Client building process

 1. Installation

Enter vim /etc/iscsi/initatorname.iscsi

Change the number of iqn (make sure the client and server are consistent)

Restart service

-m refers to the search mode

-t is dynamic search

-p is the port of the specified server (IP + port)

Enter the command (the prompt message below will appear)

 5. Login

When the prompt message above appears, you can log in.

Enter lsblk (the most primitive state in the system)

 

 There is only one sr0 disk and no other disks

Log in after finding the server shared resource

 After the prompt message appears, enter lsblk (it should be displayed successfully)

 It shows that my current client does not have a large storage space, but the server uses shared storage. Once the shared part is found, you can log in to this part of the space and mount it for local use (based on the shared storage used by the network)

To prevent device conflicts, UUID (unique identifier of the device) is used. Because the device is unique, the device name is not used but the UUID is used for mounting.

 Enter the command blkid to view the UUID

 But there is no sdb, so you need to format it

Enter fdisk /dev/sdb

 Enter mkfs -f xfs /dev/sdb1 to format

 Check blkid after formatting

Guess you like

Origin blog.csdn.net/Mapinyi666/article/details/131850005