From owner-freebsd-scsi@FreeBSD.ORG Fri Jun 13 01:14:07 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB5CA1065677 for ; Fri, 13 Jun 2008 01:14:07 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 423088FC1C for ; Fri, 13 Jun 2008 01:14:06 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.13.8/8.13.8) with ESMTP id m5D1DoTu006842; Thu, 12 Jun 2008 19:13:50 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <4851C9CE.8030806@samsco.org> Date: Thu, 12 Jun 2008 19:13:50 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Derek VerLee References: <4851C202.4030204@comcast.net> In-Reply-To: <4851C202.4030204@comcast.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: freebsd-scsi@freebsd.org Subject: Re: target mode X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jun 2008 01:14:07 -0000 Derek VerLee wrote: > > Hello > I'm curious about what is and isn't possible using scsi target mode in > FreeBSD, both in principle and given the current state of the > architecture. In particular I am curious if it is possible to use a > scsi card in target mode, to "export" drives, such as a geom array, to > be accessed by another computer over a physical scsi connect. I believe > this is what iscsi support aims at, however i'm interested in other scsi > interfaces, such as parrellel or perhaps SAS. Searching the archives > and web somewhat, I have seen other people ask this a couple times but > haven't found a definite answer. > > This would be to perhaps re-purpose an older computer, or an inexpensive > one, to act much like an external raid (but perhaps potentially more > flexible). > > Is is possible now? If not, could it be done with some hacking and > coding? How crazy would you have to be to try? > Short answer is yes, it's possible to export logical disks with what is in the tree and a minimal amount of setup and configuration. The target mode support is split into 2 layers. There is the kernel driver that handles the basic parallel scsi wire protocol (i.e. selection, reconnection, etc) in conjunction with the HBA driver, and acts as a conduit for the command protocol. Above that is the userland driver that talks to the kernel target driver and handles the scsi command protocol, i.e. inquiries, read/write, etc. There is a skeletal but fully functional upper layer in /usr/share/examples/scsi_target. It can generate suitable responses to inquiry and TUR commands, and can be pointed at a file to use as the backing store for a virtual disk. I'd suggest reading the man page in there and playing with it; it's simple but it works and is a good demonstration of the possibilities that exist. Not all HBA drivers support target mode, however. For parallel SCSI, the AHC driver is probably the best choice since it was the reference platform for all of the target mode code. Scott