Hi, as promised below some basic instructions to set up a iscsi target.
Note you will need to repeat all these commands after each reboot of the nas.
Solution for that is making a task that runs after each boot. The webinterface allows you to set such a task
Load required kernel modules
- Code: Select all
modprobe target-core-file
modprobe target-core-iblock
modprobe target-core-pscsi
modprobe iscsi-target-mod
Note following modules will be loaded automatically by loading above mentioned modules
configfs
target-core-mod
You can check if the modules are loaded by using this command
- Code: Select all
lsmod
Next mount configfs
- Code: Select all
mount -t configfs none /sys/kernel/config
folder /var/run/dbus must be present
- Code: Select all
mkdir /var/run/dbus
dbus daemon must be running
- Code: Select all
dbus-launch --config-file=/etc/dbus-1/system.conf
Now we configure and start the target here we set up as example a target with size of 1073 MB
It is a file that will be present in folder /share/1000 and has name iscsci-lun0
create a fileio backstore
- Code: Select all
cd /sys/kernel/config/target/core
mkdir -p fileio_0/fileio
echo "fd_dev_name=/share/1000/iscsi-lun0,fd_dev_size=1073741824" > fileio_0/fileio/control
echo 1 > fileio_0/fileio/attrib/emulate_write_cache
echo 1 > fileio_0/fileio/enable
create an iscsi target and a target portal group (TPG)
- Code: Select all
mkdir /sys/kernel/config/target/iscsi
cd /sys/kernel/config/target/iscsi
mkdir iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65
mkdir iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1
create a LUN
- Code: Select all
mkdir iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/lun/lun_0
ln -s ../core/fileio_0/fileio iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/lun/lun_0/data
enable it
- Code: Select all
echo 1 > iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/enable
Create a network portal 3260 is port which will be used by the target)
- Code: Select all
mkdir iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/np/0.0.0.0:3260
Disable authentication (unless you use an client that can handle authenciation, in that case you need to set it up differently)
- Code: Select all
echo 0 > iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/attrib/authentication
echo 1 > iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/attrib/generate_node_acls
Allow write access for non authenticated initiators
- Code: Select all
echo 0 > iqn.2003-01.org.linux-iscsi.fvdwsl-base.armv5tel:sn.ed2fb2411a65/tpgt_1/attrib/demo_mode_write_protect
ready now you should be to connect with a client initiator and format the new drive and put files on it
Hope everything is clear, success