zoukankan      html  css  js  c++  java
  • Centos 安装配置iscsi

    在测试oracle rac的时候用iscsi来模拟磁阵的(真的磁阵需要多路径软件),简单的记录下

    #scsi server
    yum install scsi-target-utils
    
    service tgtd start
    
    chkconfig tgtd on
    
    mkdir /srv/iscsi
    dd if=/dev/zero of=/srv/iscsi/disk01.img bs=1M count=200
    #配置虚拟磁盘
    vi /etc/tgt/targets.conf
    #backing-store (虚拟的装置)
    #direct-store (实际的装置)
    
    <target iqn.2014-11.dev.iscsi-target:iscsidisk>
    backing-store /srv/iscsi/disk01.img
    initiator-address 192.168.55.0/24
    incominguser iscsiadm iscsiadm123
    write-cache off
    </target>
    [root@localhost ~]# tgt-admin -show
    Target 1: iqn.2014-11.dev.iscsi-target:iscsidisk
    System information:
    Driver: iscsi
    State: ready
    I_T nexus information:
    LUN information:
    LUN: 0
    Type: controller
    SCSI ID: IET 00010000
    SCSI SN: beaf10
    Size: 0 MB, Block size: 1
    Online: Yes
    Removable media: No
    Prevent removal: No
    Readonly: No
    Backing store type: null
    Backing store path: None
    Backing store flags: 
    LUN: 1
    Type: disk
    SCSI ID: IET 00010001
    SCSI SN: beaf11
    Size: 210 MB, Block size: 512
    Online: Yes
    Removable media: No
    Prevent removal: No
    Readonly: No
    Backing store type: rdwr
    Backing store path: /srv/iscsi/disk1.img
    Backing store flags: 
    Account information:
    ACL information:
    192.168.55.0/24
    
    [root@localhost ~]# tgt-admin --show
    Target 1: iqn.2014-11.dev.iscsi-target:iscsidisk
    System information:
    Driver: iscsi
    State: ready
    I_T nexus information:
    I_T nexus: 5
    Initiator: iqn.1994-05.com.redhat:1e12cf823426
    Connection: 0
    IP Address: 192.168.55.159
    LUN information:
    LUN: 0
    Type: controller
    SCSI ID: IET 00010000
    SCSI SN: beaf10
    Size: 0 MB, Block size: 1
    Online: Yes
    Removable media: No
    Prevent removal: No
    Readonly: No
    Backing store type: null
    Backing store path: None
    Backing store flags: 
    Account information:
    ACL information:
    ALL
    #scsi client install
    yum install iscsi-initiator-utils
    
    chkconfig iscsid on
    chkconfig iscsi on
    /etc/init.d/iscsi start
    /etc/init.d/iscsid start
    #add
    #vi /etc/iscsi/iscsid.conf
    node.session.auth.username = iscsiadm
    node.session.auth.password = iscsiadm123
    
    #修改客户端名字
    vi /etc/iscsi/initiatorname.iscsi
    #InitiatorName=iqn.1994-05.com.redhat:1e12cf823426
    InitiatorName=iqn.2014-11.dev.iscsi-initiator:initiator
    
    #发现
    iscsiadm -m discovery -t sendtargets -p 192.168.55.158
    192.168.55.158:3260,1 iqn.2014-11.dev.iscsi-target:iscsidisk
    
    #登陆
    iscsiadm -m node -T iqn.2014-11.dev.iscsi-target:iscsidisk -p 192.168.55.158:3260 --login
    Logging in to [iface: default, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260] (multiple)
    Login to [iface: default, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260] successful.
    
    #退出
    iscsiadm -m node -T iqn.2014-11.dev.iscsi-target:iscsidisk -p 192.168.55.158:3260 --logout
    Logging out of session [sid: 1, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260]
    Logout of [sid: 1, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260] successful.
    
     
    
    #查看连接
    iscsiadm -m session
    tcp: [5] 192.168.55.158:3260,1 iqn.2014-11.dev.iscsi-target:iscsidisk (non-flash)
    #查看
    
    [root@localhost ~]# fdisk -l
    
    Disk /dev/sda: 12.9 GB, 12884901888 bytes
    255 heads, 63 sectors/track, 1566 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: 0x0004c11a
    
    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 64 512000 83 Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 64 1567 12069888 8e Linux LVM
    
    Disk /dev/mapper/VolGroup-lv_root: 11.1 GB, 11068768256 bytes
    255 heads, 63 sectors/track, 1345 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
    
    
    Disk /dev/mapper/VolGroup-lv_swap: 1287 MB, 1287651328 bytes
    255 heads, 63 sectors/track, 156 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
    
    
    Disk /dev/sdb: 209 MB, 209715200 bytes
    7 heads, 58 sectors/track, 1008 cylinders
    Units = cylinders of 406 * 512 = 207872 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
  • 相关阅读:
    async简单使用
    node调用phantomjs-node爬取复杂页面
    mongodb3 ubuntu离线安装(非apt-get)及用户管理
    2040-亲和数(java)
    JavaScript闭包简单理解
    nodejs构建多房间简易聊天室
    linux下安装nodejs及npm
    EventBus轻松使用
    mysql用户创建及授权
    python中json的基本使用
  • 原文地址:https://www.cnblogs.com/caoguo/p/4796435.html
Copyright © 2011-2022 走看看