天天看點

iscsi常用指令

1.檢視target 資訊

# tgt-admin  --show

或者

# tgtadm --lld iscsi --mode target --op show

Target 1: iqn.2010-10.org.openstack:volume-00000008

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: 10737 MB, Block size: 512

Online: Yes

Removable media: No

Readonly: No

Backing store type: rdwr

Backing store path: /dev/nova-volumes/volume-00000008

Backing store flags: 

Account information:

ACL information:

ALL

2.手動發現target,偵測 172.26.80.5 這部 iSCSI 裝置的相關資料

#iscsiadm -m discovery -t sendtargets -p 172.26.80.5

3.顯示系統所有target

#iscsiadm -m node

172.26.80.5:3260,1 iqn.2010-10.org.openstack:volume-00000008

4.登入target

# iscsiadm -m node -T iqn.2010-10.org.openstack:volume-00000008  --login

Logging in to [iface: default, target: iqn.2010-10.org.openstack:volume-00000008, portal: 172.26.80.5,3260]

Login to [iface: default, target: iqn.2010-10.org.openstack:volume-00000008, portal: 172.26.80.5,3260]: successful

#fdisk -l 可以檢視到多了一個新的磁盤,大小和volume-00000008一樣大

5.登出target

# iscsiadm -m node -T iqn.2010-10.org.openstack:volume-00000008  --logout

Logging out of session [sid: 1, target: iqn.2010-10.org.openstack:volume-00000008, portal: 172.26.80.5,3260]

Logout of [sid: 1, target: iqn.2010-10.org.openstack:volume-00000008, portal: 172.26.80.5,3260]: successful

6.檢視建立的session

#iscsiadm -m session

tcp: [3] 172.26.80.5:3260,1 iqn.2010-10.org.openstack:volume-00000008

隻有登入target才能看到會話

7.删除target

#iscsiadm -m node -o delete -T iqn.2010-10.org.openstack:volume-00000008

隻有logout後,才能删除target

繼續閱讀