介紹
Linux SCSI target framework (tgt)
Home Page: http://stgt.sourceforge.net/
tgtd
Install
yum -y install scsi-target-utils
DOC
man targets.conf
設定 targets
vi /etc/tgt/targets.conf
# a hierarchy of nested tags to define targets and LUNs
default-driver iscsi
<target iqn.2015-02.esxi.server:target00> # provided devicce as a iSCSI target backing-store /backup/esxi_iscsi_bak/esxi.iscsi.disk # LUN1 backing-store /dev/san/xen1-disk1 # LUN2 # iSCSI Initiator's IP address you allow to connect # initiator-address ALL initiator-address 10.0.0.31 </target>
# default on
write-cache on
# authentication, may be used multiple times per target
incominguser username password
LUN directives
backing-store (regular file, or a block device
direct-store (VENDOR_ID, SERIAL_NUM)
# ext4
fallocate -l 400G esxi.iscsi.disk
# ext3
truncate -s 400G esxi.iscsi.disk
service tgtd start
chkconfig tgtd on
# Confirm status
tgtadm --mode target --op show
Target 1: iqn.2015-02.esxi.server:target00 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: 429497 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /backup/esxi_iscsi_bak/esxi.iscsi.disk Backing store flags: Account information: ACL information: 10.0.0.31
tgtadm - Linux SCSI Target Administration Utility
--mode (-m)
target
logicalunit
--op (-o)
show
new
delete
bind
unbind
update
tgt-admin - Linux SCSI Target Configuration Tool (/etc/tgt/targets.conf)
tgt-admin --show
相當於
tgtadm --mode target --op show
--offline
--ready
--update iqn.2008-08.com.example:some.target
--delete iqn.2008-08.com.example:some.target