Install iSCSI in CentOS 6.6

Source: Internet
Author: User

Install iSCSI in CentOS 6.6

I. Introduction to ISCSI

ISCSI, internet SCSI, also known as IP-SAN, is a standard developed by IETF to map SCSI data blocks into Ethernet packets. ISCSI is a TCP/IP-based protocol used to establish and manage the connection between IP storage devices, hosts and clients, and create a storage area network (SAN ). SAN makes it possible to apply the SCSI protocol to high-speed data transmission networks. Such transmission is performed between multiple data storage networks at the block-level. The SCSI structure is based on the C/S mode. The common application environment is that devices are close to each other and these devices are connected by the SCSI bus.

The main function of iSCSI is to encapsulate and reliably transmit large amounts of data between the host system (initiator) and the storage device (target) on the TCP/IP network.

Basically, the iSCSI protocol is a method to transmit SCSI data blocks with short latencies over an IP network.

The complete iSCSI system topology is as follows:

Compared with traditional SCSI technology, iSCSI technology has the following three revolutionary changes:

  1. The original SCSI used only on the local machine is transmitted through the TCP/IP network, so that the connection distance can be extended in an unlimited region;
  2.  
  3. The number of connected servers is infinite (the upper limit of the original SCSI-3 is 15 );
  4.  
  5. Because it is a server architecture, online resizing and dynamic deployment can also be realized.

ISCSI protocol structure:

-------------------------------------- Split line --------------------------------------

Mount iSCSI network storage in CentOS 6.4

Web Service shared storage cluster architecture based on RHCS + iSCSI + CLVM

Configure iSCSI storage and multi-path functions in Linux

Build an ip san-based iSCSI Storage System

ISCSI connection failure Solution

Install CentOS 6.0 and configure the iSCSI service in Citrix XenServer

CentOS 5.3 mounts storage cabinets with iSCSI

Takes you three steps to quickly learn how to build iSCSI

-------------------------------------- Split line --------------------------------------

2. Build an ip san-based ISCSI Storage System

  1. Planning:
  2.  
  3. Environment: CentOS 6.6 32-bit
  4.  
  5. Server IP Address: 192.168.1.43
  6.  
  7. Client IP Address: 192.168.1.111
  8.  
  9. Shared Disk:/dev/sdb

1. Configure the server

  1. [Root @ localhost ~] # Yum-y install scsi-target-utils # install the server software
  2.  
  3. [Root @ node1 iscsi] # rpm-ql scsi-target-utils
  4. /Etc/rc. d/init. d/tgtd
  5. /Etc/sysconfig/tgtd
  6. /Etc/tgt/targets. conf # configuration file
  7. /Usr/sbin/tgt-admin
  8. /Usr/sbin/tgt-setup-lun
  9. /Usr/sbin/tgtadm
  10. /Usr/sbin/tgtd
  11. /Usr/sbin/tgtimg
  12. /Usr/share/doc/scsi-target-utils-1.0.24
  13. /Usr/share/doc/scsi-target-utils-1.0.24/README
  14. /Usr/share/doc/scsi-target-utils-1.0.24/README. iscsi
  15. /Usr/share/doc/scsi-target-utils-1.0.24/README. iser
  16. /Usr/share/doc/scsi-target-utils-1.0.24/README. lu_configuration
  17. /Usr/share/doc/scsi-target-utils-1.0.24/README. mmc
  18. /Usr/share/man/man5/targets.conf.5.gz
  19. /Usr/share/man/man8/tgt-admin.8.gz
  20. /Usr/share/man/man8/tgt-setup-lun.8.gz
  21. /Usr/share/man/man8/tgtadm.8.gz
  22.  
  23. [Root @ localhost ~] # Lsmod | grep scsi
  24. Mptscsih 31330 1 mptspi
  25. Mptbase 86744 2 mptspi, mptscsih
  26. Scsi_transport_spi 19726 1 mptspi # Advanced Driver

Iscsi can be configured using commands or configuration files. We first use the command line for Configuration:

  1. [Root @ node1 iscsi] # service tgtd start
  2. Starting SCSI target daemon: [OK]
  3.  
  4. [Root @ node1 iscsi] # ss-tlnp | grep 3260 # Listening on port 3260
  5. LISTEN 0 128: 3260: * users :( ("tgtd", 1188), ("tgtd", 11885 ))
  6. LISTEN 0 128 *: 3260 *: * users :( ("tgtd", 11882, 4), ("tgtd", 11885, 4 ))
  7.  
  8. [Root @ localhost ~] # Tgtadm-L iscsi-o new-m target-t 1-T iqn.2015-08.com. feiyu. testsan: 1 # create a target,-t specify TID,-T specify name

Iqn indicates "ISCSI Qualified Name", or iqn for short.

  1. [Root @ localhost ~] # Tgtadm-L iscsi-o show-m target
  2. Target 1: iqn.2015-08.com. feiyu. testsan: 1
  3. System information:
  4. Driver: iscsi
  5. State: ready
  6. I _T nexus information:
  7. LUN information:
  8. LUN: 0
  9. Type: controller
  10. Scsi id: IET 00010000
  11. Scsi sn: beaf10
  12. Size: 0 MB, Block size: 1
  13. Online: Yes
  14. Removable media: No
  15. Prevent removal: No
  16. Readonly: No
  17. Backing store type: null
  18. Backing store path: None
  19. Backing store flags:
  20. Account information:
  21. ACL information:

Then, set the LUN (Logical Unit Number). On the server side, you only need to create partitions without formatting:

  1. [Root @ localhost ~] # Tgtadm-L iscsi-o new-m logicalunit-t 1-l 1-B/dev/sdb5 # create a LUN,-m indicates the mode,-l: LUN, -B: Device
  2.  
  3. [Root @ localhost ~] # Tgtadm-L iscsi-o bind-m target-t 1-I 192.168.0.0/16
  4.  
  5. [Root @ node1 iscsi] # tgtadm-L iscsi-o show-m target
  6. Target 1: iqn.2015-08.com. feiyu. testsan: 1
  7. System information:
  8. Driver: iscsi
  9. State: ready
  10. I _T nexus information:
  11. LUN information:
  12. LUN: 0
  13. Type: controller
  14. Scsi id: IET 00010000
  15. Scsi sn: beaf10
  16. Size: 0 MB, Block size: 1
  17. Online: Yes
  18. Removable media: No
  19. Prevent removal: No
  20. Readonly: No
  21. Backing store type: null
  22. Backing store path: None
  23. Backing store flags:
  24. LUN: 1
  25. Type: disk
  26. Scsi id: IET 00010001
  27. Scsi sn: beaf11
  28. Size: 2107 MB, Block size: 512
  29. Online: Yes
  30. Removable media: No
  31. Prevent removal: No
  32. Readonly: No
  33. Backing store type: rdwr
  34. Backing store path:/dev/sdb5
  35. Backing store flags:
  36. Account information:
  37. ACL information:
  38.  
  39. [Root @ node1 iscsi] # tgtadm-L iscsi-o bind-m target-t 1-I 192.168.0.0/16 # Set the shared area
  40. [Root @ node1 iscsi] # tgtadm-L iscsi-o show-m target
  41. Target 1: iqn.2015-08.com. feiyu. testsan: 1
  42. System information:
  43. Driver: iscsi
  44. State: ready
  45. I _T nexus information:
  46. LUN information:
  47. LUN: 0
  48. Type: controller
  49. Scsi id: IET 00010000
  50. Scsi sn: beaf10
  51. Size: 0 MB, Block size: 1
  52. Online: Yes
  53. Removable media: No
  54. Prevent removal: No
  55. Readonly: No
  56. Backing store type: null
  57. Backing store path: None
  58. Backing store flags:
  59. LUN: 1
  60. Type: disk
  61. Scsi id: IET 00010001
  62. Scsi sn: beaf11
  63. Size: 2107 MB, Block size: 512
  64. Online: Yes
  65. Removable media: No
  66. Prevent removal: No
  67. Readonly: No
  68. Backing store type: rdwr
  69. Backing store path:/dev/sda5
  70. Backing store flags:
  71. Account information:
  72. ACL information:
  73. 192.168.0.0/16
  74.  
  75. [Root @ localhost ~] # Tgtadm-L iscsi-o new-m logicalunit-t 1-l 2-B/dev/sdb6 # bind the second LUN

2. Configure the client

  1. [Root @ node1 ~] # Yum install-y iscsi-initiator-utils # install the client
  2.  
  3.  
  4. [Root @ node1 iscsi] # echo "InitiatorName = 'iscsi-iname-p iqn.2013-05.com. feiyu '">/etc/iscsi/initiatorname. iscsi # generate iqn
  5. [Root @ node1 iscsi] # echo "InitiatorAlias = initiator1">/etc/iscsi/initiatorname. iscsi # define an alias
  6.  
  7. [Root @ node1 iscsi] # ls
  8. Initiatorname. iscsi iscsid. conf
  9. [Root @ node1 iscsi] # cat initiatorname. iscsi # view the defined data
  10. InitiatorName = iqn.2015-08.com. feiyu: 201734bd52221
  11. InitiatorAlias = initiator1
  12.  
  13. [Root @ node1 ~] # Service iscsi start # start the service. You need to start two services.
  14. [Root @ node1 ~] # Service iscsid start
  15. [Root @ node1 ~] # Chkconfig iscsi on
  16. [Root @ node1 ~] # Chkconfig iscsid on

If the following error occurs, the firewall on the server may be irrelevant!

  1. [Root @ node1 ~] # Iscsiadm-m discovery-t st-p 192.168.1.43
  2. Starting iscsid: [OK]
  3. Iscsiadm: cannot make connection to 192.168.1.43: No route to host
  4.  
  5. [Root @ node1 ~] # Iscsiadm-m discovery-t st-p 192.168.1.43 # Test
  6. 192.168.1.43: 3260,1 iqn.2015-08.com. feiyu. testsan: 1
  7.  
  8. [Root @ node1 ~] # Iscsiadm-m node-T iqn.2015-08.com. feiyu. testsan: 1-p 192.168.1.43-l # login node
  9. Logging in to [iface: default, target: iqn.2015-08.com. feiyu. testsan: 1, portal: 192.168.1.43, 3260] (multiple)
  10. Login to [iface: default, target: iqn.2015-08.com. feiyu. testsan: 1, portal: 192.168.1.43, 3260] successful.
  11.  
  12. [Root @ node1 ~] # Fdisk-l # a hard disk is added after logon,
  13.  
  14. Disk/dev/sda: 21.5 GB, 21474836480 bytes
  15. 255 heads, 63 sectors/track, 2610 cylinders
  16. Units = cylinders of 16065*512 = 8225280 bytes
  17. Sector size (logical/physical): 512 bytes/512 bytes
  18. I/O size (minimum/optimal): 512 bytes/512 bytes
  19. Disk identifier: 0x0006d052
  20.  
  21. Device Boot Start End Blocks Id System
  22. /Dev/sda1*1 39 307200 83 Linux
  23. Partition 1 does not end on cylinder boundary.
  24. /Dev/sda2 39 2354 18598912 83 Linux
  25. /Dev/sda3 2354 2610 2057689 5 Extended
  26. /Dev/sda5 2354 2610 2057657 + 83 Linux
  27.  
  28. Disk/dev/sdc: 10.7 GB, 10742183424 bytes -------> iscsi Device
  29. 64 heads, 32 sectors/track, 10244 cylinders
  30. Units = cylinders of 2048*512 = 1048576 bytes
  31. Sector size (logical/physical): 512 bytes/512 bytes
  32. I/O size (minimum/optimal): 512 bytes/512 bytes
  33. Disk identifier: 0x00000000

Create a partition for the disk and format it.

  1. [Root @ node1 ~] # Mke2fs-t ext4/dev/sdc1

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.