Initial import
[samba] / docs / htmldocs / Samba3-HOWTO / VFS.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 22. Stackable VFS modules</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="prev" href="CUPS-printing.html" title="Chapter 21. CUPS Printing Support"><link rel="next" href="winbind.html" title="Chapter 23. Winbind: Use of Domain Accounts"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 22. Stackable VFS modules</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="CUPS-printing.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="winbind.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="VFS"></a>Chapter 22. Stackable VFS modules</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Tim</span> <span class="surname">Potter</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:tpot@samba.org">tpot@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Simo</span> <span class="surname">Sorce</span></h3><span class="contrib">original vfs_skel README</span></div></div><div><div class="author"><h3 class="author"><span class="firstname">Alexander</span> <span class="surname">Bokovoy</span></h3><span class="contrib">original vfs_netatalk docs</span></div></div><div><div class="author"><h3 class="author"><span class="firstname">Stefan</span> <span class="surname">Metzmacher</span></h3><span class="contrib">Update for multiple modules</span></div></div><div><div class="author"><h3 class="author"><span class="firstname">Ed</span> <span class="surname">Riddle</span></h3><span class="contrib">original shadow_copy docs</span></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="VFS.html#id2617428">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="VFS.html#id2617466">Discussion</a></span></dt><dt><span class="sect1"><a href="VFS.html#id2617867">Included Modules</a></span></dt><dd><dl><dt><span class="sect2"><a href="VFS.html#id2617873">audit</a></span></dt><dt><span class="sect2"><a href="VFS.html#id2617914">default_quota</a></span></dt><dt><span class="sect2"><a href="VFS.html#id2618131">extd_audit</a></span></dt><dt><span class="sect2"><a href="VFS.html#fakeperms">fake_perms</a></span></dt><dt><span class="sect2"><a href="VFS.html#id2618444">recycle</a></span></dt><dt><span class="sect2"><a href="VFS.html#id2618758">netatalk</a></span></dt><dt><span class="sect2"><a href="VFS.html#id2618808">shadow_copy</a></span></dt></dl></dd><dt><span class="sect1"><a href="VFS.html#id2619720">VFS Modules Available Elsewhere</a></span></dt><dd><dl><dt><span class="sect2"><a href="VFS.html#id2619746">DatabaseFS</a></span></dt><dt><span class="sect2"><a href="VFS.html#id2619805">vscan</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2617428"></a>Features and Benefits</h2></div></div></div><p>
2 <a class="indexterm" name="id2617436"></a>
3 <a class="indexterm" name="id2617445"></a>
4 <a class="indexterm" name="id2617452"></a>
5 Stackable VFS (Virtual File System) modules support was new to Samba-3 and has proven quite popular. Samba
6 passes each request to access the UNIX file system through the loaded VFS modules. This chapter covers the
7 modules that come with the Samba source and provides references to some external modules.
8 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2617466"></a>Discussion</h2></div></div></div><p>
9 <a class="indexterm" name="id2617474"></a>
10 <a class="indexterm" name="id2617480"></a>
11 If not supplied with your platform distribution binary Samba package, you may have problems compiling these
12 modules, as shared libraries are compiled and linked in different ways on different systems. They currently
13 have been tested against GNU/Linux and IRIX.
14 </p><p>
15 <a class="indexterm" name="id2617495"></a>
16 <a class="indexterm" name="id2617502"></a>
17 <a class="indexterm" name="id2617509"></a>
18 To use the VFS modules, create a share similar to the one below. The important parameter is the <a class="indexterm" name="id2617517"></a>vfs objects parameter where you can list one or more VFS modules by name. For example, to log all
19 access to files and put deleted files in a recycle bin, see <a href="VFS.html#vfsrecyc" title="Example 22.1. smb.conf with VFS modules">the smb.conf with VFS
20 modules example</a>:
21 </p><div class="example"><a name="vfsrecyc"></a><p class="title"><b>Example 22.1. smb.conf with VFS modules</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[audit]</code></em></td></tr><tr><td><a class="indexterm" name="id2617559"></a><em class="parameter"><code>comment = Audited /data directory</code></em></td></tr><tr><td><a class="indexterm" name="id2617572"></a><em class="parameter"><code>path = /data</code></em></td></tr><tr><td><a class="indexterm" name="id2617585"></a><em class="parameter"><code>vfs objects = audit recycle</code></em></td></tr><tr><td><a class="indexterm" name="id2617598"></a><em class="parameter"><code>writeable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2617610"></a><em class="parameter"><code>browseable = yes</code></em></td></tr></table></div><p>
22 <a class="indexterm" name="id2617626"></a>
23 <a class="indexterm" name="id2617633"></a>
24 <a class="indexterm" name="id2617640"></a>
25 The modules are used in the order in which they are specified.  Let's say that you want to both have a virus
26 scanner module and a recycle bin module. It is wise to put the virus scanner module as the first one so that
27 it is the first to get run and may detect a virus immediately, before any action is performed on that file.
28 <a class="indexterm" name="id2617652"></a>vfs objects = vscan-clamav recycle
29 </p><p>
30 <a class="indexterm" name="id2617663"></a>
31 <a class="indexterm" name="id2617670"></a>
32 Samba will attempt to load modules from the <code class="filename">/lib</code> directory in the root directory of the
33 Samba installation (usually <code class="filename">/usr/lib/samba/vfs</code> or
34 <code class="filename">/usr/local/samba/lib/vfs</code>).
35 </p><p>
36 <a class="indexterm" name="id2617700"></a>
37 <a class="indexterm" name="id2617707"></a>
38 <a class="indexterm" name="id2617714"></a>
39 <a class="indexterm" name="id2617721"></a>
40 Some modules can be used twice for the same share.  This can be done using a configuration similar to the one
41 shown in <a href="VFS.html#multimodule" title="Example 22.2. smb.conf with multiple VFS modules">the smb.conf with multiple VFS modules</a>.
42
43 </p><div class="example"><a name="multimodule"></a><p class="title"><b>Example 22.2. smb.conf with multiple VFS modules</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[test]</code></em></td></tr><tr><td><a class="indexterm" name="id2617761"></a><em class="parameter"><code>comment = VFS TEST</code></em></td></tr><tr><td><a class="indexterm" name="id2617774"></a><em class="parameter"><code>path = /data</code></em></td></tr><tr><td><a class="indexterm" name="id2617787"></a><em class="parameter"><code>writeable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2617799"></a><em class="parameter"><code>browseable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2617812"></a><em class="parameter"><code>vfs objects = example:example1 example example:test</code></em></td></tr><tr><td><a class="indexterm" name="id2617825"></a><em class="parameter"><code>example1: parameter = 1</code></em></td></tr><tr><td><a class="indexterm" name="id2617838"></a><em class="parameter"><code>example:  parameter = 5</code></em></td></tr><tr><td><a class="indexterm" name="id2617851"></a><em class="parameter"><code>test:     parameter = 7</code></em></td></tr></table></div><p>
44 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2617867"></a>Included Modules</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2617873"></a>audit</h3></div></div></div><p>
45 <a class="indexterm" name="id2617881"></a>
46                 A simple module to audit file access to the syslog facility. The following operations are logged:
47                 </p><div class="itemizedlist"><ul type="disc"><li><p>share</p></li><li><p>connect/disconnect</p></li><li><p>directory opens/create/remove</p></li><li><p>file open/close/rename/unlink/chmod</p></li></ul></div><p>
48                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2617914"></a>default_quota</h3></div></div></div><p>
49         This module allows the default quota values, in the windows explorer GUI, to be stored on a Samba-3 server.
50         The challenge is that linux filesystems only store quotas for users and groups, but no default quotas.
51         </p><p>
52         Samba returns NO_LIMIT as the default quotas by default and refuses to update them. With this module you 
53         can store the default quotas that are reported to a windows client, in the quota record of a user. By
54         default the root user is taken because quota limits for root are typically not enforced.
55         </p><p>
56         This module takes 2 parametric entries in the <code class="filename">smb.conf</code> file.  The default prefix for each is the
57         &#8220;<span class="quote">default_quota</span>&#8221;. This can be overwrittem when you load the module in the <span class="emphasis"><em>vfs
58         modules</em></span> parameter like this:
59 </p><pre class="screen">
60 vfs objects = default_quota:myprefix
61 </pre><p>
62         </p><p>
63         The parametric entries that may be specified for the default_quotas module are:
64         </p><div class="variablelist"><dl><dt><span class="term">myprefix:uid</span></dt><dd><p>
65                         This parameter takes a integer argument that specifies the uid of the quota record that will be 
66                         used for storing the default user quotas.
67                         </p><p>
68                         The default value is 0 (for root user). An example of use is:
69 </p><pre class="screen">
70 vfs objects = default_quota
71 default_quota:  uid = 65534
72 </pre><p>
73                         The above demonstrates the case where the <code class="constant">myprefix</code> was omitted, thus the
74                         default prefix is the name of the module. When a <code class="constant">myprefix</code> parameter is
75                         specified the above can be re-written like this:
76 </p><pre class="screen">
77 vfs objects = default_quota:myprefix
78 myprefix:       uid = 65534
79 </pre><p>
80                         </p></dd><dt><span class="term">myprefix:uid nolimit</span></dt><dd><p>
81                         This parameter takes a boolean argument that specifies if the stored default quota values also be
82                         reported for the user record, or if the value <code class="constant">NO_LIMIT</code> should be reported to 
83                         the windows client for the user specified by the <em class="parameter"><code>prefix:uid</code></em> parameter.
84                         </p><p>
85                         The default value is <code class="constant">yes</code> (which means to report NO_LIMIT). An example of use
86                         is shown here:
87 </p><pre class="screen">
88 vfs objects = default_quota:myprefix
89 myprefix:       uid nolimit = no
90 </pre><p>
91                         </p></dd><dt><span class="term">myprefix:gid</span></dt><dd><p>
92                         This parameter takes an integer argument, it's just like the <em class="parameter"><code>prefix&gt;:uid</code></em> but 
93                         for group quotas.  NOTE: group quotas are not supported from the windows explorer.
94                         </p><p>
95                         The default value is 0 (for root group). An example of use is shown here:
96 </p><pre class="screen">
97 vfs objects = default_quota
98 default_quota:  gid = 65534
99 </pre><p>
100                         </p></dd><dt><span class="term">myprefix:gid nolimit</span></dt><dd><p>
101                         This parameter takes a boolean argument, just like the <em class="parameter"><code>prefix&gt;:uid nolimit</code></em> 
102                         but for group quotas.  NOTE: group quotas are not supported from the windows explorer.
103                         </p><p>
104                         The default value is <code class="constant">yes</code> (which means to report NO_LIMIT). An example of use
105                         is shown here:
106 </p><pre class="screen">
107 vfs objects = default_quota
108 default_quota:  uid nolimit = no
109 </pre><p>
110                         </p></dd></dl></div><p>
111         An example of use of multiple parametric specifications is shown here:
112 </p><pre class="screen">
113 ...
114 vfs objects = default_quota:quotasettings
115 quotasettings:  uid nolimit = no
116 quotasettings:  gid = 65534
117 quotasettings:  gid nolimit = no
118 ...
119 </pre><p>
120         </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618131"></a>extd_audit</h3></div></div></div><p>
121 <a class="indexterm" name="id2618139"></a>
122 <a class="indexterm" name="id2618146"></a>
123 <a class="indexterm" name="id2618153"></a>
124                 This module is identical with the <span><strong class="command">audit</strong></span> module above except
125                 that it sends audit logs to both syslog as well as the <span><strong class="command">smbd</strong></span> log files. The 
126                 <a class="indexterm" name="id2618174"></a>log level for this module is set in the <code class="filename">smb.conf</code> file. 
127                 </p><p>
128                 Valid settings and the information that will be recorded are shown in <a href="VFS.html#xtdaudit" title="Table 22.1. Extended Auditing Log Information">the next table</a>.
129                 </p><div class="table"><a name="xtdaudit"></a><p class="title"><b>Table 22.1. Extended Auditing Log Information</b></p><table summary="Extended Auditing Log Information" border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Log Level</th><th align="center">Log Details - File and Directory Operations</th></tr></thead><tbody><tr><td align="center">0</td><td align="left">Make Directory, Remove Directory, Unlink</td></tr><tr><td align="center">1</td><td align="left">Open Directory, Rename File, Change Permissions/ACLs</td></tr><tr><td align="center">2</td><td align="left">Open &amp; Close File</td></tr><tr><td align="center">10</td><td align="left">Maximum Debug Level</td></tr></tbody></table></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2618284"></a>Configuration of Auditing</h4></div></div></div><p>
130 <a class="indexterm" name="id2618292"></a>
131                 This auditing tool is more felxible than most people readily will recognize. There are a number of ways
132                 by which useful logging information can be recorded.
133                 </p><div class="itemizedlist"><ul type="disc"><li><p>Syslog can be used to record all transaction. This can be disabled by setting
134                                         in the <code class="filename">smb.conf</code> file <em class="parameter"><code>syslog = 0</code></em>.</p></li><li><p>Logging can take place to the default log file (<code class="filename">log.smbd</code>)
135                                         for all loaded VFS modules just by setting in the <code class="filename">smb.conf</code> file
136                                         <em class="parameter"><code>log level = 0 vfs:x</code></em>, where x is the log level.
137                                         This will disable general logging while activating all logging of VFS
138                                         module activity at the log level specified.</p></li><li><p>Detailed logging can be obtained per user, per client machine, etc.
139                                         This requires the above together with the creative use of the
140                                         <em class="parameter"><code>log file</code></em> settings.</p><p>An example of detailed per-user and per-machine logging can
141                                         be obtained by setting 
142                                         <a class="indexterm" name="id2618366"></a>log file = /var/log/samba/%U.%m.log.
143                                         </p></li></ul></div><p>
144                 Auditing information often must be preserved for a long time. So that the log files do not get rotated
145                 it is essential that the <a class="indexterm" name="id2618380"></a>max log size = 0 be set
146                 in the <code class="filename">smb.conf</code> file.
147                 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="fakeperms"></a>fake_perms</h3></div></div></div><p>
148 <a class="indexterm" name="id2618408"></a>
149 <a class="indexterm" name="id2618415"></a>
150 <a class="indexterm" name="id2618422"></a>
151 <a class="indexterm" name="id2618429"></a>
152                 This module was created to allow Roaming Profile files and directories to be set (on the Samba server
153                 under UNIX) as read only. This module will, if installed on the Profiles share, report to the client
154                 that the Profile files and directories are writeable. This satisfies the client even though the files
155                 will never be overwritten as the client logs out or shuts down.
156                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618444"></a>recycle</h3></div></div></div><p>
157 <a class="indexterm" name="id2618452"></a>
158 <a class="indexterm" name="id2618459"></a>
159 <a class="indexterm" name="id2618466"></a>
160                 A Recycle Bin-like module. Where used, unlink calls will be intercepted and files moved
161                 to the recycle directory instead of being deleted. This gives the same effect as the
162                 <span class="guiicon">Recycle Bin</span> on Windows computers.
163                 </p><p>
164 <a class="indexterm" name="id2618485"></a>
165 <a class="indexterm" name="id2618492"></a>
166 <a class="indexterm" name="id2618499"></a>
167 <a class="indexterm" name="id2618506"></a>
168                 The <span class="guiicon">Recycle Bin</span> will not appear in <span class="application">Windows Explorer</span> views of the
169                 network file system (share) nor on any mapped drive. Instead, a directory called <code class="filename">.recycle</code>
170                 will be automatically created when the first file is deleted. Users can recover files from the
171                 <code class="filename">.recycle</code> directory. If the <em class="parameter"><code>recycle:keeptree</code></em> has been specified,
172                 deleted files will be found in a path identical with that from which the file was deleted.
173                 </p><p>Supported options for the <span><strong class="command">recycle</strong></span> module are as follow:
174                 </p><div class="variablelist"><dl><dt><span class="term">recycle:repository</span></dt><dd><p>
175 <a class="indexterm" name="id2618570"></a>
176                                 Relative path of the directory where deleted files should be moved.
177                                 </p></dd><dt><span class="term">recycle:keeptree</span></dt><dd><p>
178 <a class="indexterm" name="id2618589"></a>
179                                 Specifies whether the directory structure should be kept or if the files in the directory that is being 
180                                 deleted should be kept separately in the recycle bin.
181                                 </p></dd><dt><span class="term">recycle:versions</span></dt><dd><p>
182 <a class="indexterm" name="id2618611"></a>
183                                 If this option is set, two files 
184                                 with the same name that are deleted will both 
185                                 be kept in the recycle bin. Newer deleted versions 
186                                 of a file will be called &#8220;<span class="quote">Copy #x of <em class="replaceable"><code>filename</code></em></span>&#8221;.
187                                 </p></dd><dt><span class="term">recycle:touch</span></dt><dd><p>
188 <a class="indexterm" name="id2618638"></a>
189                                 Specifies whether a file's access date should be touched when the file is moved to the recycle bin.
190                                 </p></dd><dt><span class="term">recycle:touch_mtime</span></dt><dd><p>
191 <a class="indexterm" name="id2618658"></a>
192                                 Specifies whether a file's last modify date date should be touched when the file is moved to the recycle bin.
193                                 </p></dd><dt><span class="term">recycle:maxsize</span></dt><dd><p>
194 <a class="indexterm" name="id2618678"></a>
195                                 Files that are larger than the number of bytes specified by this parameter will not be put into the recycle bin.
196                                 </p></dd><dt><span class="term">recycle:exclude</span></dt><dd><p>
197 <a class="indexterm" name="id2618698"></a>
198                                 List of files that should not be put into the recycle bin when deleted, but deleted in the regular way.
199                                 </p></dd><dt><span class="term">recycle:exclude_dir</span></dt><dd><p>
200 <a class="indexterm" name="id2618718"></a>
201                                 Contains a list of directories. When files from these directories are
202                                 deleted, they are not put into the
203                                 recycle bin but are deleted in the
204                                 regular way.
205                                 </p></dd><dt><span class="term">recycle:noversions</span></dt><dd><p>
206 <a class="indexterm" name="id2618739"></a>
207                                 Specifies a list of paths (wildcards such as * and ? are supported) for which no versioning
208                                 should be used. Only useful when <span class="emphasis"><em>recycle:versions</em></span> is enabled.
209                                 </p></dd></dl></div><p>
210                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618758"></a>netatalk</h3></div></div></div><p>
211 <a class="indexterm" name="id2618766"></a>
212                 A netatalk module will ease co-existence of Samba and netatalk file sharing services.
213                 </p><p>Advantages compared to the old netatalk module:
214                 </p><div class="itemizedlist"><a class="indexterm" name="id2618780"></a><ul type="disc"><li><p>Does not care about creating .AppleDouble forks, just keeps them in sync.</p></li><li><p>If a share in <code class="filename">smb.conf</code> does not contain .AppleDouble item in hide or veto list, it will be added automatically.</p></li></ul></div><p>
215                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618808"></a>shadow_copy</h3></div></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
216 <a class="indexterm" name="id2618817"></a>
217         <span class="emphasis"><em>THIS IS NOT A BACKUP, ARCHIVAL, OR VERSION CONTROL SOLUTION!</em></span>
218         </p><p>
219 <a class="indexterm" name="id2618831"></a>
220         With Samba or Windows servers, shadow_copy is designed to be an end-user tool only.  It does not replace or
221         enhance your backup and archival solutions and should in no way be considered as such.  Additionally, if you
222         need version control, implement a version control system.  You have been warned.
223         </p></div><p>
224         The shadow_copy module allows you to setup functionality that is similar to MS shadow copy services.  When
225         setup properly, this module allows Microsoft shadow copy clients to browse "shadow copies" on Samba shares.
226         You will need to install the shadow copy client.  You can get the MS shadow copy client <a href="http://www.microsoft.com/windowsserver2003/downloads/shadowcopyclient.mspx" target="_top">here.</a>.  Note the
227         additional requirements for pre-Windows XP clients.  I did not test this functionality with any pre-Windows XP
228         clients.  You should be able to get more information about MS Shadow Copy <a href="http://www.microsoft.com/windowsserver2003/techinfo/overview/scr.mspx" target="_top">from the Microsoft's site</a>.
229         </p><p>
230 <a class="indexterm" name="id2618876"></a>
231 <a class="indexterm" name="id2618883"></a>
232 <a class="indexterm" name="id2618890"></a>
233 <a class="indexterm" name="id2618897"></a>
234 <a class="indexterm" name="id2618903"></a>
235 <a class="indexterm" name="id2618910"></a>
236         The shadow_copy VFS module requires some underlying file system setup with some sort of Logical Volume Manager
237         (LVM) such as LVM1, LVM2, or EVMS.  Setting up LVM is beyond the scope of this document; however, we will
238         outline the steps we took to test this functionality for <span class="emphasis"><em>example purposes only.</em></span> You need
239         to make sure the LVM implementation you choose to deploy is ready for production.  Make sure you do plenty of
240         tests.
241         </p><p>
242         Here are some common resources for LVM and EVMS:
243         </p><div class="itemizedlist"><ul type="disc"><li><p><a href="http://www.sistina.com/products_lvm_download.htm" target="_top">Sistina's
244             LVM1 and LVM2</a></p></li><li><p><a href="http://evms.sourceforge.net/" target="_top">Enterprise Volume Management System (EVMS)</a></p></li><li><p><a href="http://tldp.org/HOWTO/LVM-HOWTO/" target="_top">The LVM HOWTO</a></p></li><li><p>
245               See <a href="http://www-106.ibm.com/developerworks/linux/library/l-lvm/" target="_top">Learning
246               Linux LVM, Part 1</a> and <a href="http://www-106.ibm.com/developerworks/library/l-lvm2.html" target="_top">Learning
247               Linux LWM, Part 2</a> for Daniel Robbins' well-written, two part tutorial on Linux and LVM using LVM
248               source code and reiserfs.</p></li></ul></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2618996"></a>Shadow Copy Setup</h4></div></div></div><p>
249 <a class="indexterm" name="id2619004"></a>
250 <a class="indexterm" name="id2619011"></a>
251         At the time of this writing, not much testing has been done.  I tested the shadow copy VFS module with a
252         specific scenario which was not deployed in a production environment, but more as a proof of concept.  The
253         scenario involved a Samba-3 file server on Debian Sarge with an XFS file system and LVM1.  I do NOT recommend
254         you use this as a solution without doing your own due diligence with regard to all the components presented
255         here.  That said, following is an basic outline of how I got things going.
256         </p><div class="orderedlist"><ol type="1"><li><p><b>Installed Operating System . </b>
257                 In my tests, I used <a href="http://www.debian.org/devel/debian-installer/" target="_top">Debian
258                 Sarge</a> (i.e., testing) on an XFS file system.  Setting up the OS is a bit beyond the scope of this
259                 document.  It is assumed that you have a working OS capable of running Samba.
260                 </p></li><li><p><b>Install &amp; Configure Samba. </b>
261                 See the <a href="introduction.html" title="Part I. General Installation">installation section</a> of this HOWTO for more detail on this.
262                 It doesn't matter if it is a Domain Controller or Member File Server, but it is assumed that you have a
263                 working Samba 3.0.3 or later server running.
264                 </p></li><li><p><b>Install &amp; Configure LVM. </b>
265 <a class="indexterm" name="id2619090"></a>
266 <a class="indexterm" name="id2619096"></a>
267                 Before you can make shadow copies available to the client, you have to create the shadow copies.  This is
268                 done by taking some sort of file system snapshot.  Snapshots are a typical feature of Logical Volume
269                 Managers such as LVM, so we first need to have that setup.
270                 </p><div class="itemizedlist"><p>
271                 The following is provided as an example and will be most helpful for Debian users.  Again, this was tested
272                 using the "testing" or "Sarge" distribution.
273                 </p><ul type="disc"><li><p>
274 <a class="indexterm" name="id2619121"></a>
275 <a class="indexterm" name="id2619128"></a>
276 <a class="indexterm" name="id2619135"></a>
277 <a class="indexterm" name="id2619142"></a>
278 <a class="indexterm" name="id2619149"></a>
279                         Install lvm10 and devfsd packages if you have not done so already.  On Debian systems, you are warned of the
280                         interaction of devfs and lvm1 which requires the use of devfs filenames.  Running <span><strong class="command">apt-get update
281                         &amp;&amp; apt-get install lvm10 devfsd xfsprogs</strong></span> should do the trick for this example.
282                         </p></li><li><p>
283 <a class="indexterm" name="id2619172"></a>
284 <a class="indexterm" name="id2619179"></a>
285 <a class="indexterm" name="id2619186"></a>
286 <a class="indexterm" name="id2619193"></a>
287 <a class="indexterm" name="id2619200"></a>
288                         Now you need to create a volume.  You will need to create a partition (or partitions) to add to your volume.
289                         Use your favorite partitioning tool (e.g., Linux fdisk, cfdisk, etc.).  The partition type should be set to
290                         0x8e for "Linux LVM."  In this example, we will use /dev/hdb1.
291                         </p><p>
292 <a class="indexterm" name="id2619215"></a>
293 <a class="indexterm" name="id2619222"></a>
294 <a class="indexterm" name="id2619228"></a>
295                         Once you have the Linux LVM partition (type 0x8e), you can run a series of commands to create the LVM volume.
296                         You can use several disks and/or partitions, but we will use only one in this example.  You may also need to
297                         load the kernel module with something like <span><strong class="command">modprobe lvm-mod</strong></span> and set your system up to load
298                         it on reboot by adding it to (<code class="filename">/etc/modules</code>).
299                         </p></li><li><p>
300 <a class="indexterm" name="id2619257"></a>
301                         Create the physical volume with <span><strong class="command">pvcreate /dev/hdb1</strong></span>
302                         </p></li><li><p>
303 <a class="indexterm" name="id2619275"></a>
304 <a class="indexterm" name="id2619282"></a>
305                         Create the volume group and add /dev/hda1 to it with <span><strong class="command">vgcreate shadowvol /dev/hdb1</strong></span>
306                         </p><p>
307 <a class="indexterm" name="id2619299"></a>
308                         You can use <span><strong class="command">vgdisplay</strong></span> to review information about the volume group.
309                         </p></li><li><p>
310 <a class="indexterm" name="id2619317"></a>
311                         Now you can create the logical volume with something like <span><strong class="command">lvcreate -L400M -nsh_test shadowvol</strong></span>
312                         </p><p>
313 <a class="indexterm" name="id2619335"></a>
314                         This creates the logical volume of 400 MBs named "sh_test" in the volume group we created called shadowvol.
315                         If everything is working so far, you should see them in <code class="filename">/dev/shadowvol</code>.
316                         </p></li><li><p>
317 <a class="indexterm" name="id2619355"></a>
318                         Now we should be ready to format the logical volume we named sh_test with <span><strong class="command">mkfs.xfs
319                         /dev/shadowvol/sh_test</strong></span>
320                         </p><p>
321 <a class="indexterm" name="id2619372"></a>
322 <a class="indexterm" name="id2619379"></a>
323 <a class="indexterm" name="id2619386"></a>
324 <a class="indexterm" name="id2619393"></a>
325 <a class="indexterm" name="id2619400"></a>
326                         You can format the logical volume with any file system you choose, but make sure to use one that allows you to
327                         take advantage of the additional features of LVM such as freezing, resizing, and growing your file systems.
328                         </p><p>
329 <a class="indexterm" name="id2619414"></a>
330 <a class="indexterm" name="id2619420"></a>
331 <a class="indexterm" name="id2619427"></a>
332                         Now we have an LVM volume where we can play with the shadow_copy VFS module.
333                         </p></li><li><p>
334 <a class="indexterm" name="id2619440"></a>
335 <a class="indexterm" name="id2619447"></a>
336 <a class="indexterm" name="id2619453"></a>
337                         Now we need to prepare the directory with something like
338 </p><pre class="screen">
339 <code class="prompt">root# </code> mkdir -p /data/shadow_share
340 </pre><p>
341                         or whatever you want to name your shadow copy-enabled Samba share.  Make sure you set the permissions so that
342                         you can use it.  If in doubt, use <span><strong class="command">chmod 777 /data/shadow_share</strong></span> and tighten the permissions
343                         once you get things working.
344                         </p></li><li><p>
345 <a class="indexterm" name="id2619488"></a>
346                         Mount the LVM volume using something like <span><strong class="command">mount /dev/shadowvol/sh_test /data/shadow_share</strong></span>
347                         </p><p>
348 <a class="indexterm" name="id2619505"></a>
349                         You may also want to edit your <code class="filename">/etc/fstab</code> so that this partition mounts during the system boot.
350                         </p></li></ul></div></li><li><p><b>Install &amp; Configure the shadow_copy VFS Module. </b>
351                 Finally we get to the actual shadow_copy VFS module.  The shadow_copy VFS module should be available in Samba
352                 3.0.3 and higher.  The smb.conf configuration is pretty standard.  Here is our example of a share configured
353                 with the shadow_copy VFS module:
354                 </p><div class="example"><a name="vfsshadow"></a><p class="title"><b>Example 22.3. Share With shadow_copy VFS</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[shadow_share]</code></em></td></tr><tr><td><a class="indexterm" name="id2619562"></a><em class="parameter"><code>comment = Shadow Copy Enabled Share</code></em></td></tr><tr><td><a class="indexterm" name="id2619575"></a><em class="parameter"><code>path = /data/shadow_share</code></em></td></tr><tr><td><a class="indexterm" name="id2619588"></a><em class="parameter"><code>vfs objects = shadow_copy</code></em></td></tr><tr><td><a class="indexterm" name="id2619601"></a><em class="parameter"><code>writeable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2619614"></a><em class="parameter"><code>browseable = yes</code></em></td></tr></table></div></li><li><p><b>Create Snapshots and Make Them Available to shadow_copy.so. </b>
355 <a class="indexterm" name="id2619638"></a>
356 <a class="indexterm" name="id2619645"></a>
357 <a class="indexterm" name="id2619652"></a>
358                 Before you can browse the shadow copies, you must create them and mount them.  This will most likely be done
359                 with a script that runs as a cron job.  With this particular solution, the shadow_copy VFS module is used to
360                 browse LVM snapshots.  Those snapshots are not created by the module.  They are not made available by the
361                 module either.  This module allows the shadow copy-enabled client to browse the snapshots you take and make
362                 available.
363                 </p><p>
364                 Here is a simple script used to create and mount the snapshots:
365 </p><pre class="screen">
366 #!/bin/bash
367 # This is a test, this is only a test
368 SNAPNAME=`date +%Y.%m.%d-%H.%M.%S`
369 xfs_freeze -f /data/shadow_share/
370 lvcreate -L10M -s -n $SNAPNAME /dev/shadowvol/sh_test
371 xfs_freeze -u /data/shadow_share/
372 mkdir /data/shadow_share/@GMT-$SNAPNAME
373 mount /dev/shadowvol/$SNAPNAME \
374        /data/shadow_share/@GMT-$SNAPNAME -onouuid,ro
375 </pre><p>
376                 Note that the script does not handle other things like remounting snapshots on reboot.
377             </p></li><li><p><b>Test From Client. </b>
378                 To test, you will need to install the shadow copy client which you can obtain from the <a href="http://www.microsoft.com/windowsserver2003/downloads/shadowcopyclient.mspx" target="_top">Microsoft web site.</a> I
379                 only tested this with an XP client so your results may vary with other pre-XP clients.  Once installed, with
380                 your XP client you can right-click on specific files or in the empty space of the shadow_share and view the
381                 "properties."  If anything has changed, then you will see it on the "Previous Versions" tab of the properties
382                 window.
383                 </p></li></ol></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2619720"></a>VFS Modules Available Elsewhere</h2></div></div></div><p>
384 <a class="indexterm" name="id2619728"></a>
385 This section contains a listing of various other VFS modules that have been posted but do not currently reside
386 in the Samba CVS tree for one reason or another (e.g., it is easy for the maintainer to have his or her own
387 CVS tree).
388 </p><p>
389 No statements about the stability or functionality of any module should be implied due to its presence here.
390 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2619746"></a>DatabaseFS</h3></div></div></div><p>
391 <a class="indexterm" name="id2619753"></a>
392 URL: <a href="http://www.css.tayloru.edu/~elorimer/databasefs/index.php" target="_top">
393 Taylors University DatabaeFS</a>
394 </p><p>By <a href="mailto:elorimer@css.tayloru.edu" target="_top">Eric Lorimer.</a></p><p>
395 I have created a VFS module that implements a fairly complete read-only filesystem. It presents information
396 from a database as a filesystem in a modular and generic way to allow different databases to be used.
397 (Originally designed for organizing MP3s under directories such as &#8220;<span class="quote">Artists,</span>&#8221; &#8220;<span class="quote">Song
398 Keywords,</span>&#8221; and so on. I have since easily applied it to a student roster database.) The directory
399 structure is stored in the database itself and the module makes no assumptions about the database structure
400 beyond the table it requires to run.
401 </p><p>
402 Any feedback would be appreciated: comments, suggestions, patches, and so on. If nothing else, it
403 might prove useful for someone else who wishes to create a virtual filesystem.
404 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2619805"></a>vscan</h3></div></div></div><a class="indexterm" name="id2619811"></a><p>URL: <a href="http://www.openantivirus.org/projects.php#samba-vscan" target="_top">
405 Open Anti-Virus vscan</a>
406 </p><p>
407 <a class="indexterm" name="id2619832"></a>
408 samba-vscan is a proof-of-concept module for Samba, which provides on-access anti-virus support for files
409 shared using Samba.  samba-vscan supports various virus scanners and is maintained by Rainer Link.
410 </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="CUPS-printing.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="winbind.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 21. CUPS Printing Support </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 23. Winbind: Use of Domain Accounts</td></tr></table></div></body></html>