iscsl安装挂载

sever安装配置

# 安装所需包
[root@iscsi-server ~]# yum -y install targetd targetcli python-rtslib
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                                  | 3.6 kB  00:00:00     
epel                                                                                                                  | 4.7 kB  00:00:00     
extras                                                                                                                | 2.9 kB  00:00:00     
updates                                                                                                               | 2.9 kB  00:00:00     
(1/7): base/7/x86_64/group_gz                                                                                         | 153 kB  00:00:00     
(2/7): epel/x86_64/updateinfo                                                                                         | 1.0 MB  00:00:00     
(3/7): epel/x86_64/group_gz                                                                                           |  99 kB  00:00:00     
(4/7): base/7/x86_64/primary_db                                                                                       | 6.1 MB  00:00:00     
(5/7): epel/x86_64/primary_db                                                                                         | 7.0 MB  00:00:00     
(6/7): extras/7/x86_64/primary_db                                                                                     | 250 kB  00:00:00     
(7/7): updates/7/x86_64/primary_db                                                                                    |  22 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package python-rtslib.noarch 0:2.1.74-1.el7_9 will be installed
--> Processing Dependency: python-kmod for package: python-rtslib-2.1.74-1.el7_9.noarch
---> Package targetcli.noarch 0:2.1.53-1.el7_9 will be installed
--> Processing Dependency: python-ethtool for package: targetcli-2.1.53-1.el7_9.noarch
--> Processing Dependency: python-configshell for package: targetcli-2.1.53-1.el7_9.noarch
---> Package targetd.noarch 0:0.8.6-1.el7 will be installed
--> Processing Dependency: lvm2-python-libs >= 2.02.99 for package: targetd-0.8.6-1.el7.noarch
--> Processing Dependency: python-setproctitle for package: targetd-0.8.6-1.el7.noarch
--> Processing Dependency: nfs-utils for package: targetd-0.8.6-1.el7.noarch
--> Processing Dependency: PyYAML for package: targetd-0.8.6-1.el7.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package lvm2-python-libs.x86_64 7:2.02.187-6.el7_9.5 will be installed
--> Processing Dependency: lvm2-libs = 7:2.02.187-6.el7_9.5 for package: 7:lvm2-python-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: liblvm2app.so.2.2(Base)(64bit) for package: 7:lvm2-python-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: liblvm2app.so.2.2()(64bit) for package: 7:lvm2-python-libs-2.02.187-6.el7_9.5.x86_64
---> Package nfs-utils.x86_64 1:1.3.0-0.68.el7.2 will be installed
--> Processing Dependency: gssproxy >= 0.7.0-3 for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: quota for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: libevent for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: keyutils for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
--> Processing Dependency: libevent-2.0.so.5()(64bit) for package: 1:nfs-utils-1.3.0-0.68.el7.2.x86_64
---> Package python-configshell.noarch 1:1.1.26-1.el7 will be installed
--> Processing Dependency: python-urwid for package: 1:python-configshell-1.1.26-1.el7.noarch
--> Processing Dependency: pyparsing for package: 1:python-configshell-1.1.26-1.el7.noarch
---> Package python-ethtool.x86_64 0:0.8-8.el7 will be installed
--> Processing Dependency: libnl.so.1()(64bit) for package: python-ethtool-0.8-8.el7.x86_64
---> Package python-kmod.x86_64 0:0.9-4.el7 will be installed
---> Package python-setproctitle.x86_64 0:1.1.6-5.el7 will be installed
--> Running transaction check
---> Package gssproxy.x86_64 0:0.7.0-30.el7_9 will be installed
--> Processing Dependency: libini_config >= 1.3.1-31 for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libverto-module-base for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libref_array.so.1(REF_ARRAY_0.1.1)(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libini_config.so.3(INI_CONFIG_1.2.0)(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libini_config.so.3(INI_CONFIG_1.1.0)(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libref_array.so.1()(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libini_config.so.3()(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libcollection.so.2()(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
--> Processing Dependency: libbasicobjects.so.0()(64bit) for package: gssproxy-0.7.0-30.el7_9.x86_64
---> Package keyutils.x86_64 0:1.5.8-3.el7 will be installed
---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed
---> Package libnfsidmap.x86_64 0:0.25-19.el7 will be installed
---> Package libnl.x86_64 0:1.1.4-3.el7 will be installed
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package lvm2-libs.x86_64 7:2.02.187-6.el7_9.5 will be installed
--> Processing Dependency: device-mapper-event = 7:1.02.170-6.el7_9.5 for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02(Base)(64bit) for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02()(64bit) for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
---> Package pyparsing.noarch 0:1.5.6-9.el7 will be installed
---> Package python-urwid.x86_64 0:1.1.1-3.el7 will be installed
---> Package quota.x86_64 1:4.01-19.el7 will be installed
--> Processing Dependency: quota-nls = 1:4.01-19.el7 for package: 1:quota-4.01-19.el7.x86_64
--> Processing Dependency: tcp_wrappers for package: 1:quota-4.01-19.el7.x86_64
---> Package rpcbind.x86_64 0:0.2.0-49.el7 will be installed
--> Running transaction check
---> Package device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 will be installed
---> Package device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5 will be installed
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package libbasicobjects.x86_64 0:0.1.1-32.el7 will be installed
---> Package libcollection.x86_64 0:0.7.0-32.el7 will be installed
---> Package libini_config.x86_64 0:1.3.1-32.el7 will be installed
--> Processing Dependency: libpath_utils.so.1(PATH_UTILS_0.2.1)(64bit) for package: libini_config-1.3.1-32.el7.x86_64
--> Processing Dependency: libpath_utils.so.1()(64bit) for package: libini_config-1.3.1-32.el7.x86_64
---> Package libref_array.x86_64 0:0.1.5-32.el7 will be installed
---> Package libverto-libevent.x86_64 0:0.2.5-4.el7 will be installed
---> Package quota-nls.noarch 1:4.01-19.el7 will be installed
---> Package tcp_wrappers.x86_64 0:7.6-77.el7 will be installed
--> Running transaction check
---> Package libpath_utils.x86_64 0:0.2.1-32.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                    Arch                     Version                                 Repository                 Size
=============================================================================================================================================
Installing:
 python-rtslib                              noarch                   2.1.74-1.el7_9                          updates                   104 k
 targetcli                                  noarch                   2.1.53-1.el7_9                          updates                    75 k
 targetd                                    noarch                   0.8.6-1.el7                             base                       56 k
Installing for dependencies:
 PyYAML                                     x86_64                   3.10-11.el7                             base                      153 k
 device-mapper-event                        x86_64                   7:1.02.170-6.el7_9.5                    updates                   192 k
 device-mapper-event-libs                   x86_64                   7:1.02.170-6.el7_9.5                    updates                   192 k
 gssproxy                                   x86_64                   0.7.0-30.el7_9                          updates                   111 k
 keyutils                                   x86_64                   1.5.8-3.el7                             base                       54 k
 libaio                                     x86_64                   0.3.109-13.el7                          base                       24 k
 libbasicobjects                            x86_64                   0.1.1-32.el7                            base                       26 k
 libcollection                              x86_64                   0.7.0-32.el7                            base                       42 k
 libevent                                   x86_64                   2.0.21-4.el7                            base                      214 k
 libini_config                              x86_64                   1.3.1-32.el7                            base                       64 k
 libnfsidmap                                x86_64                   0.25-19.el7                             base                       50 k
 libnl                                      x86_64                   1.1.4-3.el7                             base                      128 k
 libpath_utils                              x86_64                   0.2.1-32.el7                            base                       28 k
 libref_array                               x86_64                   0.1.5-32.el7                            base                       27 k
 libverto-libevent                          x86_64                   0.2.5-4.el7                             base                      8.9 k
 libyaml                                    x86_64                   0.1.4-11.el7_0                          base                       55 k
 lvm2-libs                                  x86_64                   7:2.02.187-6.el7_9.5                    updates                   1.1 M
 lvm2-python-libs                           x86_64                   7:2.02.187-6.el7_9.5                    updates                   189 k
 nfs-utils                                  x86_64                   1:1.3.0-0.68.el7.2                      updates                   413 k
 pyparsing                                  noarch                   1.5.6-9.el7                             base                       94 k
 python-configshell                         noarch                   1:1.1.26-1.el7                          base                       68 k
 python-ethtool                             x86_64                   0.8-8.el7                               base                       34 k
 python-kmod                                x86_64                   0.9-4.el7                               base                       57 k
 python-setproctitle                        x86_64                   1.1.6-5.el7                             base                       15 k
 python-urwid                               x86_64                   1.1.1-3.el7                             base                      654 k
 quota                                      x86_64                   1:4.01-19.el7                           base                      179 k
 quota-nls                                  noarch                   1:4.01-19.el7                           base                       90 k
 rpcbind                                    x86_64                   0.2.0-49.el7                            base                       60 k
 tcp_wrappers                               x86_64                   7.6-77.el7                              base                       78 k

Transaction Summary
=============================================================================================================================================
Install  3 Packages (+29 Dependent packages)

Total download size: 4.5 M
Installed size: 14 M
Downloading packages:
(1/32): device-mapper-event-1.02.170-6.el7_9.5.x86_64.rpm                                                             | 192 kB  00:00:00     
(2/32): gssproxy-0.7.0-30.el7_9.x86_64.rpm                                                                            | 111 kB  00:00:00     
(3/32): PyYAML-3.10-11.el7.x86_64.rpm                                                                                 | 153 kB  00:00:00     
(4/32): device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64.rpm                                                        | 192 kB  00:00:00     
(5/32): libaio-0.3.109-13.el7.x86_64.rpm                                                                              |  24 kB  00:00:00     
(6/32): libbasicobjects-0.1.1-32.el7.x86_64.rpm                                                                       |  26 kB  00:00:00     
(7/32): libcollection-0.7.0-32.el7.x86_64.rpm                                                                         |  42 kB  00:00:00     
(8/32): libevent-2.0.21-4.el7.x86_64.rpm                                                                              | 214 kB  00:00:00     
(9/32): libini_config-1.3.1-32.el7.x86_64.rpm                                                                         |  64 kB  00:00:00     
(10/32): libnfsidmap-0.25-19.el7.x86_64.rpm                                                                           |  50 kB  00:00:00     
(11/32): libnl-1.1.4-3.el7.x86_64.rpm                                                                                 | 128 kB  00:00:00     
(12/32): libpath_utils-0.2.1-32.el7.x86_64.rpm                                                                        |  28 kB  00:00:00     
(13/32): libref_array-0.1.5-32.el7.x86_64.rpm                                                                         |  27 kB  00:00:00     
(14/32): libverto-libevent-0.2.5-4.el7.x86_64.rpm                                                                     | 8.9 kB  00:00:00     
(15/32): libyaml-0.1.4-11.el7_0.x86_64.rpm                                                                            |  55 kB  00:00:00     
(16/32): keyutils-1.5.8-3.el7.x86_64.rpm                                                                              |  54 kB  00:00:00     
(17/32): lvm2-libs-2.02.187-6.el7_9.5.x86_64.rpm                                                                      | 1.1 MB  00:00:00     
(18/32): nfs-utils-1.3.0-0.68.el7.2.x86_64.rpm                                                                        | 413 kB  00:00:00     
(19/32): lvm2-python-libs-2.02.187-6.el7_9.5.x86_64.rpm                                                               | 189 kB  00:00:00     
(20/32): pyparsing-1.5.6-9.el7.noarch.rpm                                                                             |  94 kB  00:00:00     
(21/32): python-ethtool-0.8-8.el7.x86_64.rpm                                                                          |  34 kB  00:00:00     
(22/32): python-configshell-1.1.26-1.el7.noarch.rpm                                                                   |  68 kB  00:00:00     
(23/32): python-kmod-0.9-4.el7.x86_64.rpm                                                                             |  57 kB  00:00:00     
(24/32): python-setproctitle-1.1.6-5.el7.x86_64.rpm                                                                   |  15 kB  00:00:00     
(25/32): quota-4.01-19.el7.x86_64.rpm                                                                                 | 179 kB  00:00:00     
(26/32): quota-nls-4.01-19.el7.noarch.rpm                                                                             |  90 kB  00:00:00     
(27/32): rpcbind-0.2.0-49.el7.x86_64.rpm                                                                              |  60 kB  00:00:00     
(28/32): python-urwid-1.1.1-3.el7.x86_64.rpm                                                                          | 654 kB  00:00:00     
(29/32): tcp_wrappers-7.6-77.el7.x86_64.rpm                                                                           |  78 kB  00:00:00     
(30/32): python-rtslib-2.1.74-1.el7_9.noarch.rpm                                                                      | 104 kB  00:00:00     
(31/32): targetcli-2.1.53-1.el7_9.noarch.rpm                                                                          |  75 kB  00:00:00     
(32/32): targetd-0.8.6-1.el7.noarch.rpm                                                                               |  56 kB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        4.4 MB/s | 4.5 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64                                                                     1/32 
  Installing : libref_array-0.1.5-32.el7.x86_64                                                                                         2/32 
  Installing : libcollection-0.7.0-32.el7.x86_64                                                                                        3/32 
  Installing : libevent-2.0.21-4.el7.x86_64                                                                                             4/32 
  Installing : rpcbind-0.2.0-49.el7.x86_64                                                                                              5/32 
  Installing : libbasicobjects-0.1.1-32.el7.x86_64                                                                                      6/32 
  Installing : libverto-libevent-0.2.5-4.el7.x86_64                                                                                     7/32 
  Installing : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64                                                                          8/32 
  Installing : 1:quota-nls-4.01-19.el7.noarch                                                                                           9/32 
  Installing : libnl-1.1.4-3.el7.x86_64                                                                                                10/32 
  Installing : python-ethtool-0.8-8.el7.x86_64                                                                                         11/32 
  Installing : keyutils-1.5.8-3.el7.x86_64                                                                                             12/32 
  Installing : libnfsidmap-0.25-19.el7.x86_64                                                                                          13/32 
  Installing : libyaml-0.1.4-11.el7_0.x86_64                                                                                           14/32 
  Installing : PyYAML-3.10-11.el7.x86_64                                                                                               15/32 
  Installing : python-kmod-0.9-4.el7.x86_64                                                                                            16/32 
  Installing : python-rtslib-2.1.74-1.el7_9.noarch                                                                                     17/32 
  Installing : libpath_utils-0.2.1-32.el7.x86_64                                                                                       18/32 
  Installing : libini_config-1.3.1-32.el7.x86_64                                                                                       19/32 
  Installing : gssproxy-0.7.0-30.el7_9.x86_64                                                                                          20/32 
  Installing : python-urwid-1.1.1-3.el7.x86_64                                                                                         21/32 
  Installing : libaio-0.3.109-13.el7.x86_64                                                                                            22/32 
  Installing : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64                                                                                   23/32 
  Installing : 7:lvm2-python-libs-2.02.187-6.el7_9.5.x86_64                                                                            24/32 
  Installing : tcp_wrappers-7.6-77.el7.x86_64                                                                                          25/32 
  Installing : 1:quota-4.01-19.el7.x86_64                                                                                              26/32 
  Installing : 1:nfs-utils-1.3.0-0.68.el7.2.x86_64                                                                                     27/32 
  Installing : python-setproctitle-1.1.6-5.el7.x86_64                                                                                  28/32 
  Installing : pyparsing-1.5.6-9.el7.noarch                                                                                            29/32 
  Installing : 1:python-configshell-1.1.26-1.el7.noarch                                                                                30/32 
  Installing : targetcli-2.1.53-1.el7_9.noarch                                                                                         31/32 
  Installing : targetd-0.8.6-1.el7.noarch                                                                                              32/32 
  Verifying  : gssproxy-0.7.0-30.el7_9.x86_64                                                                                           1/32 
  Verifying  : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64                                                                          2/32 
  Verifying  : python-ethtool-0.8-8.el7.x86_64                                                                                          3/32 
  Verifying  : targetcli-2.1.53-1.el7_9.noarch                                                                                          4/32 
  Verifying  : libbasicobjects-0.1.1-32.el7.x86_64                                                                                      5/32 
  Verifying  : pyparsing-1.5.6-9.el7.noarch                                                                                             6/32 
  Verifying  : 1:nfs-utils-1.3.0-0.68.el7.2.x86_64                                                                                      7/32 
  Verifying  : rpcbind-0.2.0-49.el7.x86_64                                                                                              8/32 
  Verifying  : python-setproctitle-1.1.6-5.el7.x86_64                                                                                   9/32 
  Verifying  : tcp_wrappers-7.6-77.el7.x86_64                                                                                          10/32 
  Verifying  : 7:lvm2-python-libs-2.02.187-6.el7_9.5.x86_64                                                                            11/32 
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                                            12/32 
  Verifying  : libini_config-1.3.1-32.el7.x86_64                                                                                       13/32 
  Verifying  : targetd-0.8.6-1.el7.noarch                                                                                              14/32 
  Verifying  : python-urwid-1.1.1-3.el7.x86_64                                                                                         15/32 
  Verifying  : libpath_utils-0.2.1-32.el7.x86_64                                                                                       16/32 
  Verifying  : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64                                                                                   17/32 
  Verifying  : libevent-2.0.21-4.el7.x86_64                                                                                            18/32 
  Verifying  : libverto-libevent-0.2.5-4.el7.x86_64                                                                                    19/32 
  Verifying  : libcollection-0.7.0-32.el7.x86_64                                                                                       20/32 
  Verifying  : libref_array-0.1.5-32.el7.x86_64                                                                                        21/32 
  Verifying  : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64                                                                    22/32 
  Verifying  : python-kmod-0.9-4.el7.x86_64                                                                                            23/32 
  Verifying  : 1:python-configshell-1.1.26-1.el7.noarch                                                                                24/32 
  Verifying  : libyaml-0.1.4-11.el7_0.x86_64                                                                                           25/32 
  Verifying  : 1:quota-4.01-19.el7.x86_64                                                                                              26/32 
  Verifying  : libnfsidmap-0.25-19.el7.x86_64                                                                                          27/32 
  Verifying  : keyutils-1.5.8-3.el7.x86_64                                                                                             28/32 
  Verifying  : python-rtslib-2.1.74-1.el7_9.noarch                                                                                     29/32 
  Verifying  : libnl-1.1.4-3.el7.x86_64                                                                                                30/32 
  Verifying  : PyYAML-3.10-11.el7.x86_64                                                                                               31/32 
  Verifying  : 1:quota-nls-4.01-19.el7.noarch                                                                                          32/32 

Installed:
  python-rtslib.noarch 0:2.1.74-1.el7_9              targetcli.noarch 0:2.1.53-1.el7_9              targetd.noarch 0:0.8.6-1.el7             

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7           device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5
  gssproxy.x86_64 0:0.7.0-30.el7_9      keyutils.x86_64 0:1.5.8-3.el7                   libaio.x86_64 0:0.3.109-13.el7                      
  libbasicobjects.x86_64 0:0.1.1-32.el7 libcollection.x86_64 0:0.7.0-32.el7             libevent.x86_64 0:2.0.21-4.el7                      
  libini_config.x86_64 0:1.3.1-32.el7   libnfsidmap.x86_64 0:0.25-19.el7                libnl.x86_64 0:1.1.4-3.el7                          
  libpath_utils.x86_64 0:0.2.1-32.el7   libref_array.x86_64 0:0.1.5-32.el7              libverto-libevent.x86_64 0:0.2.5-4.el7              
  libyaml.x86_64 0:0.1.4-11.el7_0       lvm2-libs.x86_64 7:2.02.187-6.el7_9.5           lvm2-python-libs.x86_64 7:2.02.187-6.el7_9.5        
  nfs-utils.x86_64 1:1.3.0-0.68.el7.2   pyparsing.noarch 0:1.5.6-9.el7                  python-configshell.noarch 1:1.1.26-1.el7            
  python-ethtool.x86_64 0:0.8-8.el7     python-kmod.x86_64 0:0.9-4.el7                  python-setproctitle.x86_64 0:1.1.6-5.el7            
  python-urwid.x86_64 0:1.1.1-3.el7     quota.x86_64 1:4.01-19.el7                      quota-nls.noarch 1:4.01-19.el7                      
  rpcbind.x86_64 0:0.2.0-49.el7         tcp_wrappers.x86_64 0:7.6-77.el7               

Complete!

# 启动服务
[root@iscsi-server ~]# systemctl start target
[root@iscsi-server ~]# systemctl enable target
Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.

# 发布磁盘进入命令界面
[root@iscsi-server ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 0]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 0]
  o- loopback ......................................................................................................... [Targets: 0] 

# 指定发布的磁盘(块设备LUN)
/> /backstores/block create server0.disk1 /dev/sdb1 
Created block storage object server0.disk1 using /dev/sdb1.

# 创建iqn名字即iscsi对象,注意:命名格式必须正确,2023-09,少0也不行
/> /iscsi create iqn.2023-09.com.bdqn:disk1
Created target iqn.2023-09.com.bdqn:disk1.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.

# 设置ACL即将iscsi对象与客户端IP或主机名绑定
/> /iscsi/iqn.2023-09.com.bdqn:disk1/tpg1/acls create iqn.2023-09.com.bdqn:client
Created Node ACL for iqn.2023-09.com.bdqn:client

# 创建LUN并绑定块
/> /iscsi/iqn.2023-09.com.bdqn:disk1/tpg1/luns create /backstores/block/server0.disk1 
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2023-09.com.bdqn:client

# 配置完总览
/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 1]
  | | o- server0.disk1 .................................................................. [/dev/sdb1 (10.0GiB) write-thru activated]
  | |   o- alua ................................................................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 1]
  | o- iqn.2023-09.com.bdqn:disk1 ........................................................................................ [TPGs: 1]
  |   o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
  |     o- acls .......................................................................................................... [ACLs: 1]
  |     | o- iqn.2023-09.com.bdqn:client .......................................................................... [Mapped LUNs: 1]
  |     |   o- mapped_lun0 ......................................................................... [lun0 block/server0.disk1 (rw)]
  |     o- luns .......................................................................................................... [LUNs: 1]
  |     | o- lun0 ............................................................. [block/server0.disk1 (/dev/sdb1) (default_tg_pt_gp)]
  |     o- portals .................................................................................................... [Portals: 1]
  |       o- 0.0.0.0:3260 ..................................................................................................... [OK]
  o- loopback ......................................................................................................... [Targets: 0]

client对接

# 安装所需包
[root@iscsi-client ~]# yum -y install iscsi-initiator-utils
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                                  | 3.6 kB  00:00:00     
epel                                                                                                                  | 4.7 kB  00:00:00     
extras                                                                                                                | 2.9 kB  00:00:00     
updates                                                                                                               | 2.9 kB  00:00:00     
(1/7): base/7/x86_64/group_gz                                                                                         | 153 kB  00:00:00     
(2/7): epel/x86_64/group_gz                                                                                           |  99 kB  00:00:00     
(3/7): epel/x86_64/updateinfo                                                                                         | 1.0 MB  00:00:00     
(4/7): base/7/x86_64/primary_db                                                                                       | 6.1 MB  00:00:00     
(5/7): epel/x86_64/primary_db                                                                                         | 7.0 MB  00:00:00     
(6/7): extras/7/x86_64/primary_db                                                                                     | 250 kB  00:00:00     
(7/7): updates/7/x86_64/primary_db                                                                                    |  22 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package iscsi-initiator-utils.x86_64 0:6.2.0.874-22.el7_9 will be installed
--> Processing Dependency: iscsi-initiator-utils-iscsiuio >= 6.2.0.874-22.el7_9 for package: iscsi-initiator-utils-6.2.0.874-22.el7_9.x86_64
--> Running transaction check
---> Package iscsi-initiator-utils-iscsiuio.x86_64 0:6.2.0.874-22.el7_9 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                         Arch                    Version                              Repository                Size
=============================================================================================================================================
Installing:
 iscsi-initiator-utils                           x86_64                  6.2.0.874-22.el7_9                   updates                  423 k
Installing for dependencies:
 iscsi-initiator-utils-iscsiuio                  x86_64                  6.2.0.874-22.el7_9                   updates                   94 k

Transaction Summary
=============================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 517 k
Installed size: 2.5 M
Downloading packages:
(1/2): iscsi-initiator-utils-iscsiuio-6.2.0.874-22.el7_9.x86_64.rpm                                                   |  94 kB  00:00:00     
(2/2): iscsi-initiator-utils-6.2.0.874-22.el7_9.x86_64.rpm                                                            | 423 kB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        2.5 MB/s | 517 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : iscsi-initiator-utils-iscsiuio-6.2.0.874-22.el7_9.x86_64                                                                  1/2 
  Installing : iscsi-initiator-utils-6.2.0.874-22.el7_9.x86_64                                                                           2/2 
  Verifying  : iscsi-initiator-utils-6.2.0.874-22.el7_9.x86_64                                                                           1/2 
  Verifying  : iscsi-initiator-utils-iscsiuio-6.2.0.874-22.el7_9.x86_64                                                                  2/2 

Installed:
  iscsi-initiator-utils.x86_64 0:6.2.0.874-22.el7_9                                                                                          

Dependency Installed:
  iscsi-initiator-utils-iscsiuio.x86_64 0:6.2.0.874-22.el7_9                                                                                 

Complete!

# 编辑配置文件
[root@iscsi-client ~]# vim /etc/iscsi/initiatorname.iscsi
[root@iscsi-client ~]# cat /etc/iscsi/initiatorname.iscsi 
InitiatorName=iqn.2023-09.com.bdqn:client

# 启动服务
[root@iscsi-client ~]# systemctl start iscsid
[root@iscsi-client ~]# systemctl enable iscsid
Created symlink from /etc/systemd/system/multi-user.target.wants/iscsid.service to /usr/lib/systemd/system/iscsid.service.

# 搜索存储
[root@iscsi-client ~]# iscsiadm -m discovery -t st -p 192.168.100.119
192.168.100.119:3260,1 iqn.2023-09.com.bdqn:disk1

# 登录存储/连接target
[root@iscsi-client ~]# iscsiadm -m discovery -t st -p 192.168.100.119 -l
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值