Linux系统

配置ISCSI客户端(LINUX)redhat5-iSCSI-INITIATOR

时间:2013/8/19 12:37:30  作者:说歌社区  来源:www.solgle.com  查看:561  评论:0
内容摘要:ISCSI 4的客户端装上去后会有、/etc/iscsi.conf 配置文件,直接按照模板参数修改就可以了在ISCSI6的客户端配置方式有些变化,这让我搞了一下午,也参考的51CTO某技术大师的博客,感谢大师特将大师的博文转载并加以批注,让后上来的新手能更快掌握。配置ISCSI客...
ISCSI 4的客户端装上去后会有、/etc/iscsi.conf 配置文件,直接按照模板参数修改就可以了
 
在ISCSI6的客户端配置方式有些变化,这让我搞了一下午,也参考的51CTO某技术大师的博客,感谢大师
 
特将大师的博文转载并加以批注,让后上来的新手能更快掌握。
 
配置ISCSI客户端(LINUX) 
1.1 连接ISCSI
操作系统:redhat linux AS 5(默认安装)
Iscsi包:  iscsi-initiator-utils-6.2.0.742-0.5.el5.i386.rpm
1.1.1 安装rpm包
[root@linux ~]# rpm –ivh iscsi-initiator-utils-6.2.0.742-0.5.el5.i386.rpm
运行此命令后,会生成一个目录/etc/iscsi,该目录下有两个文件:
Initiatorname.iscsi和iscsid.conf
1.1.2 启动ISCSI服务
安装完iscsi服务默认是关闭的,需要手工启动
[root@linux ~]# cd /etc/init.d
[root@linux ~]# ./iscsi start
1.1.3 搜寻盘阵
运行以下命令搜寻target,即目标端:存储设备
[root@linux ~]#iscsiadm --mode discovery --type sendtargets --portal 192.168.1.221
以上IP即是存储设备IP
1.1.4 显示盘阵
显示存储端target name
[root@linux ~]# iscsiadm --mode node
显示结果与在7612i串口 iscsi management→iscsi node名字相同
1.1.5 登陆盘阵
target登陆
[root@linux ~]#iscsiadm --mode node --targetname targetname --portal 192.168.1.221:3260 --login
    
经过以上几步,fdisk–l就可以看到所挂接分区了!!!
(为确保重启后也能看到,再修改一下/etc/iscsi/iscsid.conf
[root@linux ~]# vi /etc/iscsi/iscsid.conf
iscsiadm --mode node --targetname targetname --portal 192.168.1.221:3260 –login      ----TARGETNAME改成你自己服务器的参数,自己上ISCSI server 上去查
添加到该文件中的开始部分
设置服务启动chkconfig --level 35 iscsid .)
其实这个文件大多数内容处于被注释状态,该命令添加位置应该影响不大.然后重启电脑后直接fdisk –l 依然可以看到所挂接的分区。至此iscsi所有操作完成,但挂载的分区不是linux所识别,必须使用FDISK进行磁盘分区。
1.2 设置分区
1.2.1 使用fdisk命令进行磁盘分区
fdisk是各种Linux发行版本中最常用的分区工具,是被定义为Expert级别的分区工具。我们可以通过fdisk来分区使用iscsi设备。它还包括一个二级选单,首先输入命令,然后出现问答式界面,用户通过在这个界面中输入命令参数来操作fdisk。
# fdisk /dev/hdb
运行后出现fdiak的命令提示符:
Command (m for help):
使用n命令创建一个分区,会出现选择主分区(p primary partition)还是扩展分区(llogical)的提示,通常选用主分区。然后按照提示输入分区号(Partion number(1-4):)、新分区起始的磁盘块数(FirstCylinder)和分区的大小,可以是以MB为单位的数字(Last cylindet or +siza or +sizeM or+sizeK:)。例如:
[root@linux ~]#fdisk /dev/sdb
查看分区,如果是第一次操作时,显示为无。
Command (m for help):p
 
Disk /dev/sdb:255 heads, 63 sectors, 4427 cylinders
Units = cylinders of 16065 * 512 bytes
 
Device Boot    Start       End    Blocks   Id  System
建立分区
Command (m for help):n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4427, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4427, default 4427):
Using default value 4427
保存分区信息
Command (m for help):w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING:If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
1.2.2 现在验证新分区:
[root@linux ~]# fdisk /dev/sdb
 
The number of cylinders for this disk is set to 4427.
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)
Command (m for help):p
 
Disk /dev/sdb:255 heads, 63 sectors, 4427 cylinders
Units = cylinders of 16065 * 512 bytes
 
Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1      4427  35559846   83  Linux
 
Command (m for help):q
1.2.3 格式化分区
[root@localhost ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
214761472 inodes, 429495759 blocks
21474787 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
13108 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored . blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
            102400000, 214990848
 
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
1.2.4 设定加载点:
文件系统必须有一个挂载点,它只是一个空的目录,新文件系统在这里与系统目录树“相连”。经过以上的操作,我的 Linux服务器已经连接到 iSCSI 储存设备, 并且如同Linux 本机上面的一个 SCSI 硬盘一样。 使用的方式几乎一模一样。
假设iSCSI 主机挂载到 /cluster/raid 目录下:
[root@linux ~]# mkdir /cluster/raid
[root@linux ~]# mount  /dev/sda1 /cluster/raid
[root@linux ~]# df
Filesystem       1K-blocks          Used    Available  Use%  Mounted .
/dev/hda1         10080488       2950408     6618012   31%   /
tmpfs              5036316         81172     4699312   0%    /dev/shm
/dev/sda1       1914788196      27040372  1790482212   2%    /cluster/raid
1.2.5 设定自动挂载:
在机器重新启动后自动加载分区,你必须在/etc/fstab中加入相应分区,但分区类型必须市"_netdev".例如加载的分区sdb1:
 
[root@linux ~]# vi /etc/fstab
/dev/sdb1   /cluster/raid   ext3    ­_netdev     0   0
/dev/sdc1   /data/sdc1      ext3    _netdev     0   0
/dev/sdd1   /data/sdd1      ext3    _netdev     0   0
1.2.6 查看挂载分区:
[root@localhost ~]# df -h
文件系统              容量    已用     可用     已用%      挂载点
/dev/sda1              64G    5.6G      55G     10%         /
tmpfs                 1.7G       0     1.7G      0%         /dev/shm
/dev/sdb1             1.6T    197M     1.5T      1%         /data/sdb1
/dev/sdc1             1.6T    197M     1.5T      1%         /data/sdc1


 
标签:配置ISCSI客户端redhat5-iSCSI-INITIATOR linux 

solgle.com 版权所有,欢迎分享!!!

相关评论
 img1 img2 img3 img4 img5 img6 img7 img8 img9 img10
评论者:      验证码:  点击获取验证码
   Copyright © 2013-2028 solgle.com,All rights reserved.[solgle.com] 公安机关备案号:51010802000219
Email:solgle@solgle.com; weixin:cd1008610000 ICP:蜀ICP备14011070号-1