Establish an ISCSI Storage System in a PC architecture

Source: Internet
Author: User

Establish an ISCSI Storage System in a PC architecture

I. Architecture diagram:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0035494956-0.png "title =" 1.png"/>

Requirement: Share the/dev/sdc on the iscsi-target server for mounting and use from the windows and linux clients respectively.

Iscsi-target server IP Address: 192.168.10.50/24

Linux Client IP Address: 192.168.10.10/24

Windows server 2003 IP: 192.168.10.201/24


2. Install iSCSI-Target:

1. Obtain iscsi-target:

Http://sourceforge.net/directory/ OS :windows/freshness:recently-updated? Q = iscsitarget


2. Install the required software package, which may change depending on the system:

[Root @ Target ~] # Yum install gcc

[Root @ Target ~] # Yum install kernel-devel

The GCC compiler must be compiled and installed. If kernel-devel is not installed, the following message is displayed: cc:/lib/modules/2.6.18-164. el5/build/include/linux/version. h: No such file or directory


3. Extract the downloaded compressed package to a specific location, such as/usr/src /):

[Root @ Target ~] # Tar iscsitarget-1.4.20.2.tar.gz-C/usr/src/

[Root @ Target ~] # Cd! $

Cd/usr/src/

[Root @ Target src] # cd iscsitarget-1.4.20.2/

[Root @ Target iscsitarget-1.4.20.2] # ls

ChangeLog dkms. conf etc iscsitarget. spec Makefile README. mcs RELEASE_NOTES

COPYING doc include kernel patches README. initiators README. vmware usr

[Root @ Target iscsitarget-1.4.20.2] # make

[Root @ Target iscsitarget-1.4.20.2] # make install


4. Set the iscsi-target service to boot automatically:

After compilation and installation, you can use service iscsi-target start | stop | restart to manage the iscsi-target service.

[Root @ Target iet] # chkconfig -- add iscsi-target

[Root @ Target iet] # chkconfig -- level 35 iscsi-target on

[Root @ Target iet] # chkconfig -- list iscsi-target

Iscsi-target 0: off 1: off 2: off 3: on 4: off 5: on 6: off

[Root @ Target iet] #

Note that the background process of iscsi-target is ietd, not iscsi-target. Ietd I understand that it is easy to remember iscsi enterprise target daemon.


3. Configure the iSCSI Target end:

1. modify the configuration file under/etc/iet.

After iscsi-target is installed, three files will be generated under the/etc/iet/directory: ietd. conf initiators. allow targets. allow

/Etc/iet/ietd. conf is used to configure the disk, partition to be shared, and the password used for initiator discovery and logon. It is also the main configuration file of iscsi-target.

/Etc/iet/initiators. allow is configured with IP-based access control.

The/etc/iet/targets. allow configuration allows shared disks, which are generally not modified.


Description of the/etc/ietd. conf file:

# Target iqn.2001-04.com. example: storage. disk2.sys1. xyz

Note: This line is commented out by default.

Target indicates the name and disk of the Shared Server.

Iqn indicates "iscsi qualified name", iqn for short

2001-04 indicates year and month

Com. example indicates the Host Name of the inverted Shared Server.

Storage. disk2.sys1. xyz indicates the recognition code, that is, the device you want to share. You can write the device you want to share for ease of management.


Set the LUN (Logical Unit Number) to find similar lines:

# Lun 0 Path =/dev/sdc, Type = fileio, ScsiId = xyz, ScsiSN = xyz

Uncomment the current row. Lun 0 Path =/dev/sdc indicates that the block device number is 0, and the mapped disk is/dev/sdc.

Type = fileio the default value is fileio, which can be used for disks, files, and LVM.


The final modified file content is as follows:

Target iqn.2013-09.com. xfzhou. Target: sdc

Lun 0 Path =/dev/sdc, Type = fileio, ScsiId = xyz, ScsiSN = xyz


If you want to share another disk, add the above two lines. Note that Target and Lun appear in pairs!

Target iqn.2013-09.com. xfzhou. Target: sdd

Lun 0 Path =/dev/sdd, Type = fileio, ScsiId = xyz, ScsiSN = xyz


2. Start the iscsi target service:

[Root @ Target ~] # Service iscsi-target restart

Stopping iSCSI Target: [OK]

[OK] iSCSI Target: [OK]

[Root @ Target ~] #

[Root @ Target ~] # Pgrep ietd

7801

[Root @ Target ~] #


4. Configure the windows client:

I am using windows server 2003 sp2

Can iscsi initiator on windows go to http://www.microsoft.com/en-us/download/details.aspx? Id=18986download, initiator-2.08-build3825-x86fre.exe download the corresponding version based on the operating system platform. It's too easy to install the software!

After the installation is complete, a Microsoft iSCSI Initiator icon is displayed on the desktop. Click the "Discovery" tab:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0035494333-1.png "title =" 3.png"/>


Click "Add" to fill in the IP address or Host Name of the shared storage server. If the port number is not modified, the default value is 3260.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0035493922-2.png "title =" 4.png"/>


Click "OK" and the following results will be displayed on the Targets tab:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0035495241-3.png "title =" 5.png"/>


At this time, we can see an Inactive status. Click "Log On" below to activate the shared disk. As follows:

Click "OK" and you will see that the status has changed to Connected:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0035492152-4.png "title =" 6.png"/>


At this time, we can see a new hard disk in "disk management:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/00354a546-5.png "title =" 8.png"/>


Next I will do what I want. The disk is not initialized now. You can right-click "initialize disk" and then format the partition. I first divided a 5g area, and displayed the following in my computer:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/00354a2J-6.png "title =" 9.png"/>


The figure above shows that the disk shared by iscsi is no different from the local disk. The biggest difference is the read/write speed, shared disks are much slower than local disks ..



5. Configure the Linux iscsi-initiator client:

1. It is easy to configure iscsi-initiator on RHEL5.6. You only need to install iscsi-initiator-utils on the following CD ):

[Root @ file ~] # Rpm-ihv/mnt/Server/iscsi-initiator-utils-6.2.0.871-0.10.el5.x86_64.rpm

Warning:/mnt/Server/iscsi-initiator-utils-6.2.0.871-0.10.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... ######################################## ### [100%]

1: iscsi-initiator-utils ################################### ####### [1, 100%]

[Root @ file ~] #

After the installation is complete, the configuration file of the/etc/iscsi/main program will be created.

[Root @ file iscsi] # service iscsid start the iscsi initiator program.

After the installation is complete, you can use the iscsiadm command to establish an association with the iscsi target. iscsiadm is a command line tool used to manage (Update, delete, insert, and query) iscsi configuration database files, you can use it to perform operations on iscsi nodes, sessions, connections, and discovery records.


2. Execute iscsi targets on Linux and find:

[Root @ file iscsi] # iscsiadm-m discovery-t sendtargets-p 192.168.10.50

192.168.10.50: 3260,1 iqn.2013-09.com. xfzhou. Target: sdc

[Root @ file iscsi] #

As you can see above, the linux client can find the iscsi disk shared on the server.

Note: After successfully executing targets, the client records the queried information to the directory corresponding to/var/lib/iscsi/send_targets, therefore, Targets only needs to be executed once.

Discovery: in the/var/lib/iscsi/send_targets directory, generate a target server information file named "target server IP address and port number" (e.g.: "202.96.209.20, 3260 "). This file is used to save information about the target server.

Node: in the/var/lib/iscsi/send_targets directory, one or more folders named after the target on the target storage server are generated, each folder contains a file used to record specific target information on the target server.


3. log on to the iscis target:

[Root @ file iscsi] # iscsiadm-m node-T iqn.2013-09.com. xfzhou. Target-p 192.168.10.50-l

When executing this command, you can prompt: iscsiadm: no records found !, Now you can check your local hard disk. If you already have a shared disk, that's right. If not, restart the iscsid service. In this way, you will see the relevant login information during the restart process.


4. Partition formatting shared Disk:

[Root @ file iscsi] # fdisk-l/dev/sde

Disk/dev/sde: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sde1 1 638 5124703 + 7 HPFS/NTFS

/Dev/sde2 639 1305 5357677 + 5 Extended

/Dev/sde5 639 1305 5357646 83 Linux

[Root @ file iscsi] #

I have partitioned the shared disk and divided it into a logical partition and A linux partition. The ntfs above was just divided under windows.


Format: [root @ file iscsi] # mkfs. ext3/dev/sde5


5. Adjust the ext file system attributes of the partition:

You must first use tune2fs to modify the attributes of the file system and remove the attributes for automatic check.

[Root @ file iscsi] # tune2fs-c-1-I 0/dev/sde5

Tune2fs 1.39 (29-may-2006)

Setting maximal mount count to-1 set the maximum number of mounts to-1, that is, infinity.

Setting interval between checks to 0 seconds check time interval is 0, meaning not to check.

[Root @ file iscsi] #

Because the ext File System on Linux has a feature, the system checks a certain partition many times after a certain partition mount or umount or after a fixed period of time, this will slow down the hard disk response speed and affect the business. The above operation is to remove the file system's automatic check function.


6. mount it to the/data DIRECTORY automatically after it is started:

To automatically mount a partition to the specified directory after it is started, you can write it in the/etc/fstab file. The shared/dev/sde may change, for example, if a disk is added or removed on the server, the UUID of the disk can be used to avoid this situation. The UUID of the disk can be viewed as follows:

[Root @ file iscsi] #Tune2fs-l/dev/sde

Tune2fs 1.39 (29-may-2006)

Tune2fs: Bad magic number in super-block while trying to open/dev/sde

Couldn't find valid filesystem superblock.

[Root @ file iscsi] # tune2fs-l/dev/sde5

Tune2fs 1.39 (29-may-2006)

Filesystem volume name: <none>

Last mounted on: <not available>

Filesystem UUID: 5acb3056-dc69-4ae2-92b6-252007002232

Filesystem magic number: 0xEF53

Filesystem revision #: 1 (dynamic)

Filesystem features: has_journal resize_inode dir_index filetype sparse_super large_file

Default mount options: (none)

Filesystem state: clean

Errors behavior: Continue

Filesystem OS type: Linux

Inode count: 670432

Block count: 1339411

Reserved block count: 66970

Free blocks: 1282938

Free inodes: 670421

First block: 0

Block size: 4096

Fragment size: 4096

Reservedgdt blocks: 327

Blocks per group: 32768

Fragments per group: 32768

Inodes per group: 16352

Inode blocks per group: 511

Filesystem created: Fri Sep 6 22:31:06 2013

Last mount time: n/

Last write time: Fri Sep 6 22:34:51 2013

Mount count: 0

Maximum mount count:-1

Last checked: Fri Sep 6 22:31:06 2013

Check interval: 0 (<none>)

Reserved blocks uid: 0 (user root)

Reserved blocks gid: 0 (group root)

First inode: 11

Inode size: 128

Journal inode: 8

Default directory hash: tea

Directory Hash Seed: 179b3ebe-4d8b-4516-b4cf-908cfea96364

Journal backup: inode blocks

[Root @ file iscsi] #


Modify/etc/fstab

UUID = 5acb3056-dc69-4ae2-92b6-252007002232/data ext3 _ netdev 0 0

The name of the disk device may change, so that the file system cannot be mounted or the file system cannot be correctly mounted. Using UUID for mounting can solve this problem, you can also set the volume label for the file system.

_ Netdev is a special mount option for iscsi devices. This mount option indicates that the volume will be mounted after the network is started, and the volume will be detached before the network is closed.


OK, all the configurations have been completed, and a simple IP SAN has been set up!


This article from the "my love" blog, please be sure to keep this source http://xfzhou89.blog.51cto.com/1972682/1290392

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.