输入您的问题查找答案
   
 
相关文库文档
更多相关文库文档 >>
联系客服
在线技术支持
客户服务热线:

电话销售热线:

服务时间(法定节假日除外):
家庭产品:
周一至周六:9:00-18:00
商用产品:
周一至周五:9:00-18:00
商用网络动态

与 NETGEAR 监控专用交换机亲密接触

选择德才兼备的 PoE 交换机

NETGEAR 交换机助力聊城第二人民医院智能监控建设

更多动态 >>

网件文库 » 存储产品  »  Linux iSCSI 发起端连接到 ReadyDATA 的方法
Linux iSCSI 发起端连接到 ReadyDATA 的方法

编号:50219       来自:NetGear       更新日期:2013-11-01       访问数量:12134

文档适用产品型号:RDD516,RD5200,RDD1,EDA4000,EDA2000,RD5D

首先在ReadyDATA上面建立好一个LUN,在这里,“块大小”建议使用比文件系统的块更大的大小。正常来说对于NTFS/ext4等文件系统,64K是个不错的选择。如果是VMWARE的VMFS,那么可以使用128KB的块大小。

接着将该LUN添加到一个LUN GROUP

这里简单起见,允许所有客户端来连接

接着进入Linux系统,以root的身份运行一下命令(这里以CentOS 6.4为例)

首先需要运行iscsi和iscsid服务,并设置为开机启动:
[root@localhost ~]# service iscsi start
[root@localhost ~]# service iscsid start
[root@localhost ~]# chkconfig iscsi on
[root@localhost ~]# chkconfig iscsid on

发现ReadyDATA上面有哪些目标:
[root@localhost ~]# iscsiadm -m discovery -t st -p 192.168.100.23:3260
192.168.100.23:3260,1 iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1
5.176.39.84:3260,1 iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1

接着进行登录操作
[root@localhost ~]# iscsiadm -m node -T iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1 -p 192.168.100.23:3260 -l
Logging in to [iface: default, target: iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1, portal: 192.168.100.23,3260] (multiple)
Login to [iface: default, target: iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1, portal: 192.168.100.23,3260] successful.

使用fdisk来查看连接上的LUN,在这里,sdd就是所连接的LUN(这里省略其他输出)
[root@localhost ~]# fdisk -l
Disk /dev/sdd: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

接着进行分区
[root@localhost ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf2100e46.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
          switch off the mode (command 'c') and change display units to
          sectors (command 'u').

Command (m for help): n
Command action
          e          extended
          p           primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Using default value 13054

Command (m for help): p

Disk /dev/sdd: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf2100e46

Device Boot Start End Blocks Id System
/dev/sdd1 1 13054 104856223+ 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

促使内核重新扫描分区表
[root@localhost ~]# partx -a /dev/sdd
BLKPG: Device or resource busy
error adding partition 1

格式化分区
[root@localhost ~]# mkfs.ext4 /dev/sdd1
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214055 blocks
1310702 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
          32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
          4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

获取UUID,以便用于mount操作
[root@localhost ~]# blkid /dev/sdd1
/dev/sdd1: UUID="5de0fe88-5e41-4301-be6d-88a2eb10a4f2" TYPE="ext4"

接着设置启动时自动mount的参数,添加下面这行自动挂载参数。在这里,使用_netdev参数的作用是“在开机时,网络服务全部启动之后,再来连接并挂载该iSCSI”。避免网络还没准备好,就尝试连接iSCSI。
[root@localhost ~]# vim /etc/fstab
UUID=5de0fe88-5e41-4301-be6d-88a2eb10a4f2 /iscsi ext4 _netdev 0 0

建立挂载目录
[root@localhost ~]# mkdir /iscsi

执行挂载
[root@localhost ~]# mount -a

查看是否挂载成功(省略其他参数)
[root@localhost ~]# mount
/dev/sdd1 on /iscsi type ext4 (rw,_netdev)

这样就大功告成了。接着可以看看iSCSI上面的发现记录:
[root@localhost ~]# iscsiadm -m node
5.176.39.84:3260,1 iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1
192.168.100.23:3260,1 iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1

以及现在的连接会话状况:
[root@localhost ~]# iscsiadm -m session
tcp: [2] 192.168.100.23:3260,1 iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1

如果想断开连接:
[root@localhost ~]# iscsiadm -m node -T iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1 -u
Logging out of session [sid: 4, target: iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1, portal: 192.168.100.23,3260]
Logout of [sid: 4, target: iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1, portal: 192.168.100.23,3260] successful.

如果不再需要连接到该ISCSI Target,必须删掉该记录,不然开机还会重新连接:
[root@localhost ~]# iscsiadm -m node -T iqn.1994-11.com.netgear:res-c7-93-c4:ce3ca99a:group1 -o delete

然后将fstab里面的记录删除。

 

序号

日期

跟进人

内容摘要

1

2013-10-31

Canfeng Li

文档创建

 

  
 
以上内容是否为您所需要的答案?
以上内容是否清晰、简明和易于理解的?
您是如何知道网件社区的?