1,391 瀏覽數

RHEL5 – iSCSI 從 iSCSI Target 移除硬碟

剛剛我們指定了一個硬碟 /dev/sdb1 給 iSCSI Target ,現在我們再透過指令新增另外一個硬碟 /dev/sdb2 ,後面就是這一次的重點如何移除指定好的硬碟.

[root@benjr ~]# tgtadm –lld iscsi –op new –mode logicalunit –tid 1 –lun 2 -b /dev/sdb2
[root@benjr ~]# tgtadm –lld iscsi –op show –mode target
Target 1: iqn.2009-4.tw.benjr:storage
    System information:
        Driver: iscsi
        Status: running
    I_T nexus information:
        I_T nexus: 3
            Initiator: iqn.1994-05.com.redhat:116f23e2ef8
            Connection: 0
                IP Address: 192.8.1.121
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: deadbeaf1:0
            SCSI SN: beaf10
            Size: 0
            Backing store: No backing store
        LUN: 1
            Type: disk
            SCSI ID: deadbeaf1:1
            SCSI SN: beaf11
            Size: 9G
            Backing store: /dev/sdb1
        LUN: 2
            Type: disk
            SCSI ID: deadbeaf1:2
            SCSI SN: beaf12
            Size: 9G
            Backing store: /dev/sdb2
    Account information:
    ACL information:
        192.8.1.121
        192.8.1.0/24

透過參數 –op delete 去移除 –lun2 也就是 /dev/sdb2 的硬碟空間.

[root@benjr ~]# tgtadm –lld iscsi –op delete –mode logicalunit –tid 1 –lun 2
[root@benjr ~]# tgtadm –lld iscsi –op show –mode target
Target 1: iqn.2009-4.tw.benjr:storage
    System information:
        Driver: iscsi
        Status: running
    I_T nexus information:
        I_T nexus: 3
            Initiator: iqn.1994-05.com.redhat:116f23e2ef8
            Connection: 0
                IP Address: 192.8.1.121
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: deadbeaf1:0
            SCSI SN: beaf10
            Size: 0
            Backing store: No backing store
        LUN: 1
            Type: disk
            SCSI ID: deadbeaf1:1
            SCSI SN: beaf11
            Size: 9G
            Backing store: /dev/sdb1
    Account information:
    ACL information:
        192.8.1.121
        192.8.1.0/24

很好 –lun 2 已經不存在了.不過很可惜是剛剛所有使用 tgtadm 指令設定 iSCSI Target 在重新開機後就不存在了,所以建議將剛剛幾個指令寫在 /etc/rc.local 檔案中.

網友的想法

  1. 自動參照通知: RHEL5 – iSCSI | Benjr.tw

發表迴響