Feb.08

Ubuntu iscsi Target :Could not create /sys/kernel/config/target/core/iblock_0: [Errno 22] Invalid argument: ‘/sys/kernel/config/target/core/iblock_0’

As mentioned in the heading, i faced this issue while adding block device.

 

I have configured everything and some how the configuration got corrupted . So i decided to recreate iscsi target with all configuration.

 

I felt this is bug and the reason behind this is kernel module was unloaded from kernel. This module should load automatically while starting targetcli or the iscsi services. After spending log time i figured out iblock was not loaded.

 

Here comes the solution, Check currently loaded modules

 

# lsmod | grep target
iscsi_target_mod 299008 1
target_core_mod 352256 6 iscsi_target_mod,usb_f_tcm,tcm_loop
configfs 40960 6 rdma_cm,iscsi_target_mod,usb_f_tcm,target_core_mod,libcomposite

 

if target_core_iblock is not listed, load that manually by using below command .

 

# insmod /lib/modules/4.8.0-22-generic/kernel/drivers/target/target_core_iblock.ko

 

After that check the loaded modules

 

# lsmod | grep target
target_core_iblock 20480 0
iscsi_target_mod 299008 1
target_core_mod 352256 7 iscsi_target_mod,usb_f_tcm,target_core_iblock,tcm_loop
configfs 40960 6 rdma_cm,iscsi_target_mod,usb_f_tcm,target_core_mod,libcomposite

 

Then i can able to add block device

 

# targetcli /backstores/iblock create name=ubuntu-iscsi-2 dev=/dev/vg_root/lv_iscsi
Created iblock storage object ubuntu-iscsi-2 using /dev/vg_root/lv_iscsi.