Set up iscsi storage in 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.
[Html] view plaincopy
- [Root @ iscsi10 ~] # Vgs
- VG # PV # LV # SNAttrVSizeVFree
- Vg_iscsi10110wz -- n-808.45g730.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
[Html] view plaincopy
- [Root @ iscsi10 ~] # Vim/etc/tgt/targets. conf
- Targetiqn.2008-09.com. example: iscsidisk>
- Backing-store/dev/vg_iscsi10/iscsi_test
- Initiator-address10.11.68.11
- Initiator-address10.11.68.12
- Initiator-address10.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
[Html] view plaincopy
- [Root @ iscsi10 ~] # Tgt-admin-s
- Target1: iqn.2008-09.com. example: iscsidisk
- Systeminformation:
- Driver: iscsi
- State: ready
- I _Tnexusinformation:
- LUNinformation:
- LUN: 0
- Type: controller
- SCSIID: IET00010000
- SCSISN: beaf10
- Size: 0 MB, Blocksize: 1
- Online: Yes
- Removablemedia: No
- Preventremoval: No
- Readonly: No
- Backingstoretype: null
- Backingstorepath: None
- Backingstoreflags:
- LUN: 1
- Type: disk
- SCSIID: IET00010001
- SCSISN: beaf11
- Size: 536871 MB, Blocksize: 512
- Online: Yes
- Removablemedia: No
- Preventremoval: No
- Readonly: No
- Backingstoretype: rdwr
- Backingstorepath:/dev/vg_iscsi10/iscsi_test
- Backingstoreflags:
- Accountinformation:
- ACLinformation:
- 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