# Automatically mounting ZFS over iSCSI



## LoZio (Aug 12, 2009)

Hi,
 I'm running 

```
7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2 #0: Wed Jun 24 00:14:35 UTC 2009     [email]root@amd64-builder.daemonology.net[/email]:/usr/obj/usr/src/sys/GENERIC  amd64
```

I compiled and installed an uopdated version of the iSCSI stack, that now works ok on my Netapp backend. I would like to have the da0 disk to appear at boot time. 
Now I manually activate it with
[cmd=]iscontrol -c /etc/iscsi.conf -n netapp[/cmd]
and this is my cfg iscsi.conf

```
InitiatorName=iqn.2009-05.belli.xxxxx.acme:yyy;

netapp {
TargetName=iqn.1992-08.com.netapp:sn.101174542
TargetAddress=192.168.51.4:3260,1005

}
```

I put
iscsi_initiator_load="YES" into /boot/loader.conf with no success. Any ideas?

Also I must use [cmd=]zfs mount [/cmd]to have the dataset on a pool on da0 available to the system. How can I automate it all?
Thanks


----------



## desnudopenguino (Aug 13, 2009)

Try this:

```
# echo 'zfs_enable="YES"' >> /etc/rc.conf
```
That will let FreeBSD mount your ZFS pools when the system initializes.  [cmd=]zfs mount[/cmd] (without any options/switches) shows you the currently mounted ZFS filesystems.

Check out The Z File System(ZFS) in the handbook, if you haven't already.  The good stuff's in there


----------



## LoZio (Aug 13, 2009)

desnudopenguino said:
			
		

> Try this:
> 
> ```
> # echo 'zfs_enable="YES"' >> /etc/rc.conf
> ...



Thanks, I didn't mention I read that guide and the Solaris one (much more detailed). I have that line in my rc.conf, but I have problems on the iSCSI side, since the disk does not show up at boot, so any zfs mount command is unuseful till I manually start iscontrol.
Yes, I can put the command as a line in rc.conf, but something tells me it is not the right way...


----------



## desnudopenguino (Aug 13, 2009)

Hmmm...  So you're not getting your iSCSI to mount on boot then?  I don't have any experience with iSCSI, but I'll take a shot in the dark since nobody else has.  You could throw verbose_loading="YES" into /boot/loader.conf up at the top to show the module names as they load, maybe you have a syntax error in your loader.conf file that's causing it to die before it gets to the iSCSI line.


I just found this with a quick search (load iscsi on boot): FreeBSD + ISCSI + Openfiler  that appears to state that FreeBSD doesn't automount iSCSI devices on boot.  But you can have it mount at boot using cron:


			
				LaR3 said:
			
		

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



That thread was from November of 2008 though, so something may have changed, but I haven't seen anything online about having iSCSI auto-mount (during my quick Google & forum search).

Sorry.  Maybe someone else has a more definitive answer.


----------



## LoZio (Aug 13, 2009)

desnudopenguino said:
			
		

> Hmmm...  So you're not getting your iSCSI to mount on boot then?  I don't have any experience with iSCSI, but I'll take a shot in the dark since nobody else has.  You could throw verbose_loading="YES" into /boot/loader.conf up at the top to show the module names as they load, maybe you have a syntax error in your loader.conf file that's causing it to die before it gets to the iSCSI line.
> 
> 
> I just found this with a quick search (load iscsi on boot): FreeBSD + ISCSI + Openfiler  that appears to state that FreeBSD doesn't automount iSCSI devices on boot.  But you can have it mount at boot using cron:
> ...



Well, this is (@reboot) the quick and dirty way I would like to avoid, since it it the one I use now.
This is probably due to the fact that FreeBSD does not have an "official" iscsi target/initiator to use. I'll look into upcoming version 8.
Thanks


----------

