5.iSCSI Remote Block Storage **********
# #1. iSCSI Concept # #
ISCSI (Internet SCSI) supports sending SCSI commands to SCSI storage devices (targets) on remote servers from the client (initiator) via IP. The iSCSI qualified name is used to determine the originating
End and Target , and in Iqn.yyyy-mm.{reverse Domain}:label format. By default, network traffic is clear text to the port 3260/tcp on the iSCSI target.
~iSCSI Initiator: Clients that need access to raw SAN storage.
~iSCSI Target: A remote hard disk from an iSCSI server, or a "target portal"
~iSCSI Target Portal: The server that provides the target to the initiator through the network.
~ IQN: "iSCSI qualified name". Each initiator and target requires a unique name to identify, and the best practice is to use a name that may be unique on the Internet.
# #2. iSCSI Server Configuration # #
To Install the server package: Yum Install targetcli-y
Start the service: systenctl start target
Enter interactive configuration mode: targetcli
before the experiment, first divide a partition with Fdisk/dev/vdb
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8B/B4/wKioL1hWmCHRitxzAADaYKku1uQ198.png "style=" float: none; "title=" Image 1.png "alt=" Wkiol1hwmchritxzaadaykku1uq198.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8B/B4/wKioL1hWmCLBbLbuAAEoz3dOyYk296.png "style=" float: none; "title=" Image 2.png "alt=" Wkiol1hwmclbblbuaaeoz3doyyk296.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/B8/wKiom1hWmCOwA8tzAAFA4pjS35g380.png "style=" float: none; "title=" Image 3.png "alt=" Wkiom1hwmcowa8tzaafa4pjs35g380.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/B8/wKiom1hWmCWiVFA8AAGIyrCWtCs748.png "style=" float: none; "title=" Image 4.png "alt=" Wkiom1hwmcwivfa8aagiyrcwtcs748.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8B/B4/wKioL1hWmCbi-9RTAAD49G6vQ7s849.png "style=" float: none; "title=" Image 5.png "alt=" Wkiol1hwmcbi-9rtaad49g6vq7s849.png "/>
Close firewall
Systemctl Stop Firewalld
# #3. Client Configuration # #
1. Install the client package:yum Install iscsi-initiator-utils
2. Set the initiator's IQN in /ETC/ISCSI/INITIATORNAME.ISCSI:
Initiatorname=iqn.2016-12.com.example : Key 1
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8B/B8/wKiom1hWmD-gbS8nAAAlfgJZuYE666.png "style=" float: none; "title=" Image 6.png "alt=" Wkiom1hwmd-gbs8naaalfgjzuye666.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/8B/B4/wKioL1hWmKPBlIWTAAAU6yYpnFI494.png "title=" Picture 1.png "alt=" Wkiol1hwmkpbliwtaaau6yypnfi494.png "/>
3. find iSCSI targets provided by iSCSI servers (target portal)
Iscsiadm-m discovery-t st-p 172.25.254.108 (server IP)
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/8B/B4/wKioL1hWmD-Ckp5OAAA5iCvkLd0892.png "title=" Picture 7.png "style=" Float:none; "alt=" Wkiol1hwmd-ckp5oaaa5icvkld0892.png "/>
log on to one or more iSCSI targets on the server
iscsiadm-m node-t iqn.2016-12.com.example:storage1-p 172.25.254.108-l650) this.width=650; "src=" http:// S1.51cto.com/wyfs02/m01/8b/b8/wkiom1hwme-gucb7aabq-f2undo807.png "title=" image 8.png "alt=" Wkiom1hwme-gucb7aabq-f2undo807.png "/>
at this point , you can use an iSCSI disk as if it were a locally attached hard drive. For example, a partition is formatted with a file system or as a physical volume of LVM.
Note: permanently mount the file system in/etc/fstab
1. Use Blkid to determine the file system UUID and use the UUID mount instead of the/dev/sd* device name. (The device name that is displayed at each boot is different, depending on the iSCSI device
the order in which the network responds. If you mount by device name , this causes the wrong device to be used. )
2. use _netdev as Mount option in /etc/fstab. (This ensures that the client does not attempt to mount the file system until networking is enabled.) Otherwise, the system will fail at boot time. )
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8B/B8/wKiom1hWmLuQXlMTAAAVBuX7Hj8235.png "style=" float: none; "title=" Image 9.png "alt=" Wkiom1hwmluqxlmtaaavbux7hj8235.png "/>
3. Ensure that the iSCSI service starts at boot time.
# #4. Interrupt using iSCSI Target # #
Make sure you are not using any of the devices provided by the target.
ensure that all permanent mounts using the target are removed from locations such as/etc/fstab.
exit the iSCSI target to temporarily disconnect.
iscsiadm-m Node -t iqn. 2016-12.com.example:storge1 - u
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/8B/B4/wKioL1hWmLyRB1BBAAAV3fd7lZ8355.png "title=" Picture 10.png "style=" Float:none; "alt=" Wkiol1hwmlyrb1bbaaav3fd7lz8355.png "/>
Delete The local record of the iSCSI target to permanently disconnect.
# iscsiadm-m node-t iqn. 2016-12.com.example:storge1 - o Delete
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/8B/B4/wKioL1hWmLyxyA0KAAAVcxDaZmo841.png "title=" Picture 11.png "style=" Float:none; "alt=" Wkiol1hwmlyxya0kaaavcxdazmo841.png "/>
Linux notes 3-5 iSCSI remote block storage