can zfs snapshot be used to back LUN in ctl.conf ?

Johan Hendriks joh.hendriks at gmail.com
Sun Sep 6 15:55:00 UTC 2015



Op 06/09/15 om 16:35 schreef Willem Jan Withagen:
> On 27-8-2015 14:00, Zeus Panchenko wrote:
>> greetings,
>>
>> please help me to understand where to look at ...
>>
>> recently I switched from istgt to ctld and now wonder, whether can zfs
>> snapshot be used to back the LUN for ctld?
>>
>> istgt do allows that, while ctld fails to start and complains
>>
>> but if I copy the file from zfs snapshot to some place, then ctld starts
>> as expected ...
> As far as I know those snapshots are read-only.
>
> So other that mount and use for reading backup stuff it does not really
> serve a purpose? And than still you'd next a "consistent" fs on the
> volume to do any useful work. So that would only work for filesystems
> that need a recover that does not involve writing to the volume.
> Otherwise if you force mount something like UFS, you run the risk of
> crashes?
>
> So unless you promote a the volume to writable things will not work.
> For files as backing volume that happens if you copy it to a writeable
> location, or clone the volume the file is on. If you are using ZVOL,
> than you have to clone snapshot.
>
> So I'm not sure if ctld aborts because it tests writing the backing
> storage and fails if it cannot.
>
> --WjW

I just noticed something beeing mentioned on freshbsd.org.

mav <http://freshbsd.org/search?committer=mav&project=freebsd> @ HEAD
<http://freshbsd.org/search?branch=HEAD&project=freebsd> - r287499
<http://freshbsd.org/commit/freebsd/r287499> - 2015
<http://freshbsd.org/2015>-09 <http://freshbsd.org/2015/09>-06
<http://freshbsd.org/2015/09/06> 09
<http://freshbsd.org/2015/09/06/09>:54
<http://freshbsd.org/2015/09/06/09/54>:56
<http://freshbsd.org/2015/09/06/09/54/56>

Move setting of media parameters inside open routines.

This is preparation for possibility to open/close media several times
per LUN life cycle.  While there, rename variables to reduce confusion.
As additional bonus this allows to open read-only media, such as ZFS
snapshots.

So I think in HEAD it should be possible from now on after revision 287499

gr
Johan


>>
>> bellow the details are:
>>
>> ---[ ctld debug quotation start ]-------------------------------------------
>> ...
>> ctld: adding lun 0, target iqn.2007-09.jp.ne.peach.istgt:file011
>> ctld: adding lun 0, target iqn.2007-09.jp.ne.peach.istgt:file012
>> ctld: error returned from LUN creation request: ctl_be_block_open: error opening /storage/win/.zfs/snapshot/daily-2015-08-22/file013
>> ctld: failed to add lun 0, target iqn.2007-09.jp.ne.peach.istgt:file013
>> ctld: adding lun 0, target iqn.2007-09.jp.ne.peach.istgt:file014
>> ctld: adding lun 0, target iqn.2007-09.jp.ne.peach.istgt:file015
>> ...
>> ctld: adding lun 0, target iqn.2007-09.jp.ne.peach.istgt:file052
>> ctld: adding lun 0, target iqn.2007-09.jp.ne.peach.istgt:file053
>> ctld: not listening on portal-group "default", not assigned to any target
>> ctld: listening on 10.100.21.47, portal-group "alfa"
>> ctld: listening on 10.100.21.47, portal-group "beta"
>> ctld: failed to apply configuration; exiting
>> /etc/rc.d/ctld: WARNING: failed to start ctld
>> ---[ ctld debug quotation end   ]-------------------------------------------
>>
>> ---[ ctl.conf quotation start ]-------------------------------------------
>> target iqn.2007-09.jp.ne.peach.istgt:file013 {
>>     alias "file013-users"
>>     portal-group alfa
>>     auth-group ag-file013
>>     lun 0 {
>>             path /storage/win/.zfs/snapshot/daily-2015-08-22/file013
>>             size 300G
>>     }
>> }
>> ---[ ctl.conf quotation end   ]-------------------------------------------
>>
>> the very file exists:
>>> stat /storagez/win/.zfs/snapshot/daily-2015-08-22/traders.ts.ibs
>> 3500296891 22 -rw-r--r-- 1 root wheel 4294967295 214748364800 "Oct 23 07:41:38 2013" "Aug 21 04:00:28 2015" "Aug 21 04:00:28 2015" "Oct 23 07:41:38 2013" 131072 419838466 0x800 /storage/win/.zfs/snapshot/daily-2015-08-22/file013
>>
>>
>> another question: can ctld be configured to ignore unavailable config
>> parts? like unaccessible/missconfigured LUNs
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"



More information about the freebsd-fs mailing list