1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="vfs_shadow_copy2.8">
6 <refentrytitle>vfs_shadow_copy2</refentrytitle>
7 <manvolnum>8</manvolnum>
8 <refmiscinfo class="source">Samba</refmiscinfo>
9 <refmiscinfo class="manual">System Administration tools</refmiscinfo>
10 <refmiscinfo class="version">&doc.version;</refmiscinfo>
15 <refname>vfs_shadow_copy2</refname>
16 <refpurpose>Expose snapshots to Windows clients as shadow copies.
22 <command>vfs objects = shadow_copy2</command>
27 <title>DESCRIPTION</title>
29 <para>This VFS module is part of the
30 <citerefentry><refentrytitle>samba</refentrytitle>
31 <manvolnum>7</manvolnum></citerefentry> suite.</para>
34 The <command>vfs_shadow_copy2</command> VFS module offers a
35 functionality similar to Microsoft Shadow Copy services.
37 this module allows Microsoft Shadow Copy clients to browse
38 through file system snapshots as "shadow copies" on Samba shares.
42 This is a second implementation of a shadow copy module
43 which has the following additional features (compared to the original
44 <citerefentry><refentrytitle>shadow_copy</refentrytitle>
45 <manvolnum>8</manvolnum></citerefentry> module):
47 <orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic">
49 There is no need any more to populate your share's root directory
50 with symlinks to the snapshots if the file system stores the
52 Instead, you can flexibly configure the module where to look for
53 the file system snapshots.
54 This can be very important when you have thousands of
55 shares, or use [homes].
58 Snapshot directories need not be in one fixed central place but
59 can be located anywhere in the directory tree. This mode helps to
60 support file systems that offer snapshotting of particular
61 subtrees, for example the GPFS independent file sets.
64 Vanity naming for snapshots: snapshots can be named in any format
65 compatible with str[fp]time conversions.
68 Timestamps can be represented in localtime rather than UTC.
71 The inode number of the files can optionally be altered to be
72 different from the original. This fixes the 'restore' button
73 in the Windows GUI to work without a sharing violation when
74 serving from file systems, like GPFS, that return the same
75 device and inode number for the snapshot file and the original.
78 Shadow copy results are by default sorted before being sent to the
79 client. This is beneficial for filesystems that don't read
80 directories alphabetically (the default unix). Sort ordering can be
81 configured and sorting can be turned off completely if the file
82 system sorts its directory listing.
86 <para>This module is stackable.</para>
91 <title>CONFIGURATION</title>
93 <para><command>vfs_shadow_copy2</command> relies on a filesystem
94 snapshot implementation. Many common filesystems have native
98 <para>Filesystem snapshots must be available under
99 specially named directories in order to be recognized by
100 <command>vfs_shadow_copy2</command>. These snapshot directory
101 is typically a direct subdirectory of the share root's mountpoint
102 but there are other modes that can be configured with the
103 parameters described in detail below.</para>
105 <para>The snapshot at a given point in time is expected in a
106 subdirectory of the snapshot directory where the snapshot's
107 directory is expected to be a formatted version of the
108 snapshot time. The default format which can be changed
109 with the <command>shadow:format</command> option
110 is @GMT-YYYY.MM.DD-hh.mm.ss, where:
112 <listitem><para><command>YYYY</command> is the 4 digit year</para></listitem>
113 <listitem><para><command>MM</command> is the 2 digit month</para></listitem>
114 <listitem><para><command>DD</command> is the 2 digit day</para></listitem>
115 <listitem><para><command>hh</command> is the 2 digit hour</para></listitem>
116 <listitem><para><command>mm</command> is the 2 digit minute</para></listitem>
117 <listitem><para><command>ss</command> is the 2 digit second.</para></listitem>
121 <para>The <command>vfs_shadow_copy2</command> snapshot naming
122 convention can be produced with the following
123 <citerefentry><refentrytitle>date</refentrytitle>
124 <manvolnum>1</manvolnum></citerefentry> command:
126 TZ=GMT date +@GMT-%Y.%m.%d-%H.%M.%S
127 </programlisting></para>
132 <title>OPTIONS</title>
136 <term>shadow:mountpoint = MOUNTPOINT
140 With this parameter, one can specify the mount point
141 of the filesystem that contains the share path.
142 Usually this mount point is automatically detected.
143 But for some constellations, in particular tests,
144 it can be convenient to be able to specify it.
146 <para>Example: shadow:mountpoint = /path/to/filesystem</para>
147 <para>Default: shadow:mountpoint = NOT SPECIFIED</para>
152 <term>shadow:snapdir = SNAPDIR
156 Path to the directory where the file system of
157 the share keeps its snapshots.
158 If an absolute path is specified, it is used as-is.
159 If a relative path is specified, then it is taken
160 relative to the mount point of the filesystem of
161 the share root. (See <command>shadow:mountpoint</command>.)
164 Note that <command>shadow:snapdirseverywhere</command>
165 depends on this parameter and needs a relative path.
166 Setting an absolute path disables
167 <command>shadow:snapdirseverywhere</command>.
170 Note that the <command>shadow:crossmountpoints</command>
171 option also requires a relative snapdir.
172 Setting an absolute path disables
173 <command>shadow:crossmountpoints</command>.
175 <para>Example: shadow:snapdir = /some/absolute/path</para>
176 <para>Default: shadow:snapdir = .snapshots</para>
181 <term>shadow:basedir = BASEDIR
185 The basedir option allows one to specify a directory
186 between the share's mount point and the share root,
187 relative to which the file system's snapshots are taken.
193 <command>basedir = mountpoint/rel_basedir</command>
196 <command>share_root = basedir/rel_share_root</command>
199 <command>snapshot_path = mountpoint/snapdir</command>
203 <command>snapshot_path = snapdir</command>
204 if snapdir is absolute
207 then the snapshot of a
208 <command>file = mountpoint/rel_basedir/rel_share_root/rel_file</command>
209 at a time TIME will be found under
210 <command>snapshot_path/FS_GMT_TOKEN(TIME)/rel_share_root/rel_file</command>,
211 where FS_GMT_TOKEN(TIME) is the timestamp string belonging
212 to TIME in the format required by the file system.
213 (See <command>shadow:format</command>.)
215 <para>The default for the basedir is the mount point
216 of the file system of the share root
217 (see <command>shadow:mountpoint</command>).
220 Note that the <command>shadow:snapdirseverywhere</command>
221 and <command>shadow:crossmountpoints</command>
222 options are incompatible with <command>shadow:basedir</command>
223 and disable the basedir setting.
229 <term>shadow:snapsharepath = SNAPSHAREPATH
233 With this parameter, one can specify the path of the share's
234 root directory in snapshots, relative to the snapshot's
235 root directory. It is an alternative method to
236 <command>shadow:basedir</command>, allowing greater control.
239 For example, if within each
240 snapshot the files of the share have a
241 <command>path/to/share/</command> prefix, then
242 <command>shadow:snapsharepath</command> can be
243 set to <command>path/to/share</command>.
246 With this parameter, it is no longer assumed that a
247 snapshot represents an image of the original file system or
248 a portion of it. For example, a system could perform
249 backups of only files contained in shares, and then
250 expose the backup files in a logical structure:
253 <listitem><para>share1/</para></listitem>
254 <listitem><para>share2/</para></listitem>
255 <listitem><para>.../</para></listitem>
258 Note that the <command>shadow:snapdirseverywhere</command>
259 and the <command>shadow:basedir</command> options
260 are incompatible with <command>shadow:snapsharepath</command>
261 and disable <command>shadow:snapsharepath</command> setting.
263 <para>Example: shadow:snapsharepath = path/to/share</para>
264 <para>Default: shadow:snapsharepath = NOT SPECIFIED</para>
269 <term>shadow:sort = asc/desc
272 <para>By default, this module sorts the shadow copy data
273 alphabetically before sending it to the client.
274 With this parameter, one can specify the sort order.
275 Possible known values are desc (descending, the default)
276 and asc (ascending). If the file system lists directories
277 alphabetically sorted, one can turn off sorting in this
278 module by specifying any other value.
280 <para>Example: shadow:sort = asc</para>
281 <para>Example: shadow:sort = none</para>
282 <para>Default: shadow:sort = desc</para>
287 <term>shadow:localtime = yes/no
290 <para>This is an optional parameter that indicates whether the
291 snapshot names are in UTC/GMT or in local time. If it is
292 disabled then UTC/GMT is expected.
294 <para>shadow:localtime = no</para>
299 <term>shadow:format = format specification for snapshot names
302 <para>This is an optional parameter that specifies the format
303 specification for the naming of snapshots in the file system.
304 The format must be compatible with the conversion
305 specifications recognized by str[fp]time.
307 <para>Default: shadow:format = "@GMT-%Y.%m.%d-%H.%M.%S"</para>
312 <term>shadow:sscanf = yes/no</term>
315 This parameter can be used to specify that the time in
316 format string is given as an unsigned long integer (%lu)
317 rather than a time strptime() can parse.
318 The result must be a unix time_t time.
320 <para>Default: shadow:sscanf = no</para>
325 <term>shadow:fixinodes = yes/no
328 <para>If you enable <command moreinfo="none">shadow:fixinodes
329 </command> then this module will modify the apparent inode
330 number of files in the snapshot directories using a hash of the
331 files path. This is needed for snapshot systems where the
332 snapshots have the same device:inode number as the original
333 files (such as happens with GPFS snapshots). If you don't set
334 this option then the 'restore' button in the shadow copy UI
335 will fail with a sharing violation.
337 <para>Default: shadow:fixinodes = no</para>
342 <term>shadow:snapdirseverywhere = yes/no
347 <command moreinfo="none">shadow:snapdirseverywhere </command>
348 then this module will look
349 out for snapshot directories in the current working directory
350 and all parent directories, stopping at the mount point
352 But see <command>shadow:crossmountpoints</command> how to change
356 An example where this is needed are independent filesets in
357 IBM's GPFS, but other filesystems might support snapshotting
358 only particular subtrees of the filesystem as well.
361 Note that <command>shadow:snapdirseverywhere</command>
362 depends on <command>shadow:snapdir</command> and needs it to be
363 a relative path. Setting an absolute snapdir path disables
364 <command>shadow:snapdirseverywhere</command>.
367 Note that this option is incompatible with the
368 <command>shadow:basedir</command> option and removes the
369 <command>shadow:basedir</command> setting by itself.
371 <para>Example: shadow:snapdirseverywhere = yes</para>
372 <para>Default: shadow:snapdirseverywhere = no</para>
377 <term>shadow:crossmountpoints = yes/no
381 This option is effective in the case of
382 <command>shadow:snapdirseverywhere = yes</command>.
383 Setting this option makes the module not stop at the
384 first mount point encountered when looking for snapdirs,
385 but lets it search potentially all through the path
389 An example where this is needed are independent filesets in
390 IBM's GPFS, but other filesystems might support snapshotting
391 only particular subtrees of the filesystem as well.
394 Note that <command>shadow:crossmountpoints</command>
395 depends on <command>shadow:snapdir</command> and needs it to be
396 a relative path. Setting an absolute snapdir path disables
397 <command>shadow:crossmountpoints</command>.
400 Note that this option is incompatible with the
401 <command>shadow:basedir</command> option and removes the
402 <command>shadow:basedir</command> setting by itself.
404 <para>Example: shadow:crossmountpoints = yes</para>
405 <para>Default: shadow:crossmountpoints = no</para>
410 <term>shadow:snapprefix
414 With growing number of snapshots file-systems need some mechanism
415 to differentiate one set of snapshots from other, e.g. monthly, weekly,
416 manual, special events, etc. Therefore these file-systems provide different
417 ways to tag snapshots, e.g. provide a configurable way to name snapshots,
418 which is not just based on time. With only <command>shadow:format</command>
419 it is very difficult to filter these snapshots. With this optional parameter,
420 one can specify a variable prefix component for names of the snapshot
421 directories in the file-system. If this parameter is set, together with the
422 <command>shadow:format</command> and <command>shadow:delimiter</command>
423 parameters it determines the possible names of snapshot
424 directories in the file-system. The option only supports Basic
425 Regular Expression (BRE).
431 <term>shadow:delimiter
435 This optional parameter is used as a delimiter between
436 <command>shadow:snapprefix</command> and <command>shadow:format</command>.
437 This parameter is used only when <command>shadow:snapprefix</command>
440 <para>Default: shadow:delimiter = "_GMT"</para>
447 <title>EXAMPLES</title>
449 <para>Add shadow copy support to user home directories:</para>
451 <smbconfsection name="[homes]"/>
452 <smbconfoption name="vfs objects">shadow_copy2</smbconfoption>
453 <smbconfoption name="shadow:snapdir">/data/snapshots</smbconfoption>
454 <smbconfoption name="shadow:basedir">/data/home</smbconfoption>
455 <smbconfoption name="shadow:sort">desc</smbconfoption>
461 <title>CAVEATS</title>
463 <para>This is not a backup, archival, or version control solution.
466 <para>With Samba or Windows servers,
467 <command>vfs_shadow_copy2</command> is designed to be an end-user
468 tool only. It does not replace or enhance your backup and
469 archival solutions and should in no way be considered as
470 such. Additionally, if you need version control, implement a
471 version control system.</para>
478 <title>VERSION</title>
480 <para>This man page is part of version &doc.version; of the Samba suite.
485 <title>AUTHOR</title>
487 <para>The original Samba software and related utilities
488 were created by Andrew Tridgell. Samba is now developed
489 by the Samba Team as an Open Source project similar
490 to the way the Linux kernel is developed.</para>