免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1722 | 回复: 0
打印 上一主题 下一主题

Red Hat Linux AS4 or RHEL5中配置iSCSI存储总结 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-11-24 13:21 |只看该作者 |倒序浏览
在Red Hat Linux AS4 or RHEL5中配置iSCSI存储总结
1.安装iSCSI驱动程序;
2.Linux主机安装iSCSI Initiator;
3.配置iSCSI Inititor,主要是IP地址和InitiatorName,这一步得重启进程;
3.1
#vi /etc/iscsi.conf
DiscoveryAddress=10.0.1.1
:wq!保存退出;
3.2
#/etc/init.d/iscsi restart
3.3
#vi /etc/initiatorname.iscsi
InitiatorName=iqn.2008-01.com:hostname
:wq!
#service iscsi restart
#iscsi -ls
iqn.1987-05.com.linux:01.7856c79a905e
4.配置存储资源,格式化分区
#iscsi-ls -l
#fdisk -l
#fdisk /dev/sdb
#m
#n
#p
#l
#w
#partprobe
#fdisk -l
#mkfs -t ext3 /dev/sdb1
mkfs.ext3 /dev/sdb1
/dev/sda1  /cluster/raid  ext3  defaults   0  0
5.配置自动挂载
#mkdir /test
#tune2fs -l /dev/sdc1 |grep uuid
ubuntu
2.1 open-iscsi安装
Debian sid中已经包含了 open-scsi, 安装只需要运行apt-get install open-iscsi
YourPCName:sudo apt-get install open-iscsi
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed
open-iscsi
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/104kB of archives.
After unpacking 340kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
open-iscsi
Install these packages without verification [y/N]? y
Selecting previously deselected package open-iscsi.
(Reading database ... 34744 files and directories currently installed.)
Unpacking open-iscsi (from .../open-iscsi_1.0.485-3_i386.deb) ...
Setting up open-iscsi (1.0.485-3) ...
Starting iSCSI initiator service: succeeded.
也可以从源代码安装open-iscsi, 从open-iscsi官方网站下载最新的open-iscsi原代码, 目前最新的版本为485. 解压后运行make; make install可安装open-iscsi.
2.2 启动open-iscsi后台服务. 如果使用apt-get的方式安装open-iscsi, 安装完成后, dpkg会自动启动open-iscsi服务, 如果是从原代码安装open-iscsi, 则需要手动启动open-iscsi服务.
YourPCName:sudo /etc/init.d/open-iscsi start
Starting iSCSI initiator service: succeeded.
dmesg中可以看到scsi_transport注册的信息.
iscsi: registered transport (tcp)
2.3 配置open-iscsi, 使其联接到iscsi target
2.3.1 设置open-iscsi使用的target
YourPCName:sudo iscsiadm -m discovery -t sendtargets -p 10.1.0.11:3260
[045e0b] 10.1.0.11:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz
其中, 10.1.0.11是iscsi target的ip地址, 3260是iscsi target使用的端口, 默认为3260, 如果使用默认端口则可以省略":3260". 输出结果中045e0b是这个iscsi target的record id, iqn.2001-04.com.example:storage.disk2.sys1.xyz为iscsi target的名称.
2.3.2 查看open-iscsi可以使用的target
YourPCName:sudo iscsiadm -m node
[045e0b] 10.1.0.11:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz
2.3.4 登录到iscsi target
YourPCName:sudo iscsiadm -m node -r 045e0b -l
登录成功后, 可以使用fdisk -l查看到iscsi磁盘
YourPCName:sudo fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2500 20081218+ 83 Linux
/dev/sda2 2501 2610 883575 5 Extended
/dev/sda5 2501 2610 883543+ 82 Linux swap / Solaris
Disk /dev/sdb: 8589 MB, 8589934592 bytes
64 heads, 32 sectors/track, 8192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 8192 8388592 83 Linux
Disk /dev/sdc: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes
Disk /dev/sdc doesn't contain a valid partition table
dmesg输出的末尾会提示iscsi磁盘的注册信息.
scsi1 : iSCSI Initiator over TCP/IP, v.0.3
Vendor: IET Model: VIRTUAL-DISK Rev: 0
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: Write Protect is off
sdb: Mode Sense: 77 00 00 08
SCSI device sdb: drive cache: write back
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: Write Protect is off
sdb: Mode Sense: 77 00 00 08
SCSI device sdb: drive cache: write back
sdb: sdb1
sd 1:0:0:0: Attached scsi disk sdb
Vendor: IET Model: VIRTUAL-DISK Rev: 0
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sdc: 2097152 512-byte hdwr sectors (1074 MB)
sdc: Write Protect is off
sdc: Mode Sense: 77 00 00 08
SCSI device sdc: drive cache: write back
SCSI device sdc: 2097152 512-byte hdwr sectors (1074 MB)
sdc: Write Protect is off
sdc: Mode Sense: 77 00 00 08
SCSI device sdc: drive cache: write back
sdc: unknown partition table
sd 1:0:0:1: Attached scsi disk sdc
2.3.5 不需要使用是可以注销iscsi登录.
YourPCName:sudo iscsiadm -m node -r 045e0b -u
YourPCName:sudo fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2500 20081218+ 83 Linux
/dev/sda2 2501 2610 883575 5 Extended
/dev/sda5 2501 2610 883543+ 82 Linux swap / Solaris


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/94238/showart_2102062.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP