next up previous contents
Next: 安全機制 Up: ISCSI Previous: ISCSI 簡介   Contents

ISCSI server 架設

  1. 安裝套件
    [root@dyH ~]# yum install scsi-target-utils
    

  2. 產生 file-based images
    ## 產生 images 存放目錄
    [root@dyH ~]# mkdir /srv/iscsi/   
    ## 產生 images 
    [root@deH ~]# dd if=/dev/zero of=/srv/iscsi/disk.img bs=1M count=50
    50+0 records in
    50+0 records out
    52428800 bytes (52 MB) copied, 0.0319766 s, 1.6 GB/s
    

  3. 設定 SELinux file contexts
    [root@dyH ~]# chcon -Rv -t tgtd_var_lib_t /srv/iscsi/
    changing security context of `/srv/iscsi/disk.img'
    changing security context of `/srv/iscsi/'
    

  4. 啟動 tgtd 服務
    [root@dyH ~]# /etc/init.d/tgtd restart
    

  5. 設定開機啟動 tgtd 服務
    [root@dyH ~]# chkconfig tgtd on
    

  6. 確認 targets
    [root@dyH ~]# tgt-admin --show
    Target 1: iqn.2012-05.wang.deyu:deyudisk
        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
                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: 52 MB, Block size: 512
                Online: Yes
                Removable media: No
                Readonly: No
                Backing store type: rdwr
                Backing store path: /srv/iscsi/disk.img
                Backing store flags: 
        Account information:
        ACL information:
            192.168.122.0/24
    



2018-04-25