这个服务之前在CentOS 7 上挺好的,不过自从不久前切换成Debian 10之后就一直不成功,今天终于处理了。
主要参考文章:
https://www.server-world.info/en/note?os=Debian_10&p=iscsi&f=2
这篇文章一共推荐了两种方式:tgt, targetcli, 之前在CentOS 使用的是targetcli, 挺顺利的,不过启动的时候有些问题,试了很多次,不行就放弃了。
这次主要是使用tgt, 主要步骤如下:
注意: 这里没添加密码,由于家里内网就不加了,主要是密码没加成功
apt -y install targetcli-fb
cat > /etc/tgt/conf.d/target01.conf << EOF
<target iqn.2021-01.loveyu.org:win10.disk>
backing-store /data/iscsi/win-disk.img
initiator-name iqn.2021-01.loveyu.org:win10-pc
</target>
EOF
systemctl restart tgt
systemctl status tgt
cat > /etc/tgt/conf.d/target01.conf << EOF
<target iqn.2021-01.loveyu.org:win10.disk>
backing-store /data/iscsi/win-disk.img
initiator-name iqn.2021-01.loveyu.org:win10-pc
</target>
EOF
systemctl restart tgt
systemctl status tgt
这时候输出了如下内容,感觉还是有些问题,不过暂时不处理了。
1月 23 17:49:08 Gen10-Debian systemd[1]: Starting (i)SCSI target daemon...
1月 23 17:49:08 Gen10-Debian tgtd[14420]: tgtd: iser_ib_init(3431) Failed to initialize RDMA; load kernel modules?
1月 23 17:49:08 Gen10-Debian tgtd[14420]: tgtd: work_timer_start(146) use timer_fd based scheduler
1月 23 17:49:08 Gen10-Debian tgtd[14420]: tgtd: bs_init(387) use signalfd notification
1月 23 17:49:09 Gen10-Debian tgtd[14420]: tgtd: device_mgmt(246) sz:37 params:path=/data/iscsi/win-disk.img
1月 23 17:49:09 Gen10-Debian tgtd[14420]: tgtd: bs_thread_open(409) 16
1月 23 17:49:09 Gen10-Debian systemd[1]: Started (i)SCSI target daemon.
1月 23 17:49:08 Gen10-Debian tgtd[14420]: tgtd: iser_ib_init(3431) Failed to initialize RDMA; load kernel modules?
1月 23 17:49:08 Gen10-Debian tgtd[14420]: tgtd: work_timer_start(146) use timer_fd based scheduler
1月 23 17:49:08 Gen10-Debian tgtd[14420]: tgtd: bs_init(387) use signalfd notification
1月 23 17:49:09 Gen10-Debian tgtd[14420]: tgtd: device_mgmt(246) sz:37 params:path=/data/iscsi/win-disk.img
1月 23 17:49:09 Gen10-Debian tgtd[14420]: tgtd: bs_thread_open(409) 16
1月 23 17:49:09 Gen10-Debian systemd[1]: Started (i)SCSI target daemon.
然后查询当前磁盘的状态
tgtadm --mode target --op show
Target 1: iiqn.2021-01.loveyu.org:win10.disk
System information:
Driver: iscsi
State: ready
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: 1073742 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: /data/iscsi/win-disk.img
Backing store flags:
Account information:
ACL information:
ALL
iqn.2021-01.loveyu.org:win10-pc
System information:
Driver: iscsi
State: ready
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: 1073742 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: /data/iscsi/win-disk.img
Backing store flags:
Account information:
ACL information:
ALL
iqn.2021-01.loveyu.org:win10-pc
然后打开windows 10 的iscsi的目标发现,一般使用win+s, 搜索 iscsi, 打开
当前还没有任何评论