Adding a iSCSI target on the fly without restarting the iscsi service

Last edited

Adding a new target on an already running iSCSI server without restarting

Debian iSCSI server

My iSCSI server runs Debian Wheezy and several diskless servers have their filesystem on this iSCSI server. I needed some extra diskspace on an another Debian box that already had mounted an iSCSI target.

Creating a new target on the fly

After some Google searches I did the following on the iSCSI server:

First: create a 5Gb image:

dd if=/dev/zero of=lxc-fs.img bs=1024k count=5000

Next: configure iet on the fly:

ietadm --op new --tid=10 --params
ietadm --op new --tid=10 --lun=0 --params Path=/path/to/new.img

This way the ietd.conf does not have to be reread by a restart.

After this the target lun can be discovered on the normal way.

iscsiadm -m discovery -t st -p