iSCSI storage mounted under Linux

Source: Internet
Author: User

1. Check if the system is installing iSCSI Initiator

[[email protected] ~]# rpm -qa|grep iscsi[[email protected] ~]# [[ email protected] ~]# mount /dev/cdrom /mnt/mount: block device /dev/ sr0 is write-protected, mounting read-only[[email protected] ~]# cd / mnt/[[email protected] packages]# find . -name *iscsi* ./ Iscsi-initiator-utils-6.2.0.872-41.el6.i686.rpm[[email protected] packages]# yum list|grep  iscsiUnable to read consumer identityiscsi-initiator-utils.i686              6.2.0.872-41.el6                      dvd [[ email protected] packages]# rpm -ivh iscsi-initiator-utils-6.2.0.872-41.el6.i686.rpm  ^c[[email protected] packages]# yum -y install iscsi-initiator-utils^c[[email protected] packages]# 

This installation installs Iscsid, iscsiadm into the/sbin directory, and it will also install the default configuration file into the/ETC/ISCSI directory:
/etc/iscsi/iscsid.conf all newly launched iSCSI sessions will use the parameter settings in this file by default.
/ETC/ISCSI/INITIATORNAME.ISCSI software iSCSI Initiator intiator name configuration file.

2. View Initiator Iqnname

[Email protected] packages]# MORE/ETC/ISCSI/INITIATORNAME.ISCSI initiatorname=iqn.1994-05.com.redhat:4ef28aa338b5 [Email protected] packages]#

[Email protected] packages]# ps-ef|grep iscsiroot 2074 1972 ten 14:24 pts/0 00:00:00 grep iscsi[[email protected ] packages]# chkconfig--list|grep iscsiiscsi 0:off1:off2:off3:on4:on5:on6:offiscsid 0:off1:off2:off3:on4 : On5:on6:off[[email protected] packages]# service Iscsid start[[email protected] packages]#

If "Iscsid dead but PID file exist" appears, enter command: rm–fr/var/run/iscsid.pid

4. Link the target end

The first thing to do is raid on the storage device, set the iSCSI target Here are the main instructions for installing iSCSI Initiator.

Iscsiadm is a command-line-based iSCSI management tool that provides operations for iSCSI nodes, sessions, connections, and Discovery Records. By default, the iSCSI initiator and target are connected through port 3260.

ISCSIADM instructions can be used to view/usr/share/doc/iscsi-initiator-utils-6.2.0.742/readme or to run man Iscsiadm or Iscsiadm--help

Discover targets at a given IP address:

Iscsiadm--mode discoverydb--type sendtargets--portal 192.168.1.10--discover

[Email protected] packages]# iscsiadm-m discovery-t st-p 192.168.100.252

This will find a target, similar to 192.168.100.252,1 iqn.1994-05.com.redhat:4ef28aa338b5, The target found is also called a node.

5. Display disk array: Iscsiadm–mode node

[Email protected] packages]# iscsiadm-m node

6. Login Target

Login, must use a node record ID found by the discovery:

Iscsiadm--mode node--targetname iqn.2001-05.com.doe:test--portal 192.168.1.1:3260--login

[Email protected] packages]# iscsiadm-m node-targetname iqn.1994-05.com.redhat:4ef28aa338b5-p 192.168.100.252-l

can also be abbreviated

[Email protected] packages]# iscsiadm-m node-p 192.168.100.252-l

If you want to log in automatically when the system starts

[Email protected] packages]# iscsiadm-m node-targetname iqn.1994-05.com.redhat:4ef28aa338b5-p 192.168.100.252--op up Date-n Node.startup-v Automatic

IQN.1994-05.COM.REDHAT:4EF28AA338B5 is the target name iqn number can be viewed in/ETC/ISCSI/INITIATORNAME.ISCSI

Logout:

Iscsiadm--mode node--targetname iqn.2001-05.com.doe:test--portal 192.168.1.1:3260--logout

[Email protected] packages]# iscsiadm-m node-targetname iqn.1994-05.com.redhat:4ef28aa338b5-p 192.168.100.252-u

7. Login node to see storage device information for target party

Run # fdisk–l on the server to see the storage device information for the target party

[Email protected] packages]# fdisk-ldisk/dev/sdb:3489.8 GB, 3489862254592 bytes255 heads, $ sectors/track, 424284 cyl Indersunits = Cylinders of 16065 * 8225280 bytesdisk/dev/sdb doesn ' t contain a valid partition table

/dev/sdb is the connected iSCSI storage device

8. Partition, format, mount the iSCSI device

[Email protected] packages]# fdisk/dev/sdb[[email protected] packages]# MKFS.EXT4/DEV/SDB1

For iSCSI storage device partitions, automatic mount on boot requires attention mount option cannot use defaults, should be _netdev,uuid to shelf write (after Linux system restarts, the name of the disk device may change, causing the file system to not mount or mount correctly, Mounting with the UUID can solve this problem, or it can be resolved by setting the volume label for the file system, for example:

[Email protected] packages]# vi/etc/fstab uuid=9b71318a-6609-4679-8a69-420c1fffea63/mnt/data ext4 _netdev 0 0

Mount all the file systems in the/etc/fstab:

[Email protected] packages]# mount-a

Use DF to see if the file system has been mounted successfully

[Email protected] packages]# df-th

NOTE: If you reinstall the OS, you will need to retrieve IQN name again.

This article is from "I am not a rookie" blog, please be sure to keep this source http://justinpeng.blog.51cto.com/7662323/1421544

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.