Shadow Copy with ZFS

Alison Winters alisonw at sgi.com
Thu Feb 8 01:05:01 GMT 2007


Hi Ed,

I think this genericizing of the existing module will be really useful.
 Comments below...

Ed Plese wrote:
> Below is a set of additional options to shadow_copy that I think would
> work for most cases.  It requires the snapshot names to be of the form
> "prefixYYYY.MM.DD-HH.MM.SS".  The prefix is customizable and optional
> but the timestamp format is fixed and must be at the end of the name.
> The defaults for these options would make the module function exactly
> like the current implementation.
> 
> path:
>   This is the directory that contains all of the snapshots.  Defaults to "".
> 
I presume "" means "." - i.e. snapshots mounted directly under the share
root?

> subpath:
>   This is the relative path under the snapshot directory to the files.
>   Defaults to "".
> 
This is cool, being able to use variable substitutions is nice.

> sort:
>   This is used to specify how (asc or desc, if at all) the shadow copies
>   should be sorted.  This is useful for filesystems for which readdir
>   doesn't return the files in order.
> 
Cool.

> 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 "%").

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.

Here's the option i see:

format:
  The format of the snapshot directory names.  Defaults to
  "@GMT-$Y.$m.$d-$H.$M.$S".

For the weird format we're using here, the setting would be:

[share]
  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.

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?

Alison


More information about the samba-technical mailing list