




已阅读5页,还剩18页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
RHEL 5下iSCSI Initiator软件安装配置指导书关键词:Linux RedHat、iSCSI initiator、RHEL5、Open-iSCSI修订纪录:版本号验证人更新时间更新说明1.0侯敏2007-07-3初稿完成1.1安恒2007-12-17结合Open-iSCSI的README进行了再次整理,添加了一些细节,增加了FAQ部分。目 录一、安装并配置iSCSI Initiator软件31、安装iSCSI Initiator32、确认iscsi服务随系统启动而启动33、设置InitiatorName34、配置iscsi参数45、启动iscsi服务46、分配存储资源,在Linux上执行target的发现57、登录target58、查看iSCSI session信息6二、.对新发现的磁盘进行分区并创建文件系统6三、设定文件系统的自动挂载8四、FAQ10附件一 Open-iSCSI modules:14附件二 Open-iSCSI README文件:15RHEL 5已开始在内核中加入了对iSCSI的支持,使用的 iSCSI Initiator软件是Open-iSCSI Initiator,支持万兆网卡,其配置方式与RHEL 4及更早的RedHat Linux发行版中的iSCSI Initiator有很大的区别。一、安装并配置iSCSI Initiator软件以下以RHEL 5 x86版本为例介绍如何安装并配置iSCSI initiator。1、安装iSCSI Initiator把RHEL5 x86第一张安装光盘挂载到/mnt目录下,之后进入/mnt/Server目录进行安装。rootpe03 Server# cd /mnt/Server/rootpe03 Server# rpm -ivh iscsi-initiator-utils-42-0.5.el5.i386.rpmwarning: iscsi-initiator-utils-42-0.5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing. # 100%1:iscsi-initiator-utils # 100%这个安装将iscsid、iscsiadm安装到/sbin目录下,它还将把默认的配置文件安装到/etc/iscsi目录下:/etc/iscsi/iscsid.conf 所有刚发起的iSCSI session默认都将使用这个文件中的参数设定。/etc/iscsi/initiatorname.iscsi 软件iSCSI initiator的intiator名称配置文件。在iscsi启动的时候,iscsid和iscsiadm会读取这两个配置文件。2、确认iscsi服务随系统启动而启动用chkconfig检查iscsi和iscsid服务在运行级别3和5中随系统的启动而自动启动rootpe03 Server# chkconfig -list |grep iscsiiscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:offiscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off如果iscsid和iscsi没有随系统的启动而启动,则用chkconfig设置这两个服务在系统运行级别为3和5时随系统启动而启动rootpe03 Server# chkconfig iscsi -level 35 onrootpe03 Server# chkconfig iscsid -level 35 on3、设置InitiatorName用vi编辑/etc/iscsi/initiatorname.iscsi文件,文件内容如下InitiatorName=.max:pe03本例中InitiatorName设置为.max:pe03注意:l InitiatorName这个单词必须注意大小写,同时,必须顶格写,xxxx代表要设 置的initiator名称,请遵循iqn命名规范。l iqn规范定义的InitiatorName格式为iqn.domaindate. :optional name,例如:.h3c:dbserver。4、配置iscsi参数编辑/etc/iscsi/iscsi.conf文件,确认node.startup的值为automatic,如果iSCSI存储服务器的target上启用了CHAP认证,则还需要配置CAHP认证:node.session.auth.authmethod = CHAPnode.session.auth.username = xxxxxx CHAP认证用户名node.session.auth.password = xxxxxx CHAP认证密码(至少12个字符)下表是部分参数作用的解释:配置内容对应语句在开机后是否自动登录Target。node.startup = automatic 表示自动登录(默认是automatic),node.startup = manual 表示需手动登录。默认的CHAP认证用户名和密码node.session.auth.authmethod = CHAPnode.session.auth.username = xxxxxx CHAP认证用户名node.session.auth.password = xxxxxx CHAP认证密码(至少12个字符)iSCSI发生错误以后,返回应用程序的超时时间。node.session.timeo.replacement_timeout = 120 表示120秒5、启动iscsi服务用service iscsi start启动iSCSI服务。rootpe03 Server# service iscsi startTurning off network shutdown. Starting iSCSI daemon: OK OK Setting up iSCSI targets: OK 用service iscsi status及service iscsid status查看iscsi相关服务的运行状态rootpe03 Server# service iscsi statusiscsid (pid 3697 3696) is running.rootpe03 Server# service iscsid statusiscsid (pid 3697 3696) is running.Open-iSCSI是通过以下iSCSI数据库文件来实现永久配置的:Discovery (/var/lib/iscsi/send_targets):在/var/lib/iscsi/send_targets目录下包含iSCSI portals的配置信息,每个portal对应一个文件,文件名为“iSCSI portal IP,端口号”(例如“00,3260”)。Node (/var/lib/iscsi/nodes):在/var/lib/iscsi/nodes目录下,生成一个或多个以iSCSI存储服务器上的Target名命名的文件夹,在该文件夹下有一个文件名为“iSCSI portal IP,端口号” (例如“00,3260”)的配置参数文件,该文件中是initiator登录target时要使用的参数,这些参数的设置是从/etc/iscsi/iscsi.conf中的参数设置继承而来的,可以通过iscsiadm对某一个参数文件进行更改(需要先注销到target的登录)。iscsiadm是用来管理(更新、删除、插入、查询)iSCSI配置数据库文件的命令行工具,用户能够用它对iSCSI nodes、sessions、connections和discovery records进行一系列的操作。6、分配存储资源,在Linux上执行target的发现RHEL 5上当前的iSCSI Initiator版本只支持sendtargets 的发现方式,不支持SLP和iSNS 假设后端存储为IX5000,iSCSI业务IP地址为00,则使用下面的命令执行target的发现:rootpe03 Server# iscsiadm -m discovery -t sendtargets -p 00:3260因为此时还没有在IX5000上创建该initiator并分配卷,这个命令执行成功后没有任何输出,但是此时到IX5000上会查看到有新的initiator生成。在IX5000上把卷分配给Linux服务器后,再次执行target的发现:rootpe03 Server# iscsiadm -m discovery -t sendtargets -p 00:3260iscsiadm: unexpected SendTargets data: 00:3260,1 :h3c:200realm.rhel5此时发现了一个新的target,target名称为:h3c:200realm.rhel5注:在IP SAN存储设备上把相应的存储空间分配给RedHat Linux服务器的具体操作请参照各存储设备相关的指导书7、登录targetrootpe03 Server# iscsiadm -m node -T :h3c:200realm.rhel5 -p 00:3260 -l这里-T后面跟target名称,最后的-l(英文字母中小写的L),是login的意思。可以使用iscsiadm -m node -loginall=all一次登录所有的targets。rootpe03 Server# iscsiadm -m node -loginall=all8、查看iSCSI session信息用iscsiadm -m session i查看iSCSI session和设备信息 rootpe03 # iscsiadm -m session -iiscsiadm version 2.0-742*Session (sid 0) using module tcp:*TargetName: :h3c:200realm.rhel5Portal Group Tag: 1Network Portal: 00:3260iSCSI Connection State: LOGGED INInternal iscsid Session State: NO CHANGE*Negotiated iSCSI params:*HeaderDigest: NoneDataDigest: NoneMaxRecvDataSegmentLength: 65536MaxXmitDataSegmentLength: 65536FirstBurstLength: 65536MaxBurstLength: 262144ImmediateData: NoInitialR2T: YesMaxOutstandingR2T: 1*Attached SCSI devices:*Host Number: 3 State: runningscsi3 Channel 00 Id 0 Lun: 0Attached scsi disk sdb State: running二、.对新发现的磁盘进行分区并创建文件系统1、先用fdisk l查看新的磁盘名称,这里我们发现了一个100GB的磁盘,设备名为/dev/sdbrootpe03 Server# fdisk -l.Disk /dev/sdb: 107.3 GB, 107373133824 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdb doesnt contain a valid partition table2、用fdisk /dev/sdb进行分区,本例中我们把整个磁盘分成一个主分区/dev/sdb1rootpe03 Server# fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent wont be recoverable.The number of cylinders for this disk is set to 13054.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-13054, default 1): 此处回车,使用默认值1 Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054): 此处回车使用默认值13054Using default value 13054Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.3、用mkfs命令在/dev/sdb1上创建ext3文件系统rootpe03 Server# mkfs -t ext3 /dev/sdb1mke2fs 1.39 (29-May-2006)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)13107200 inodes, 26214055 blocks1310702 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=0800 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872Writing inode tables: done Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 35 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.4、用tune2fs修改文件系统的属性,去掉自动检查的属性:rootpe03 Server# tune2fs -c -1 -i 0 /dev/sdb1tune2fs 1.39 (29-May-2006)Setting maximal mount count to -1Setting interval between checks to 0 secondsLinux上的ext3文件系统有一个特性,对某个分区mount、umount很多次后或者隔一个固定的时间后,系统会对该分区进行检测,这就会导致硬盘反映速度很慢,影响业务,本操作的目的就是去掉文件系统自动检查的属性。三、设定文件系统的自动挂载本例中我们将要把/dev/sdb1挂载到/data目录下1、手动创建一个目录/datarootpe03 Server# mkdir /data2、用tune2fs查看文件系统的UUID:rootpe03 Server# tune2fs -l /dev/sdb1tune2fs 1.39 (29-May-2006)Filesystem volume name: Last mounted on: Filesystem UUID: 3f0a00b7-4939-4ad2-a592-0821bb79f7c6Filesystem magic number: 0xEF53Filesystem revision #: 1 (dynamic)Filesystem features: has_journal resize_inode dir_index filetype sparse_super large_file.3、用vi编辑/etc/fstab文件,设置自动挂载:在/etc/fstab文件中增加下面蓝色的一行文字:/dev/VolGroup00/LogVol00 / ext3 defaults 1 1LABEL=/boot /boot ext3 defaults 1 2devpts /dev/pts devpts gid=5,mode=620 0 0tmpfs /dev/shm tmpfs defaults 0 0proc /proc proc defaults 0 0sysfs /sys sysfs defaults 0 0/dev/VolGroup00/LogVol01 swap swap defaults 0 0UUID=3f0a00b7-4939-4ad2-a592-0821bb79f7c6 /data ext3 _netdev 0 0注意:l 挂载选项使用的是“_netdev”l UUID要顶格写。l Linux系统重启后,磁盘设备的名称可能会发生变化,从而引起文件系统不能挂载上来或者不能正确挂载,使用UUID的方式进行挂载可以解决这个问题,也可以使用给文件系统设置卷标的方式来解决,具体操作步骤可以参见KMS-12541:在Linux上使用文件系统卷标解决磁盘名称发生变化引起的文件系统不能正确自动挂载的问题4、用mount a挂载文件系统rootpe03 Server# mount a5、用df查看文件系统已经挂载成功rootpe03 /# df -ThFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/VolGroup00-LogVol00 ext3 65G 2.4G 59G 4% /dev/sda1 ext3 99M 12M 82M 13% /boottmpfs tmpfs 471M 0 471M 0% /dev/shm/dev/sdb1 ext3 99G 188M 94G 1% /data6、条件允许的话,重启一下操作系统,使用df命令确认系统重启后文件系统能够自动挂载上来。四、FAQ1、如果存储上的Target下新挂载了一个SAN资源,如何在服务器上连接并识别?如果一个Target下新增了一个SAN资源,在服务器可以使用iscsiadm m session R命令刷新(rescan)已连接的iSCSI session以识别新的SAN资源:rootpe03 /# iscsiadm -m session R可以使用cat /proc/scsi/scsi或者fdisk -l来查看连接过来的卷,例如下面的scsi7 Channel: 00 Id: 00 Lun: 01即为新连接的SAN卷:rootpe03 /# cat /proc/scsi/scsi Host: scsi7 Channel: 00 Id: 00 Lun: 00 Vendor: H3C Model: H3C ISCSI DISK Rev: v1.0 Type: Direct-Access ANSI SCSI revision: 04Host: scsi7 Channel: 00 Id: 00 Lun: 01 Vendor: H3C Model: H3C ISCSI DISK Rev: v1.0 Type: Direct-Access ANSI SCSI revision: 042、如何注销到target的连接?如果要注销到某一个特定的Target的连接,可以使用下列的命令:rootpe03 /# iscsiadm -m node -T :h3c:200realm.rhel5 -p 00:3260 u其中,:h3c:200realm.rhel5是Target的名称,00是Target服务器的IP,实际使用时请根据实际情况修改。如果要注销到所有targets的连接,可以使用下列命令:rootpe03 /# iscsiadm -m node -logoutall=all注意:l 注销target前请停止对iSCSI磁盘的读写,卸载该磁盘上的文件系统,如果使用了LVM,则还需要去激活使用到该磁盘的VG3、如何重启iscsi服务?停止对iSCSI磁盘的读写,卸载该磁盘上的文件系统,如果使用了LVM,则还需要去激活使用到该磁盘的VG,之后使用service iscsi restart重启iscsi服务。4、如何停止iscsi服务?停止对iSCSI磁盘的读写,卸载该磁盘上的文件系统,如果使用了LVM,则还需要去激活使用到该磁盘的VG,之后使用service iscsi stop停止iscsi服务。5、如何针对不同的target设置不同的CHAP认证?如果有多个目标服务器启用了CHAP认证,并且它们的用户名和密码不一样,此时需要手动更改node文件。通过iscsiadm -m node -t sendtargets命令发现Target以后,在/var/lib/iscsi/nodes目录下会生成一个或多个以目的服务器上的Target名命名的文件夹,文件夹中有一个文件。此文件中是initiator登录target要使用到的配置参数,可以通过更改此参数文件来配置登录到每个Target的CHAP认证信息。可直接编辑该文件,在该文件中添加(或修改)此Target的CHAP认证用户名和密码:node.session.auth.authmethod = CHAPnode.session.auth.username = xxxxxx CHAP认证用户名node.session.auth.password = xxxxxx CHAP认证密码(至少12个字符)修改完成后重新登录Target即可。也可以使用iscsiadm命令对登录某个target的CHAP认证参数进行修改如:rootpe03 /#iscsiadm -m node -T .h3c:.h3c-1.pe05-61 -p 01:3260 -o update -name=node.session.auth.authmethod -value=CHAProotpe03 /#iscsiadm -m node -T .h3c:.h3c-1.pe05-61 -p 01:3260 -o update -name= node.session.auth.username -value=xxxxxxxrootpe03 /#iscsiadm -m node -T .h3c:.h3c-1.pe05-61 -p 01:3260 -o update -name= node.session.auth.password -value=xxxxxxx需要注意的是,发现Target的命令(iscsiadm -m node -t sendtargets)会自动按照/etc/iscsi/iscsi.conf文件中的参数配置刷新/var/lib/iscsi/nodes下initiator登录target要使用的参数文件,所以如果通过修改/var/lib/iscsi/nodes下的文件设置好CHAP认证后又对该存储服务器执行了发现target的操作,则需要再次修改该文件。6、如何从操作系统中删除一个target的信息?使用下面的命令:rootpe03 /# iscsiadm -m node -o delete -T .max -p :3260其中.max代表target的名称,代表target的IP地址7、如何查看就有哪些target记录在了Open-iSCSI数据库中?使用iscsiadm -m node命令8、如何在Linux上使用LVM来管理磁盘请参见KMS - 12578在RedHat Linux上使用LVM管理磁盘并创建文件系统9、RHEL5上如何创建超过2TB的文件系统RedHat宣称RHEL5上ext3文件系统所支持的最大容量为16TB。当从存储系统上分配来的磁盘大小为超过2TB的时候,此时可以使用LVM来管理该磁盘,创建出超过2TB大小的LV,在LV上创建超过2TB的文件系统。 当从存储系统上分配来的磁盘空间大小小于2TB的时候,可以使用LVM管理磁盘,把多个磁盘加入到一个VG中并在其上创建超过2TB大小的LV,然后在LV上创建超过2TB的文件系统。注意:使用fdisk对磁盘做的分区为MBR分区,分区最大大小为2TB。10、对ext3文件系统进行扩容的工具是什么?以前在RHEL4版本里,在线扩展逻辑卷使用的是ext2online命令,在RHEL5里,ext2online命令已经被resize2fs取代。resize2fs程序可以用来更改ext2/ext3文件系统的大小。它可以对处于umount状态的ext2/ext3文件系统进行扩容或缩小。如果文件系统是处于mount状态下,那么它只能做到在线扩容,而且前提条件是内核支持在线resize.(linux kernel2.6支持在mount状态下扩容但仅限于ext3文件系统。)命令格式:resize2fs -d debug-flags -S RAID-stride -f -F -p device size resize2fs工具不带size参数的时候,会自动调整文件系统到分区的新容量。在运行resize2fs工具对文件系统进行扩容的时候,resize2fs可能会提示要先用e2fsck -f检查文件系统,此时按照提示检查文件系统即可。扩容的一般过程(假设使用的是LVM管理磁盘):1、 umount文件系统2、 用vgextend对VG进行扩展3、 用lvextend对LV进行扩展4、 使用resize2fs对文件系统进行扩展附件一 Open-iSCSI modules:Open-iSCSI modules附件二 Open-iSCSI README文件:Open-iSCSI README文件1. In This Release=This file describes the Linux* Open-iSCSI Initiator. 1.1. Features - highly optimized and very small-footprint data path; - persistent configuration database; - SendTargets discovery; - CHAP; - PDU header Digest; - multiple sessions; For the most recent list of features please refer to: 2. Introduction=Open-iSCSI project is a high-performance, transport independent,multi-platform implementation of RFC3720 iSCSI.Open-iSCSI is partitioned into user and kernel parts.The kernel portion of Open-iSCSI is a from-scratch code licensed under GPL. The kernel part implements iSCSI data path (that is, iSCSI Read and iSCSI Write), and consists of three loadable modules: scsi_transport_iscsi.ko, libiscsi.ko and iscsi_tcp.ko.User space contains the entire control plane: configuration manager, iSCSI Discovery, Login and Logout processing,connection-level error processing, Nop-In and Nop-Out handling, and (in the future:) Text processing, iSNS, SLP, Radius, etc.The user space Open-iSCSI consists of a daemon process called iscsid, and a management utility iscsiadm.3. Installation=To install the iSCSI tools run:rpm -ivh iscsi-initiator-utils-.rpmThis will install iscsid and iscsiadm to /sbin. It will also installdefault config files to /etc/iscsi:/etc/iscsi/iscsid.conf - All new session will inherit settings fromthis file when they are first discovered. To override a value for a specifictarget see the iscsiadm op command below and in the iscsiadm man page.See Configuration section below./etc/iscsi/initiatorname.iscsi - The default initaitor name for softwareiSCSI initiator.4. Open-iSCSI daemon=The daemon implements control path of iSCSI protocol, plus some management facilities. For example, the daemon could be configured to automatically re-start discovery at startup, based on the contents of persistent iSCSI database (see next section).For help, run: ./iscsid -helpUsage: iscsid OPTION -c, -config=path Execute in the config file (/etc/iscsi/iscsid.conf). -f, -foreground run iscsid in the foreground -d, -debug debuglevel print debugging information -u, -uid=uid run as uid, default is current user -g, -gid=gid run as gid, default is current user group -h, -help display this help and exit -v, -version display version and exit5. Open-iSCSI Configuration Utility=Open-iSCSI persistent configuration is implemented as a set of iSCSI database files.- Discovery (/var/lib/iscsi/send_targets);- Node (/var/lib/iscsi/nodes).The iscsiadm utility is a command-line tool to manage (update, delete, insert, query) the persistent database.The utility presents a set of operations that a user can perform on iSCSI nodes, sessions, connections, and discovery records.Note that some of the iSCSI Node and iSCSI Discovery operations do not require iSCSI daemon (iscsid) loaded.For help, run: ./iscsiadm -helpUsage: iscsiadm OPTION -m, -m
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030中国孔压计行业发展趋势分析与未来投资战略咨询研究报告
- 2025至2030中国婚礼请柬软件行业发展趋势分析与未来投资战略咨询研究报告
- 2025至2030中国天然狗粮行业发展趋势分析与未来投资战略咨询研究报告
- 2025至2030中国多用途气体变送器行业发展趋势分析与未来投资战略咨询研究报告
- 下象棋作文500字9篇
- 写景作文五彩缤纷的秋天300字13篇
- 2025至2030中国双乙烯酮行业市场发展现状及竞争策略与投资发展报告
- 五年级科学小实验探索:生态环境保护与实践教案
- 我与狗狗的十个约定观后感350字13篇
- 2025年医保知识考试题库:基金监管案例分析实战训练试卷
- 2025-2030年中国婚庆产业行业市场现状供需分析及投资评估规划分析研究报告
- 2025年新高考2卷(新课标Ⅱ卷)英语试卷
- 制造企业加班管理制度
- 2025年中考化学必考要点知识归纳
- 三年级语文下册全册重点知识点归纳
- 儿童疼痛的评估及护理措施
- 护理试卷试题及答案
- 人文社科班试题及答案
- 生产经营单位事故隐患内部报告奖励制度
- 2024年湖北省初中学业水平考试地理试卷含答案
- 2024年认证行业法律法规及认证基础知识 CCAA年度确认 试题与答案
评论
0/150
提交评论