Ubuntu iSCSI服务-Windows挂载-简易教程
以下为安装tgt服务,(SCSI Target服务)
#apt install tgt -y
以下命令为创建一个Target其tid为1名称为iqn.2020-11.com:cmtg
#tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2020-11.com:cmtg
以下命令为查看Target记录是否已创建
#tgtadm --lld iscsi --mode target --op show
Target 1: iqn.2020-11.com:cmtg 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 SWP: No Thin-provisioning: No Backing store type: null Backing store path: None Backing store flags: Account information: ACL information:
以下命令让任何人都能连接到该Target
#tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
以下命令为创建一个新的LUN号,/dev/sda可以是一个硬盘,或分区,或卷组,或RAID
#tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sda
以下命令查看icssi服务状态
#tgtadm --lld iscsi --mode target --op show
Target 1: iqn.2020-11.com:cmtg 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 SWP: No Thin-provisioning: No Backing store type: null Backing store path: None Backing store flags: LUN: 1 Type: disk SCSI ID: IET 00010001 SCSI SN: beaf11 Size: 500108 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No SWP: No Thin-provisioning: No Backing store type: rdwr Backing store path: /dev/sda Backing store flags: Account information: ACL information: ALL
直接Windows搜索iSCSI发起程序(没有启动服务器回提醒你启动下的)
输入服务器IP快速连接就OK了~,记录2020/11/12
补充:(2020/11/16)
如果配置正确的话可以使用以下命令保存到配置
tgt-admin --dump > /etc/tgt/targets.conf
奶沫