summaryrefslogtreecommitdiffstats
path: root/docs-xml/manpages/vfs_shadow_copy2.8.xml
blob: fe37145d41167ed58a8f6694994b16f3b403aaac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
<refentry id="vfs_shadow_copy2.8">

<refmeta>
	<refentrytitle>vfs_shadow_copy2</refentrytitle>
	<manvolnum>8</manvolnum>
	<refmiscinfo class="source">Samba</refmiscinfo>
	<refmiscinfo class="manual">System Administration tools</refmiscinfo>
	<refmiscinfo class="version">&doc.version;</refmiscinfo>
</refmeta>


<refnamediv>
	<refname>vfs_shadow_copy2</refname>
	<refpurpose>Expose snapshots to Windows clients as shadow copies.
	</refpurpose>
</refnamediv>

<refsynopsisdiv>
	<cmdsynopsis>
		<command>vfs objects = shadow_copy2</command>
	</cmdsynopsis>
</refsynopsisdiv>

<refsect1>
	<title>DESCRIPTION</title>

	<para>This VFS module is part of the
	<citerefentry><refentrytitle>samba</refentrytitle>
	<manvolnum>7</manvolnum></citerefentry> suite.</para>

	<para>
	The <command>vfs_shadow_copy2</command> VFS module offers a
	functionality similar to Microsoft Shadow Copy services.
	When set up properly,
	this module allows Microsoft Shadow Copy clients to browse
	through file system snapshots as "shadow copies" on Samba shares.
	</para>

	<para>
	This is a second implementation of a shadow copy module
	which has the following additional features (compared to the original
	<citerefentry><refentrytitle>shadow_copy</refentrytitle>
	<manvolnum>8</manvolnum></citerefentry> module):
	</para>
	<orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic">
	<listitem><para>
	There is no need any more to populate your share's root directory
	with symlinks to the snapshots if the file system stores the
	snapshots elsewhere.
	Instead, you can flexibly configure the module where to look for
	the file system snapshots.
	This can be very important when you have thousands of
	shares, or use [homes].
	</para></listitem>
	<listitem><para>
	Snapshot directories need not be in one fixed central place but
	can be located anywhere in the directory tree. This mode helps to
	support file systems that offer snapshotting of particular
	subtrees, for example the GPFS independent file sets.
	</para></listitem>
	<listitem><para>
	Vanity naming for snapshots: snapshots can be named in any format
	compatible with str[fp]time conversions.
	</para></listitem>
	<listitem><para>
	Timestamps can be represented in localtime rather than UTC.
	</para></listitem>
	<listitem><para>
	The inode number of the files can optionally be altered to be
	different from the original. This fixes the 'restore' button
	in the Windows GUI to work without a sharing violation when
	serving from file systems, like GPFS, that return the same
	device and inode number for the snapshot file and the original.
	</para></listitem>
	<listitem><para>
	Shadow copy results are by default sorted before being sent to the
	client. This is beneficial for filesystems that don't read
	directories alphabetically (the default unix). Sort ordering can be
	configured and sorting can be turned off completely if the file
	system sorts its directory listing.
	</para></listitem>
	</orderedlist>

	<para>This module is stackable.</para>

</refsect1>

<refsect1>
	<title>CONFIGURATION</title>

	<para><command>vfs_shadow_copy2</command> relies on a filesystem
	snapshot implementation. Many common filesystems have native
	support for this.
	</para>

	<para>Filesystem snapshots must be available under
	specially named directories in order to be recognized by
	<command>vfs_shadow_copy2</command>. These snapshot directory
	is typically a direct subdirectory of the share root's mountpoint
	but there are other modes that can be configured with the
	parameters described in detail below.</para>

	<para>The snapshot at a given point in time is expected in a
	subdirectory of the snapshot directory where the snapshot's
	directory is expected to be a formatted version of the
	snapshot time. The default format which can be changed
	with the <command>shadow:format</command> option
	is @GMT-YYYY.MM.DD-hh.mm.ss, where:
	<itemizedlist>
	<listitem><para><command>YYYY</command> is the 4 digit year</para></listitem>
	<listitem><para><command>MM</command> is the 2 digit month</para></listitem>
	<listitem><para><command>DD</command> is the 2 digit day</para></listitem>
	<listitem><para><command>hh</command> is the 2 digit hour</para></listitem>
	<listitem><para><command>mm</command> is the 2 digit minute</para></listitem>
	<listitem><para><command>ss</command> is the 2 digit second.</para></listitem>
	</itemizedlist>
	</para>

	<para>The <command>vfs_shadow_copy2</command> snapshot naming
	convention can be produced with the following
	<citerefentry><refentrytitle>date</refentrytitle>
	<manvolnum>1</manvolnum></citerefentry> command:
	<programlisting>
	TZ=GMT date +@GMT-%Y.%m.%d-%H.%M.%S
	</programlisting></para>

</refsect1>

<refsect1>
        <title>OPTIONS</title>

        <variablelist>
		<varlistentry>
                <term>shadow:mountpoint = MOUNTPOINT
                </term>
                <listitem>
		<para>
		With this parameter, one can specify the mount point
		of the filesystem that contains the share path.
		Usually this mount point is automatically detected.
		But for some constellations, in particular tests,
		it can be convenient to be able to specify it.
		</para>
		<para>Example: shadow:mountpoint = /path/to/filesystem</para>
		<para>Default: shadow:mountpoint = NOT SPECIFIED</para>
                </listitem>
                </varlistentry>

		<varlistentry>
                <term>shadow:snapdir = SNAPDIR
                </term>
                <listitem>
		<para>
		Path to the directory where the file system of
		the share keeps its snapshots.
		If an absolute path is specified, it is used as-is.
		If a relative path is specified, then it is taken
		relative to the mount point of the filesystem of
		the share root. (See <command>shadow:mountpoint</command>.)
		</para>
		<para>
		Note that <command>shadow:snapdirseverywhere</command>
		depends on this parameter and needs a relative path.
		Setting an absolute path disables
		<command>shadow:snapdirseverywhere</command>.
		</para>
		<para>
		Note that the <command>shadow:crossmountpoints</command>
		option also requires a relative snapdir.
		Setting an absolute path disables
		<command>shadow:crossmountpoints</command>.
		</para>
		<para>Example: shadow:snapdir = /some/absolute/path</para>
		<para>Default: shadow:snapdir = .snapshots</para>
                </listitem>
                </varlistentry>

                <varlistentry>
                <term>shadow:basedir = BASEDIR
		</term>
                <listitem>
		<para>
		The basedir option allows one to specify a directory
		between the share's mount point and the share root,
		relative to which the file system's snapshots are taken.
		</para>
		<para>
		For example, if
		<itemizedlist>
		<listitem><para>
		<command>basedir = mountpoint/rel_basedir</command>
		</para></listitem>
		<listitem><para>
		<command>share_root = basedir/rel_share_root</command>
		</para></listitem>
		<listitem><para>
		<command>snapshot_path = mountpoint/snapdir</command>
		</para>
		<para>
		or
		<command>snapshot_path = snapdir</command>
		if snapdir is absolute
		</para></listitem>
		</itemizedlist>
		then the snapshot of a
		<command>file = mountpoint/rel_basedir/rel_share_root/rel_file</command>
		at a time TIME will be found under
		<command>snapshot_path/FS_GMT_TOKEN(TIME)/rel_share_root/rel_file</command>,
		where FS_GMT_TOKEN(TIME) is the timestamp string belonging
		to TIME in the format required by the file system.
		(See <command>shadow:format</command>.)
		</para>
		<para>The default for the basedir is the mount point
		of the file system of the share root
		(see <command>shadow:mountpoint</command>).
		</para>
		<para>
		Note that the <command>shadow:snapdirseverywhere</command>
		and  <command>shadow:crossmountpoints</command>
		options are incompatible with <command>shadow:basedir</command>
		and disable the basedir setting.
		</para>
                </listitem>
                </varlistentry>

		<varlistentry>
		<term>shadow:snapsharepath = SNAPSHAREPATH
		</term>
		<listitem>
		<para>
		With this parameter, one can specify the path of the share's
		root directory in snapshots, relative to the snapshot's
		root directory. It is an alternative method to
		<command>shadow:basedir</command>, allowing greater control.
		</para>
		<para>
		For example, if within each
		snapshot the files of the share have a
		<command>path/to/share/</command> prefix, then
		<command>shadow:snapsharepath</command> can be
		set to <command>path/to/share</command>.
		</para>
		<para>
		With this parameter, it is no longer assumed that a
		snapshot represents an image of the original file system or
		a portion of it. For example, a system could perform
		backups of only files contained in shares, and then
		expose the backup files in a logical structure:
		</para>
		<itemizedlist>
		<listitem><para>share1/</para></listitem>
		<listitem><para>share2/</para></listitem>
		<listitem><para>.../</para></listitem>
		</itemizedlist>
		<para>
		Note that the <command>shadow:snapdirseverywhere</command>
		and the <command>shadow:basedir</command> options
		are incompatible with <command>shadow:snapsharepath</command>
		and disable <command>shadow:snapsharepath</command> setting.
		</para>
		<para>Example: shadow:snapsharepath = path/to/share</para>
		<para>Default: shadow:snapsharepath = NOT SPECIFIED</para>
                </listitem>
		</varlistentry>

		<varlistentry>
                <term>shadow:sort = asc/desc
                </term>
                <listitem>
		<para>By default, this module sorts the shadow copy data
		alphabetically before sending it to the client.
		With this parameter, one can specify the sort order.
		Possible known values are desc (descending, the default)
		and asc (ascending). If the file system lists directories
		alphabetically sorted, one can turn off sorting in this
		module by specifying any other value.
		</para>
		<para>Example: shadow:sort = asc</para>
		<para>Example: shadow:sort = none</para>
		<para>Default: shadow:sort = desc</para>
                </listitem>
                </varlistentry>

		<varlistentry>
                <term>shadow:localtime = yes/no
                </term>
                <listitem>
                <para>This is an optional parameter that indicates whether the
		snapshot names are in UTC/GMT or in local time. If it is
		disabled then UTC/GMT is expected.
                </para>
		<para>shadow:localtime = no</para>
                </listitem>
                </varlistentry>

		<varlistentry>
                <term>shadow:format = format specification for snapshot names
                </term>
                <listitem>
                <para>This is an optional parameter that specifies the format
		specification for the naming of snapshots in the file system.
		The format must be compatible with the conversion
		specifications recognized by str[fp]time.
                </para>
		<para>Default: shadow:format = "@GMT-%Y.%m.%d-%H.%M.%S"</para>
                </listitem>
                </varlistentry>

		<varlistentry>
		<term>shadow:sscanf = yes/no</term>
		<listitem>
		<para>
		This parameter can be used to specify that the time in
		format string is given as an unsigned long integer (%lu)
		rather than a time strptime() can parse.
		The result must be a unix time_t time.
		</para>
		<para>Default: shadow:sscanf = no</para>
		</listitem>
		</varlistentry>

		<varlistentry>
                <term>shadow:fixinodes = yes/no
                </term>
                <listitem>
                <para>If you enable <command moreinfo="none">shadow:fixinodes
		</command> then this module will modify the apparent inode
		number of files in the snapshot directories using a hash of the
		files path. This is needed for snapshot systems where the
		snapshots have the same device:inode number as the original
		files (such as happens with GPFS snapshots). If you don't set
		this option then the 'restore' button in the shadow copy UI
		will fail with a sharing violation.
                </para>
		<para>Default: shadow:fixinodes = no</para>
                </listitem>
                </varlistentry>

		<varlistentry>
		<term>shadow:snapdirseverywhere = yes/no
		</term>
		<listitem>
		<para>
		If you enable
		<command moreinfo="none">shadow:snapdirseverywhere </command>
		then this module will look
		out for snapshot directories in the current working directory
		and all parent directories, stopping at the mount point
		by default.
		But see <command>shadow:crossmountpoints</command> how to change
		that behaviour.
		</para>
		<para>
		An example where this is needed are independent filesets in
		IBM's GPFS, but other filesystems might support snapshotting
		only particular subtrees of the filesystem as well.
		</para>
		<para>
		Note that <command>shadow:snapdirseverywhere</command>
		depends on <command>shadow:snapdir</command> and needs it to be
		a relative path. Setting an absolute snapdir path disables
		<command>shadow:snapdirseverywhere</command>.
		</para>
		<para>
		Note that this option is incompatible with the
		<command>shadow:basedir</command> option and removes the
		<command>shadow:basedir</command> setting by itself.
		</para>
		<para>Example: shadow:snapdirseverywhere = yes</para>
		<para>Default: shadow:snapdirseverywhere = no</para>
		</listitem>
		</varlistentry>

		<varlistentry>
                <term>shadow:crossmountpoints = yes/no
                </term>
                <listitem>
		<para>
		This option is effective in the case of
		<command>shadow:snapdirseverywhere = yes</command>.
		Setting this option makes the module not stop at the
		first mount point encountered when looking for snapdirs,
		but lets it search potentially all through the path
		instead.
                </para>
		<para>
		An example where this is needed are independent filesets in
		IBM's GPFS, but other filesystems might support snapshotting
		only particular subtrees of the filesystem as well.
		</para>
		<para>
		Note that <command>shadow:crossmountpoints</command>
		depends on <command>shadow:snapdir</command> and needs it to be
		a relative path. Setting an absolute snapdir path disables
		<command>shadow:crossmountpoints</command>.
		</para>
		<para>
		Note that this option is incompatible with the
		<command>shadow:basedir</command> option and removes the
		<command>shadow:basedir</command> setting by itself.
		</para>
		<para>Example: shadow:crossmountpoints = yes</para>
		<para>Default: shadow:crossmountpoints = no</para>
                </listitem>
                </varlistentry>

		<varlistentry>
		<term>shadow:snapprefix
		</term>
		<listitem>
		<para>
		With growing number of snapshots file-systems need some mechanism
		to differentiate one set of snapshots from other, e.g. monthly, weekly,
		manual, special events, etc. Therefore these file-systems provide different
		ways to tag snapshots, e.g. provide a configurable way to name snapshots,
		which is not just based on time.  With only <command>shadow:format</command>
		it is very difficult to filter these snapshots. With this optional parameter,
		one can specify a variable prefix component for names of the snapshot
		directories in the file-system. If this parameter is set, together with the
		<command>shadow:format</command> and <command>shadow:delimiter</command>
		parameters it determines the possible names of snapshot
		directories in the file-system. The option only supports Basic
		Regular Expression (BRE).
		</para>
		</listitem>
		</varlistentry>

		<varlistentry>
		<term>shadow:delimiter
		</term>
		<listitem>
		<para>
		This optional parameter is used as a delimiter between
		<command>shadow:snapprefix</command> and <command>shadow:format</command>.
		This parameter is used only when <command>shadow:snapprefix</command>
		is set.
		</para>
		<para>Default: shadow:delimiter = "_GMT"</para>
		</listitem>
		</varlistentry>
	</variablelist>
</refsect1>

<refsect1>
	<title>EXAMPLES</title>

	<para>Add shadow copy support to user home directories:</para>
<programlisting>
        <smbconfsection name="[homes]"/>
	<smbconfoption name="vfs objects">shadow_copy2</smbconfoption>
	<smbconfoption name="shadow:snapdir">/data/snapshots</smbconfoption>
	<smbconfoption name="shadow:basedir">/data/home</smbconfoption>
	<smbconfoption name="shadow:sort">desc</smbconfoption>
</programlisting>

</refsect1>

<refsect1>
	<title>CAVEATS</title>

	<para>This is not a backup, archival, or version control solution.
	</para>

	<para>With Samba or Windows servers,
	<command>vfs_shadow_copy2</command> is designed to be an end-user
	tool only. It does not replace or enhance your backup and
	archival solutions and should in no way be considered as
	such. Additionally, if you need version control, implement a
	version control system.</para>

</refsect1>



<refsect1>
	<title>VERSION</title>

	<para>This man page is part of version &doc.version; of the Samba suite.
	</para>
</refsect1>

<refsect1>
	<title>AUTHOR</title>

	<para>The original Samba software and related utilities
	were created by Andrew Tridgell. Samba is now developed
	by the Samba Team as an Open Source project similar
	to the way the Linux kernel is developed.</para>

</refsect1>

</refentry>