btrfs subvolume as an iSCSI target?

Rick Stevens ricks at alldigital.com
Thu Mar 13 00:18:04 UTC 2014


On 03/12/2014 04:23 PM, Dan Mossor issued this missive:
> I've been combing the web for a couple days, and most hits I'm finding
> regarding using a btrfs subvolume as an iSCSI target are posts from the
> 2009/2010 timeframe stating that that functionality is broken.
>
> I'm working on a couple projects here, and one of those involves the
> research into iSCSI targets and initiators, and the testing thereof. I
> have an F20 system with a 1.3TB btrfs master subvolume (across three
> dissimilar devices), and want to create a subvolume within that to serve
> as an iSCSI target.
>
> The traditional methods, specifically those mentioned in the Fedora Wiki
> and the tgtadm man pages, place the emphasis on using devices (/dev/sdx)
> or files (dd if=/dev/zero of=/array/target1 bs=1k count=1). I realize
> that using the file is probably the easiest thing to do in this
> instance, but that's not the point of my project - I am intentionally
> trying to designate the btrfs subvolume as the target.
>
> The issue I believe that is going to stop me is that tgtadm expects a
> block device as the target, and btrfs does not provide that. Is there a
> workaround, other than using a file in the subvolume as the target? Is
> there work in progress to enable this feature, either in the
> scsi-target-utils package or within the btrfs framework?

iSCSI stands for "internet SCSI", a way to share raw devices over normal
network mechanisms rather than having to have a storage farm (e.g.
fiberchannel switches or SAS concentrators and a ton of cables). As far
as I know, the functionality you want will never be available. iSCSI
is intended to share raw devices, not subdirectories (that's what things
like NFS and CIFS are for).

By creating a file (on any filesystem) and using that as the iSCSI
target, you're using that file as a raw device and the iSCSI consumer
can format it to whatever they want (or use the existing filesystem
if it knows what it is).
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-       Blessed are the peacekeepers...for they shall be shot at     -
-                 from both sides. --A.M. Greeley                    -
----------------------------------------------------------------------


More information about the users mailing list