# FreeBSD + ISCSi + Openfiler



## LaR3 (Nov 17, 2008)

Hello,

Does anyone know how to make FreeBSD 7 add the iscsi targets automatically after reboot ??

P.S. Configuring /etc/iscsi.conf and iscsi_initiator_load="yes" in /boot/loader.conf doesn't do the job.

And I'm not looking for some workaround like cron @reboot.

I searched all the man pages but didn't find anything.


----------



## JohnNielsen (Nov 18, 2008)

The loader.conf addition will load the kernel module at boot, and /etc/iscsi.conf defines the targets you (might) want to use. To actually attach a target to the initiator you need to run "iscontrol -n NAME", where NAME is one of the targets you have defined in iscsi.conf.

I would like to see an rc script that attaches specified targets at boot but unfortunately there is not one included with the base system currently. That doesn't mean you can't write your own, however. IIRC there are even example scripts floating around, though I don't have a link to one handy.


----------



## LaR3 (Nov 18, 2008)

it works with cron
@reboot (iscontrol -n target; sleep 10; mount /dev/daX /path)

The thing is that an rc script would be useless, if you want to have the filesystem mounted at boot time within /etc/fstab.


----------



## vivek (Nov 19, 2008)

How about /usr/local/etc/rc.d/mount.iscsi.sh with following line:


```
#!/bin/sh
iscontrol -n target
sleep 10
mount /dev/daX /path
```

See rc(8) and rcorder(8).


----------



## LaR3 (Nov 19, 2008)

Vivek, probably will not get executed at startup. But anyways, I'm intereted in having the filesystem mounted from fstab. That would mean that when the kernel loads iscsi_initiator module, to automatically see the /dev/daX device. Untill then, either cron or rc script


----------

