# FreeBSD hdd "export" - SAN protocol



## da1 (May 26, 2010)

Hello fellas,

For learning purposes only, I would like to use my FreeBSD box like a SAN box in the way that I would "export" an entire hdd (for instance /dev/da0) and I would "see" it in the other FreeBSD box "as is" and be able to mount it just as a local hdd.

The idea came from work, where we have dedicated SAN environment, and all our AIX machines have SAN disks. I would create a box with a bunch of disks and from there I would like to have, let's say 5 diskless machines, booting off, of the main one with disks.

I know the pc architecture doesn't allow this (PXE comes into mind) but in the end, I would like to have 1 disk from 1 machine "viewable" as "/dev/whatever" on the other machines.

I do not have FSC adapters. I am just curious if this is possible via LAN or something else


----------



## DutchDaemon (May 26, 2010)

Aren't you confusing NAS (exports filesystems) with SAN (exports block devices / disks)?


----------



## da1 (May 26, 2010)

ah ... you are right. I was thinking about SAN but for some reason I wrote NAS ... original post corrected


----------



## phoenix (May 26, 2010)

You are looking for iSCSI.  There are a couple of iSCSI targets available in the ports tree.  These are used to export block devices from one system (the target) to another (the initiator).  FreeBSD includes iSCSI initiator support in the base.


----------



## jalla (May 27, 2010)

Use net/istgt from ports.
You cannot boot directly off an iscsi target though, as your bios doesn't know iscsi.

Instead of dedicating physical disks to initiators I would pool the disks with zfs and create luns as files in an ordinary zfs filesystem (zfs currently doesn't support sharing raw devices over iscsi).


----------



## phoenix (May 28, 2010)

Don't use files on a ZFS filesystem.  Create ZVols (zfs create -V), and export those via iSCSI.


----------



## jalla (May 30, 2010)

Reading the TODO list at http://wiki.freebsd.org/ZFS gave me the impression that sharing zvols over iscsi isn't supported.
If I'm wrong zvols are indeed the way to do it. It gives you the the option of using thin provisioning as well (zfs create -s -V)


----------



## phoenix (May 30, 2010)

It works quite nicely in the testing we've done, with FreeBSD and Linux iSCSI initiators (clients).  It even works well for creating combined ZFS pool, where the block devices for the vdevs are iSCSI targets.


----------



## danbi (Jun 7, 2010)

If not using ZFS, perhaps GEOM Gate will do the job. See ggated() and friends.


----------

