CentOS 6.8 Linux iSCSI Server Configuration and Client connection iSCSI
First, the service-side configuration
1, first install a variety of packages
Yum Search SCSI
ISCSI-INITIATOR-UTILS.X86_64:ISCSI Daemon and utility programs
iscsi-initiator-utils-devel.x86_64:development files for Iscsi-initiator-utils
Lsscsi.x86_64:List SCSI devices (or hosts) and associated information
Scsi-target-utils.x86_64:the SCSI target daemon and utility programs
LIBHBALINUX.I686:FC-HBAAPI implementation using SCSI_TRANSPORT_FC interfaces
LIBHBALINUX.X86_64:FC-HBAAPI implementation using SCSI_TRANSPORT_FC interfaces
Mtx.x86_64:SCSI Media Changer Control program
Python-rtslib.noarch:api for risingtide Systems generic SCSI target
Sdparm.x86_64:List or change scsi/sata disk parameters
Sg3_utils.x86_64:Utilities for Devices This use SCSI command sets
Execute yum install-y scsi-target-utils.x86_64 iscsi-initiator-utils.x86_64 iscsi-initiator-utils-devel.x86_64
It doesn't hurt to have more decorations.
The machine is divided into 100G, in the installation of the system when the 20G, the remaining 80G useless
2. Create a partition
Fdisk/dev/sda
I'm building a three//build partition Step Over
Partition Setup must execute Partprobe command, write into kernel
[Email protected] 1]# fdisk-l
disk/dev/sda:107.4 GB, 107374182400 bytes
255 heads, Sectors/track, 13054 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000af23c
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 2611 20971520 Linux
/dev/sda2 2611 3916 10482726-up Linux
/dev/sda3 3917 6528 20980890-up Linux
/DEV/SDA4 6529 13054 52420095-up Linux
3. Configure TGTD
Vi/etc/tgt/targets.conf
Add the following configuration at the end
<target iqn.2008-09.com.example:server.target4>
Direct-store/dev/sda2 # becomes LUN 1
Direct-store/dev/sda3 # becomes LUN 2
DIRECT-STORE/DEV/SDA4 # becomes LUN 3
Initiator-address 10.0.1.2//allowed IP address of the connection
Initiator-address 10.0.1.3
Write-cache off
</target>
Configuration complete, start service
Service TGTD Start
Chkconfig TGTD on
View target Status
[Email protected] ~]# tgt-admin--show
Target 1:iqn.2008-09.com.example:server.target4
System Information:
Driver:iscsi
State:ready
i_t Nexus Information:
i_t nexus:1
initiator:iqn.1994-05.com.redhat:74bc8f791621
connection:0
IP address:10.0.1.3
i_t Nexus:2
initiator:iqn.1994-05.com.redhat:9695b6e4df6f
connection:0
IP address:10.0.1.2
LUN Information:
lun:0
Type:controller
SCSI Id:iet 00010000
SCSI SN:BEAF10
size:0 MB, Block size:1
Online:yes
Removable Media:no
Prevent Removal:no
Readonly:no
Backing store Type:null
Backing store Path:none
Backing Store Flags:
Lun:1
Type:disk
SCSI Id:iet 00010001
SCSI sn:beaf11
size:10734 MB, Block size:512
Online:yes
Removable Media:no
Prevent Removal:no
Readonly:no
Backing store Type:rdwr
Backing store Path:/dev/sda2
Backing Store Flags:
Lun:2
Type:disk
SCSI Id:iet 00010002
SCSI SN:BEAF12
size:21484 MB, Block size:512
Online:yes
Removable Media:no
Prevent Removal:no
Readonly:no
Backing store Type:rdwr
Backing store Path:/dev/sda3
Backing Store Flags:
Lun:3
Type:disk
SCSI Id:iet 00010003
SCSI sn:beaf13
size:53678 MB, Block size:512
Online:yes
Removable Media:no
Prevent Removal:no
Readonly:no
Backing store Type:rdwr
Backing store Path:/DEV/SDA4
Backing Store Flags:
Account information:
ACL Information:
10.0.1.2
10.0.1.3
Second, the client configuration
Install packages
Yum install-y iscsi-initiator-utils.x86_64 iscsi-initiator-utils-devel.x86_64
Service Iscsid Restart
Chkconfig Iscsid on
2. Finding storage in the Discovery network
[Email protected] ~]# iscsiadm-m discovery-t node
10.0.1.1:3260 via Sendtargets
192.168.1.141:3260 via Sendtargets
192.168.10.100:3260 via Sendtargets
192.168.10.100:3205 via Sendtargets
10.0.1.1:3205 via Sendtargets
3. Connect iSCSI
ISCSIADM-M node//Discovery Nodes
[Email protected] ~]# iscsiadm-m node
10.0.1.1:3260,1 Iqn.2008-09.com.example:server.target4
192.168.1.141:3260,1 Iqn.2008-09.com.example:server.target4
Iscsiadm-m discovery-t st-p 10.0.1.1:3260//Connected
Iscsiadm-m node-t iqn.2008-09.com.example:server.target4-p 10.0.1.1-l
Login Complete
Perform fdisk to see if the connection was successful
[Email protected] ~]# fdisk-l
disk/dev/sda:107.4 GB, 107374182400 bytes
255 heads, Sectors/track, 13054 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000af23c
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 2611 20971520 Linux
disk/dev/sdb:10.7 GB, 10734311424 bytes
Heads, Sectors/track, 10237 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/sdd:53.7 GB, 53678177280 bytes
Heads, Sectors/track, 51191 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/sdc:21.5 GB, 21484431360 bytes
Heads, Sectors/track, 20489 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
has successfully connected.
This article is from the "袁喆玺 blog" blog, make sure to keep this source http://yuanzhexi.blog.51cto.com/7786823/1839803
CentOS 6.8 Linux iSCSI Server Configuration and Client connection iSCSI