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

 

 

你可能感兴趣的:(linux,云计算,iSCSI,块存储)