Set up iscsi storage under Centos6.5
To build a vsphere environment, you need to use network storage to simulate applications in the production environment. Now, a 800 GB hard drive server is configured as iscsi storage.
The iscsi server is as follows:
Ip: 10.11.68.10
Hard Disk: in addition to basic server applications, GB is used for storage. Thanks to the lvm, we can directly create a logical volume.
[root@iscsi10 ~]# vgs VG #PV #LV #SN Attr VSize VFree vg_iscsi10 1 1 0 wz--n- 808.45g 730.32g
Lvcreate-L 500G-n iscsi_test vg_iscsi10
In this way, the iscsi storage space is available. Let's configure the storage.
1. Install scsi-target-utils on the server
Yum instal scsi-target-utils-y
2. Configure the storage device
[root@iscsi10 ~]# vim /etc/tgt/targets.conf<target iqn.2008-09.com.example:iscsidisk> backing-store /dev/vg_iscsi10/iscsi_test initiator-address 10.11.68.11 initiator-address 10.11.68.12 initiator-address 10.11.68.13</target>
The target definition format is as follows:
Iqn. yyyy-mm. <reversed domain name>: target_name
Backing-store: virtual device. This parameter is generally used preferentially.
Direct-store: the actual device. The entire disk is used for iscsi devices.
Initiator-address: used to restrict client sources using this target
Incominguser: the client can use the user name and password for storage.
After startup, you can check whether the storage has been allocated.
Service tgtd start
[root@iscsi10 ~]# tgt-admin -sTarget 1: iqn.2008-09.com.example:iscsidisk System information: Driver: iscsi State: ready I_T nexus information: 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: 536871 MB , Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/vg_iscsi10/iscsi_test Backing store flags: Account information: ACL information: 10.11.68.11 10.11.68.12 10.11.68.13
3. Add the boot item
Chkconfig tgtd on
4. If the server has firewall settings, open the corresponding port. The iscsi port is 3260.
Iptables-a input-p tcp-s 10.0.0.0/8 -- dport 3260-j ACCEPT