Shadow Copy with ZFS
ed at edplese.com
Fri Feb 9 17:25:34 GMT 2007
On Thu, Feb 08, 2007 at 12:05:01PM +1100, Alison Winters wrote:
> I think this genericizing of the existing module will be really useful.
> Comments below...
> > path:
> > This is the directory that contains all of the snapshots. Defaults to "".
> I presume "" means "." - i.e. snapshots mounted directly under the share
Yes. The intent is no modification of the requested path.
> > Does this seem like it would be a reasonable way to implement this?
> > Would this work with XVM snapshots?
> Yes and no :-) We can mount XVM snapshots anywhere, but the current
> snapshot manager implementation mounts them with a different filename
> that won't match the YYYY.MM.DD-HH.MM.SS format.
> I can anticipate other situations where for policy reasons snapshots are
> mounted with a different naming convention, so i'd propose using
> strptime(), or a cut down version to make the format of the mount point
> fully configurable. I can see two immediate problems with strptime():
> 1. it overloads the existing "%" substitutables in smb.conf,
> 2. it may not be implemented in older UNIXes, meaning we'd probably need
> to add a whole bunch of safe wrapper functions into lib/
> Problem #1 can be overcome by using another character in the smb.conf
> (e.g. "$" instead of "%").
This seems reasonable.
> Problem #2 is a bit more annoying. Perhaps we could write a really
> cut-down version of strptime() for Samba that only handles the six field
> descriptors we're interested in (%Y, %m, %d, %H, %M, %S)? Well, and %%
> of course.
strptime is already used a few times in the Samba source so it may not
be problematic to use.
> Here's the option i see:
> The format of the snapshot directory names. Defaults to
> For the weird format we're using here, the setting would be:
> path = /pool/fs
> vfs objects = shadow_copy
> shadow_copy: path = SNAPSHOTS
> shadow_copy: format = $Y_$m_$d_$H$M$S
> shadow_copy: sort = desc
> We also have junk characters on the end of that format (e.g.
> 2007_02_08_010236_Thu), but those could be thrown away like how sscanf
> does it.
Any extra trailing characters can't just be ignored because the module
also has to be able to convert back from the YYYY.MM.DD-HH.MM.SS
format to the user specified format. strftime() takes care of this,
but in the above example, the format string would have to be
$Y_$m_$d_$H$M$S_$a to include the abbreviated weekday at the end.
Because of the reverse conversion, there are still many cases where
snapshot naming conventions will not work, but it's still much more
flexible than what I originally had.
> I know this is a bit more work than just standardizing on a common mount
> name, but i think it'll add a lot more flexibility that users will
> appreciate at the end of the day.
> What do you think?
I think this method would work very well.
More information about the samba-technical