Configure iSCSI storage in RHEL5/CentOS5 system

Source: Internet
Author: User
1. in RHEL5, download and install the iSCSI initiator package # rpm-ivhiscsi-initiator-utils-6.2.0.871-0.10.el5.i386.rpmwarning: iscsi-initiator-utils-6.2.0.871-0.10.el5.i386.rpm: HeaderV3DSAsignat

1. download and install the iSCSI initiator package in the RHEL5 system
# Rpm-ivh iscsi-initiator-utils-6.2.0.871-0.10.el5.i386.rpm
Warning: iscsi-initiator-utils-6.2.0.871-0.10.el5.i386.rpm: HeaderV3 DSA signature: NOKEY, key ID e8562897
Preparing... ######################################## ### [100%]
1: iscsi-initiator-utils ################################### ####### [1, 100%]
#

2. in the RHEL5 system, generate and view the iSCSI initiator name,
# Echo "InitiatorName = 'iscsi-iname'">/etc/iscsi/initiatorname. iscsi
# Cat/etc/iscsi/initiatorname. iscsi
InitiatorName = iqn.1994-05.com. redhat: ba481f5a4931

3. configure the iSCSI initiator service in the RHEL5 system
# Vi/etc/iscsi/iscsid. conf (configuration file of the iSCSI initiator service)
Node. startup = automatic

# Note: other options can be temporarily default.
# Node. session. auth. authmethod = CHAP
# Node. session. auth. username = iqn.2005-03.com. redhat: 01. b9d0dd11016
# Node. session. auth. password = 01. b9d0dd11016

# Chkconfig iscsi -- level 35 on
# Chkconfig iscsid -- level 35 on

4. create and assign an iSCSI share in the Storbridge system
Note: some virtual disks that do not provide chap authentication do not need to be configured. the configuration method is as follows.
Share management-iSCSI sharing: use an iSCSI shared virtual disk to create an iSCSI share;
Use the CHAP authentication mode to allocate the iSCSI initiator according to the iSCSI initiator name obtained in step 1;
Iqn.2005-03.com. redhat: 01. b9d0dd11016
Initiator password: 01. b9d0dd11016

5. start the iSCSI initiator service in the RHEL5 system
# Service iscsi start
Iscsid is stopped
Turning off network shutdown. Starting iSCSIdaemon: [OK]
[OK]
Setting up iSCSI targets: iscsiadm: No records found!
[OK]
6. in the RHEL5 system, iSCSI storage is used.
# Rm-rf/var/lib/iscsi/nodes /*
# Rm-rf/var/lib/iscsi/send_targets /*

(1) iscsi storage discovered
# Iscsiadm-m discovery-t st-p 192.168.186.1
192.168.186.1: 3260,1 iqn.2005-02.com. ricecake. iscsi: 00

(2) log on to the iscsi storage
# Iscsiadm-m node-T iqn.2005-02.com. ricecake. iscsi: 00-p192.168.186.1-l
Logging in to [iface: default, target: iqn.2005-02.com. ricecake. iscsi: 00, portal: 192.168.186.1, 3260]
Login to [iface: default, target: iqn.2005-02.com. ricecake. iscsi: 00, portal: 192.168.186.1, 3260]: successful

# Sfdisk-s
/Dev/hda: 20971520
/Dev/sda: 1048576
Total: 22020096 blocks

# Fdisk/dev/sda
# Mkfs. ext3/dev/sda1
# Tune2fs-c-1-I 0/dev/sda1

Use tune2fs to modify the attributes of the file system and remove the attributes for automatic check.
The ext3 file system on Linux has a feature. after a partition is mounted or umount many times or after a fixed period of time, the system checks the partition, this will cause the hard disk to reflect the slow speed and affect the business. The purpose of this operation is to remove the attributes automatically checked by the file system.
# Mkdir-p/mnt/data

7. network mounting during startup
# Vi/etc/fstab
UUID = c160af38-3928-42c8-9155-ac05a1d20538/mnt/data ext3 _ netdev 0 0

# Use the disk UUID mode for mounting. for the UUID code, see the appendix.

# Chkconfig netfs -- level 35 on
# Service netfs start

8. View iscsi disk usage
# Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/hda3 19G 6.1G 12G 35%/
/Dev/hda1 99 M 12 M 82 M 13%/boot
None 252 M 0 252 M 0%/dev/shm
/Dev/sda1 1008 M 34 M 924 M 4%/mnt/data

Appendix: iscsiadm commands
(1) view the name of the output node
# Iscsiadm-m session
Tcp: [1] 192.168.186.1: 3260, 1 iqn.2005-02.com. ricecake. iscsi: 00

(2) view the UUID of the disk
# Tune2fs-l/dev/sda1
Tune2fs 1.39 (29-may-2006)
Filesystem volume name: data
Last mountedon:
FilesystemUUID: c160af38-3928-42c8-9155-ac05a1d20538
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journalresize_inode dir_index filetype needs_recovery sparse_superlarge_file
Default mount options: (none)
Filesystem state: clean
Errorsbehavior: Continue
Filesystem OS type: Linux
Inodecount: 131072
Blockcount: 262144
Reserved block count: 13107
Freeblocks: 249499
Freeinodes: 131061
Firstblock: 0
Blocksize: 4096
Fragmentsize: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16384
Inode blocks per group: 512
Filesystem created: Tue Jun 1418: 36: 41 2011
Last mounttime: Tue Jun14 18:48:31 2011
Last writetime: Tue Jun14 18:48:31 2011
Mountcount: 1
Maximum mount count: 22
Lastchecked: Tue Jun 14 18:36:41 2011
Checkinterval: 15552000 (6 months)
Next check after: Sun Dec 11 18:36:41 2011
Reserved blocks uid: 0 (userroot)
Reserved blocks gid: 0 (grouproot)
Firstinode: 11
Inodesize: 128
Journalinode: 8
Default directory hash: tea
Directory Hash Seed: 6fcc1970-e8a2-4d80-8ce5-d92f9cb9ef38
Journalbackup: inode blocks

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.