ISCSI Target Configuration CentOS 7

Hi Guys,
I have created iSCSI LUNs using targetcli and exported it to the initiator, the backstores used for LUNs were lvm volume.

There were new PV, VG, LV created on iSCSI LUNs from initiator side. But after rebooting the target server, I observed that target.service could not start automatically and shows errors that lvm volumes used for backstores are already in use:

$ systemctl start target.service
Job for target.service failed. See ‘systemctl status target.service’ and ‘journalctl -xn’ for details.

Aug 12 15:00:50 target[1748]: File “/usr/lib/python2.7/site-packages/rtslib/”, line 189, in restore
Aug 12 15:00:50 target[1748]: so_obj = so_cls(**kwargs)
Aug 12 15:00:50 target[1748]: File “/usr/lib/python2.7/site-packages/rtslib/”, line 669, in init
Aug 12 15:00:50 target[1748]: self._configure(dev, wwn, readonly)
Aug 12 15:00:50 target[1748]: File “/usr/lib/python2.7/site-packages/rtslib/”, line 682, in _configure
Aug 12 15:00:50 target[1748]: + “device %s is already in use.” % dev)
Aug 12 15:00:50 target[1748]: rtslib.utils.RTSLibError: Cannot configure StorageObject because device /dev/sdb is already in use.
Aug 12 15:00:50 systemd[1]: target.service: main process exited, code=exited, status=1/FAILURE
Aug 12 15:00:50 systemd[1]: Failed to start Restore LIO kernel target configuration.
Aug 12 15:00:50 systemd[1]: Unit target.service entered failed state.

Any Ideas would be greatly appreciated.
I’ve searched every where to no avail.


Maybe the lvm was detected by the target during boot. Check your lvm.conf and exclude the hdd. Maybe the output of dmsetup may help to debug further.


I think that’s exactly what’s happening because the target shouldn’t detect the lvm that’s configured on the initiatior side.
Secondly, all the SCSI configuration on the target side are lost after reboot. But it still shows the lvm from the initiator.
I’ll try your solution and I’ll report back. Thank you much.