Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1134890
  • 博文数量: 414
  • 博客积分: 10030
  • 博客等级: 上将
  • 技术积分: 4440
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-05 21:42
文章分类

全部博文(414)

文章存档

2011年(1)

2009年(1)

2008年(412)

我的朋友

分类: LINUX

2008-10-11 14:37:49

曾经在Red Hat Enterprise 3 下配置百兆网卡利用 ISCSI 访问 NetApp。 感觉还是比较方便。性能倒没有多留意。

    实战系统版本:

    [root@trade /]# cat /etc/redhat-release

    Red Hat Enterprise AS release 3 (Taroon Update 7)

    据资料介绍,redhat linux as3 从Update 4的版本开始,开始内置支持iscsi,集成iscsi-initiator。

    [root@trade /]# rpm -qa|grep iscsi

    iscsi-initiator-utils-3.6.3-3

    step1:生成iSCSI

    [root@trade /]# iscsi-iname

    iqn.1987-05.com.cisco:01.d7e04ce46ca5

    step2:配置/etc/iscsi.conf,里面参数可以很多,但是最简单就是:

    #DiscoveryAddress=

    DiscoveryAddress=172.16.35.228

    TargetName=iqn.1987-05.com.cisco:test2

    step3:诊断、连接netapp

    [root@trade /]#/etc/init.d/iscsi start ,如果长期使用,还需要用setup命令,把iscsi服务设置成开机自动启动。

    Checking iscsi config: [ OK ]

    Loading iscsi driver: [ OK ]

    Starting iscsid: [ OK ]

    还可以用dmesg命令观察lun的连接情况,确定lun的设备名。

    #dmesg

    iSCSI: 3.6.1 (22-Sep-2004) built for 2.4.21-27.ELsmp

    iSCSI: will translate deferred sense to current sense on disk command responses

    iSCSI: control device major number 254

    iSCSI: allocating task cache iscsi_0000729382 with reaping disabled

    iSCSI: detected HBA f6aed100, host #2

    scsi2 : iSCSI 3.6.1 (22-Sep-2004)

    iSCSI: bus 0 target 0 = iqn.1992-08.com.netapp:sn.84192734

    iSCSI: bus 0 target 0 portal 0 = address 172.16.35.228 port 3260 group 1

    iSCSI: bus 0 target 0 trying to establish session c3ae8000 to portal 0, address 172.16.35.228 port 3260 group 1

    iSCSI: bus 0 target 0 established session c3ae8000 #1, portal 0, address 172.16.35.228 port 3260 group 1

    scsi singledevice 2 0 0 1

     Vendor: NETAPP Model: LUN Rev: 0.2

     Type: Direct-Access ANSI SCSI revision: 04

    Attached scsi disk sdb at scsi2, channel 0, id 0, lun 1

    iSCSI: session c3ae8000 recv_cmd f693aa00, cdb 0x0, status 0x2, response 0x0, senselen 18, key 06, ASC/ASCQ 29/00,

    itt 3 task f6906f74 to (2 0 0 1), iqn.1992-08.com.netapp:sn.84192734

    iSCSI: Sense f0000600 0000000a 00000000 29000000 0000

    SCSI device sdb: 20971520 512-byte hdwr sectors (10737 MB)

    sdb: unknown partition table

    查看设备信息

    此时可以使用iscsi-ls等命令查看相关Lun信息

    # iscsi-ls

    ****************************************************************************

    SFNet iSCSI Driver Version ...4:0.1.11(12-Jan-2005)

    ****************************************************************************

    TARGET NAME : iqn.1992-08.com.netapp:sn.84192734

    TARGET ALIAS :

    HOST ID : 0

    BUS ID : 0

    TARGET ID : 0

    TARGET ADDRESS : 172.16.35.228:3260,1

    SESSION STATUS : ESTABLISHED AT Tue Nov 8 15:43:38 CST 2005

    SESSION ID : ISID 00023d000001 TSIH 101

    ****************************************************************************

     step4:格式化设备待用

    # fdisk /dev/sdb

    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

    Building a new DOS disklabel. Changes will remain in memory only,

    until you decide to write them. After that, of course, the previous

    content won't be recoverable.

    The number of cylinders for this disk is set to 20480.

    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): p

    Disk /dev/sdb: 21.4 GB, 21474836480 bytes

    64 heads, 32 sectors/track, 20480 cylinders

    Units = cylinders of 2048 * 512 = 1048576 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-20480, default 1):

    Using default value 1

    Last cylinder or +size or +sizeM or +sizeK (1-20480, default 20480): +4096M

    Command (m for help): p

    Disk /dev/sdb: 21.4 GB, 21474836480 bytes

    64 heads, 32 sectors/track, 20480 cylinders

    Units = cylinders of 2048 * 512 = 1048576 bytes

     Device Boot Start End Blocks Id System

    /dev/sdb1 1 3907 4000752 83

    Command (m for help): n

    Command action

     e extended

     p primary partition (1-4)

    p

    Partition number (1-4): 2

    First cylinder (3908-20480, default 3908):

    Using default value 3908

    Last cylinder or +size or +sizeM or +sizeK (3908-20480, default 20480):

    Using default value 20480

    Command (m for help): p

    Disk /dev/sdb: 21.4 GB, 21474836480 bytes

    64 heads, 32 sectors/track, 20480 cylinders

    Units = cylinders of 2048 * 512 = 1048576 bytes

     Device Boot Start End Blocks Id System

    /dev/sdb1 1 3907 4000752 83

    /dev/sdb2 3908 20480 16970752 83

    Command (m for help): w

    The partition table has been altered!

    Calling ioctl() to re-read partition table.

    Syncing disks.

    # cd /

    # mkdir netdisk 建立mount点

    # mkfs /dev/sdb1

    mke2fs 1.32 (09-Nov-2002)

    Filesystem label=

    OS type:

    Block size=4096 (log=2)

    Fragment size=4096 (log=2)

    500960 inodes, 1000188 blocks

    50009 blocks (5.00%) reserved for the super user

    First data block=0

    31 block groups

    32768 blocks per group, 32768 fragments per group

    16160 inodes per group

    Superblock backups stored on blocks:

     32768, 98304, 163840, 229376, 294912, 819200, 884736

    Writing inode tables: done

    Writing superblocks and filesystem accounting information: done

    This filesystem will be automatically checked every 29 mounts or

    180 days, whichever comes first. Use tune2fs -c or -i to override.

    # mount /dev/sdb1 /netdisk

    # df -k /netdisk

    Filesystem 1K-blocks Used Available Use% Mounted on

    /dev/sdb1 3937820 20 3737764 1% /data1

阅读(579) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~