Whamcloud - gitweb
LUDOC-391 audit: doc for Lustre Audit with Changelogs
[doc/manual.git] / DataOnMDT.xml
1 <?xml version='1.0' encoding='UTF-8'?><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="dataonmdt"
2     condition="l2B">
3   <title xml:id="dataonmdt.title">Data on MDT (DoM)</title>
4   <para>This chapter describes Data on MDT (DoM).</para>
5   <section xml:id="dbdoclet.domintro">
6       <title>
7       <indexterm>
8         <primary>dom</primary>
9       </indexterm>
10       <indexterm>
11         <primary>dom</primary>
12         <secondary>intro</secondary>
13       </indexterm>Introduction to Data on MDT (DoM)</title>
14       <para>The Lustre Data on MDT (DoM) feature improves small file IO by
15       placing small files directly on the MDT, and also improves large file IO
16       by avoiding the OST being affected by small random IO that can cause
17       device seeking and hurt the streaming IO performance.  Therefore, users
18       can expect more consistent performance for both small file IO and mixed IO
19       patterns.</para>
20       <para>The layout of a DoM file is stored on disk as a composite layout
21       and is a special case of Progressive File Layout (PFL). Please see
22       <xref linkend="pfl" /> for more information on PFL. For DoM files, the
23       file layout is composed of the component of the file, which is placed on
24       an MDT, and the rest of components are placed on OSTs, if needed. The
25       first component is placed on the MDT in the MDT object data blocks.
26       This component always has one stripe with size equal to the component
27       size. Such a component with an MDT layout can be only the first component
28       in composite layout. The rest of components are placed over OSTs as usual
29       with a RAID0 layout. The OST components are not instantiated until
30       a client writes or truncates the file beyond the size of the MDT
31       component.</para>
32   </section>
33   <section xml:id="dbdoclet.usercommands">
34       <title>
35           <indexterm>
36               <primary>dom</primary>
37           </indexterm>
38           <indexterm>
39               <primary>dom</primary>
40               <secondary>usercommands</secondary>
41           </indexterm>User Commands</title>
42       <para>Lustre provides the <literal>lfs setstripe</literal> command for
43       users to create DoM files. Also, as usual,
44       <literal>lfs getstripe</literal> command can be used to list the
45       striping/component information for a given file, while
46       <literal>lfs find</literal> command can be used to search the directory
47       tree rooted at the given directory or file name for the files that match
48       the given DoM component parameters, e.g. layout type.</para>
49       <section xml:id="dbdoclet.lfssetstripe">
50           <title>
51               <indexterm>
52                   <primary>dom</primary>
53                   <secondary>lfssetstripe</secondary>
54               </indexterm>lfs setstripe for DoM files</title>
55           <para>The <literal>lfs setstripe</literal> command is used to create
56           DoM files.</para>
57           <section><title>Command</title>
58               <para><screen>lfs setstripe --component-end|-E end1 --layout|-L \
59 mdt [--component-end|-E end2 [STRIPE_OPTIONS] ...] &lt;filename&gt;
60               </screen>
61               The command above creates a file with the special composite
62               layout, which defines the first component as an MDT component. The
63               MDT component must start from offset 0 and ends at
64               <replaceable>end1</replaceable>. The
65               <replaceable>end1</replaceable> is also the stripe size of this
66               component, and is limited by the
67               <literal>lod.*.dom_stripesize</literal> of the MDT the file is
68               created on. No other options are required. The rest of the
69               components use the normal syntax for composite files creation.
70               </para>
71               <note><para>If the next component doesn't specify striping, such
72               as:
73               <screen>lfs setstripe -E 1M -L mdt -E EOF &lt;filename&gt;</screen>
74               Then that component get its settings from the default filesystem
75               striping.</para></note>
76           </section>
77           <section><title>Example</title>
78           <para>The command below creates a file with a DoM layout. The first
79           component has an <literal>mdt</literal> layout and is placed on the
80           MDT, covering [0, 1M). The second component covers [1M, EOF) and is
81           striped over all available OSTs.</para>
82           <para><screen>client$ lfs setstripe -E 1M -L mdt -E -1 -S 4M -c -1 \
83           /mnt/lustre/domfile</screen></para>
84           <para>The resulting layout is illustrated by
85           <xref xmlns:xlink="http://www.w3.org/1999/xlink"
86           linkend="dataonmdt.fig.layout1" />.</para>
87           <figure xml:id="dataonmdt.fig.layout1">
88               <title>Resulting file layout</title>
89               <mediaobject>
90                   <imageobject>
91                       <imagedata scalefit="1" width="50%"
92                       fileref="./figures/DoM_Layout1.png" />
93                   </imageobject>
94                   <textobject>
95                       <phrase>Resulting file layout</phrase>
96                   </textobject>
97               </mediaobject>
98           </figure>
99           <para>The resulting can also be checked with
100           <literal>lfs getstripe</literal> as shown below:</para>
101           <screen>client$ lfs getstripe /mnt/lustre/domfile
102 /mnt/lustre/domfile
103   lcm_layout_gen:   2
104   lcm_mirror_count: 1
105   lcm_entry_count:  2
106     lcme_id:             1
107     lcme_flags:          init
108     lcme_extent.e_start: 0
109     lcme_extent.e_end:   1048576
110       lmm_stripe_count:  0
111       lmm_stripe_size:   1048576
112       lmm_pattern:       mdt
113       lmm_layout_gen:    0
114       lmm_stripe_offset: 0
115       lmm_objects:
116       
117     lcme_id:             2
118     lcme_flags:          0
119     lcme_extent.e_start: 1048576
120     lcme_extent.e_end:   EOF
121       lmm_stripe_count:  -1
122       lmm_stripe_size:   4194304
123       lmm_pattern:       raid0
124       lmm_layout_gen:    65535
125       lmm_stripe_offset: -1</screen>
126           <para>The output above shows that the first component has size 1MB and
127           pattern is 'mdt'. The second component is not instantiated yet, which
128           is seen by <literal>lcme_flags: 0</literal>.</para>
129           <para>If more than 1MB of data is written to the file, then
130           <literal>lfs getstripe</literal> output is changed accordingly:</para>
131           <screen>client$ lfs getstripe /mnt/lustre/domfile
132 /mnt/lustre/domfile
133   lcm_layout_gen:   3
134   lcm_mirror_count: 1
135   lcm_entry_count:  2
136     lcme_id:             1
137     lcme_flags:          init
138     lcme_extent.e_start: 0
139     lcme_extent.e_end:   1048576
140       lmm_stripe_count:  0
141       lmm_stripe_size:   1048576
142       lmm_pattern:       mdt
143       lmm_layout_gen:    0
144       lmm_stripe_offset: 2
145       lmm_objects:
146       
147     lcme_id:             2
148     lcme_flags:          init
149     lcme_extent.e_start: 1048576
150     lcme_extent.e_end:   EOF
151       lmm_stripe_count:  2
152       lmm_stripe_size:   4194304
153       lmm_pattern:       raid0
154       lmm_layout_gen:    0
155       lmm_stripe_offset: 0
156       lmm_objects:
157       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }
158       - 1: { l_ost_idx: 1, l_fid: [0x100010000:0x2:0x0] }</screen>
159           <para>The output above shows that the second component now has objects
160           on OSTs with a 4MB stripe.</para>
161           </section>
162       </section>
163       <section><title>Setting a default DoM layout to an existing directory
164       </title>
165       <para>A DoM layout can be set on an existing directory as well. When
166           set, all the files created after that will inherit this layout by
167           default.</para>
168           <section><title>Command</title>
169               <screen>lfs setstripe --component-end|-E end1 --layout|-L mdt \
170 [--component-end|-E end2 [STRIPE_OPTIONS] ...] &lt;dirname&gt;</screen>
171           </section>
172           <section><title>Example</title>
173               <screen>client$ mkdir /mnt/lustre/domdir
174 client$ touch /mnt/lustre/domdir/normfile
175 client$ lfs setstripe -E 1M -L mdt -E -1 /mnt/lustre/domdir/
176 client$ lfs getstripe -d /mnt/lustre/domdir
177   lcm_layout_gen:   0
178   lcm_mirror_count: 1
179   lcm_entry_count:  2
180     lcme_id:             N/A
181     lcme_flags:          0
182     lcme_extent.e_start: 0
183     lcme_extent.e_end:   1048576
184       stripe_count:  0    stripe_size:   1048576    \
185       pattern:  mdt    stripe_offset:  -1
186     
187     lcme_id:             N/A
188     lcme_flags:          0
189     lcme_extent.e_start: 1048576
190     lcme_extent.e_end:   EOF
191       stripe_count:  1    stripe_size:   1048576    \
192       pattern:  raid0    stripe_offset:  -1
193               </screen>
194               <para>In the output above, it can be seen that the directory has
195               a default layout with a DoM component.</para>
196               <para>The following example will check layouts of files in that
197               directory:</para>
198               <screen>client$ touch /mnt/lustre/domdir/domfile
199 client$ lfs getstripe /mnt/lustre/domdir/normfile
200 /mnt/lustre/domdir/normfile
201 lmm_stripe_count:  2
202 lmm_stripe_size:   1048576
203 lmm_pattern:       raid0
204 lmm_layout_gen:    0
205 lmm_stripe_offset: 1
206   obdidx   objid   objid   group
207        1              3           0x3              0
208        0              3           0x3              0
209
210 client$ lfs getstripe /mnt/lustre/domdir/domfile
211 /mnt/lustre/domdir/domfile
212   lcm_layout_gen:   2
213   lcm_mirror_count: 1
214   lcm_entry_count:  2
215     lcme_id:             1
216     lcme_flags:          init
217     lcme_extent.e_start: 0
218     lcme_extent.e_end:   1048576
219       lmm_stripe_count:  0
220       lmm_stripe_size:   1048576
221       lmm_pattern:       mdt
222       lmm_layout_gen:    0
223       lmm_stripe_offset: 2
224       lmm_objects:
225       
226     lcme_id:             2
227     lcme_flags:          0
228     lcme_extent.e_start: 1048576
229     lcme_extent.e_end:   EOF
230       lmm_stripe_count:  1
231       lmm_stripe_size:   1048576
232       lmm_pattern:       raid0
233       lmm_layout_gen:    65535
234       lmm_stripe_offset: -1</screen>
235               <para>We can see that first file
236               <emphasis role="bold">normfile</emphasis> in that directory has an
237               ordinary layout, whereas the file <emphasis role="bold">domfile
238               </emphasis> inherits the directory default layout and is a DoM
239               file.</para>
240               <note><para>The directory default layout setting will be inherited
241               by new files even if the server DoM size limit will be set to a
242               lower value.</para></note>
243           </section>
244       </section>
245       <section xml:id="dbdoclet.domstripesize">
246           <title>
247               <indexterm>
248                   <primary>dom</primary>
249               </indexterm>
250               <indexterm>
251                   <primary>dom</primary>
252                   <secondary>domstripesize</secondary>
253               </indexterm>DoM Stripe Size Restrictions</title>
254           <para>The maximum size of a DoM component is restricted in several
255           ways to protect the MDT from being eventually filled with large files.
256           </para>
257           <section><title>LFS limits for DoM component size</title>
258               <para><literal>lfs setstripe</literal> allows for setting the
259               component size for MDT layouts up to 1GB, however, the size must
260               be also aligned by 64KB. This is the maximum possible size on MDT.
261               Meanwhile, there is another limit which is checked by
262               <literal>lfs setstripe</literal> is provided by MDT server itself.
263               </para>
264           </section>
265           <section><title>MDT Server Limits</title>
266               <para>The LOD parameter <literal>dom_stripesize</literal> is used
267               to control the per-server maximum size for a DoM component. It is
268               1MB by default and can be changed with the
269               <literal>lctl</literal> tool.  For more information on setting
270               <literal>dom_stripesize</literal> please see
271               <xref linkend="dbdoclet.dom_stripesize" />.</para>
272           </section>
273       </section>
274       <section xml:id="dbdoclet.domlfsgetstripe">
275           <title>
276               <indexterm>
277                   <primary>dom</primary>
278               </indexterm>
279               <indexterm>
280                   <primary>dom</primary>
281                   <secondary>lfsgetstripe</secondary>
282               </indexterm>lfs getstripe for DoM files</title>
283           <para>The <literal>lfs getstripe</literal> command is used to list
284           the striping/component information for a given file. For DoM files, it
285           can be used to check its layout and size.</para>
286           <section><title>Command</title>
287               <para><screen>lfs getstripe [--component-id|-I [comp_id]] [--layout|-L] \
288               [--stripe-size|-S] &lt;dirname|filename&gt;</screen></para>
289           </section>
290           <section><title>Examples</title>
291               <screen>client$ lfs getstripe -I1 /mnt/lustre/domfile
292 /mnt/lustre/domfile
293   lcm_layout_gen:   3
294   lcm_mirror_count: 1
295   lcm_entry_count:  2
296     lcme_id:             1
297     lcme_flags:          init
298     lcme_extent.e_start: 0
299     lcme_extent.e_end:   1048576
300       lmm_stripe_count:  0
301       lmm_stripe_size:   1048576
302       lmm_pattern:       mdt
303       lmm_layout_gen:    0
304       lmm_stripe_offset: 2
305       lmm_objects:</screen>
306               <para>Short info about the layout and size of DoM component can
307               be obtained with the use of the <literal>-L</literal> option
308               along with <literal>-S</literal> or <literal>-E</literal> options:
309               <screen>client$ lfs getstripe -I1 -L -S /mnt/lustre/domfile
310       lmm_stripe_size:   1048576
311       lmm_pattern:       mdt
312 client$ lfs getstripe -I1 -L -E /mnt/lustre/domfile
313     lcme_extent.e_end:   1048576
314       lmm_pattern:       mdt</screen>
315               Both commands return layout type and its size. The stripe size is
316               equal to the extent size of component in case of DoM files, so
317               both can be used to get size on the MDT.</para>
318           </section>
319       </section>
320       <section xml:id="dbdoclet.domlfsfind">
321           <title>
322               <indexterm>
323                   <primary>dom</primary>
324               </indexterm>
325               <indexterm>
326                   <primary>dom</primary>
327                   <secondary>lfsfind</secondary>
328               </indexterm>lfs find for DoM files</title>
329           <para>The <literal>lfs find</literal> command can be used to search
330           the directory tree rooted at the given directory or file name for the
331           files that match the given parameters. The command below shows the new
332           parameters for DoM files and their usages are similar to the
333           <literal>lfs getstripe</literal> command.</para>
334           <section><title>Command</title>
335               <para><screen>lfs find &lt;directory|filename&gt; [--layout|-L] [...]
336               </screen></para>
337           </section>
338           <section><title>Examples</title>
339               <para>Find all files with DoM layout under directory
340               <literal>/mnt/lustre</literal>:
341               <screen>client$ lfs find -L mdt /mnt/lustre
342 /mnt/lustre/domfile
343 /mnt/lustre/domdir
344 /mnt/lustre/domdir/domfile
345                           
346 client$ lfs find -L mdt -type f /mnt/lustre
347 /mnt/lustre/domfile
348 /mnt/lustre/domdir/domfile
349                           
350 client$ lfs find -L mdt -type d /mnt/lustre
351 /mnt/lustre/domdir</screen>
352               By using this command you can find all DoM objects, only DoM
353               files, or only directories with default DoM layout.</para>
354               <para>Find the DoM files/dirs with a particular stripe size:
355               <screen>client$ lfs find -L mdt -S -1200K -type f /mnt/lustre
356 /mnt/lustre/domfile
357 /mnt/lustre/domdir/domfile
358                           
359 client$ lfs find -L mdt -S +200K -type f /mnt/lustre
360 /mnt/lustre/domfile
361 /mnt/lustre/domdir/domfile</screen>
362               The first command finds all DoM files with stripe size less
363               than 1200KB.  The second command above does the same for files
364               with a stripe size greater than 200KB. In both cases, all DoM
365               files are found because their DoM size is 1MB.</para>
366           </section>
367       </section>
368       <section xml:id="dbdoclet.dom_stripesize">
369           <title>
370               <indexterm>
371                   <primary>dom</primary>
372               </indexterm>
373               <indexterm>
374                   <primary>dom</primary>
375                   <secondary>dom_stripesize</secondary>
376               </indexterm>The dom_stripesize parameter</title>
377           <para>The MDT controls the default maximum DoM size on the server via
378           the parameter <literal>dom_stripesize</literal> in the LOD device.
379           The <literal>dom_stripesize</literal> can be set differently for each
380           MDT, if necessary. The default value of the parameter is 1MB and can
381           be changed with <literal>lclt</literal> tool.</para>
382           <section><title>Get Command</title>
383               <para><screen>lctl get_param lod.*MDT&lt;index&gt;*.dom_stripesize
384               </screen></para>
385           </section>
386           <section><title>Get Examples</title>
387               <para>The commands below get the maximum allowed DoM size on the
388               server. The final command is an attempt to create a file with a
389               larger size than the parameter setting and correctly fails.
390               <screen>mds# lctl get_param lod.*MDT0000*.dom_stripesize
391 lod.lustre-MDT0000-mdtlov.dom_stripesize=1048576
392
393 mds# lctl get_param -n lod.*MDT0000*.dom_stripesize
394 1048576
395
396 client$ lfs setstripe -E 2M -L mdt /mnt/lustre/dom2mb
397 Create composite file /mnt/lustre/dom2mb failed. Invalid argument
398 error: setstripe: create composite file '/mnt/lustre/dom2mb' failed:
399 Invalid argument</screen></para>
400           </section>
401           <section><title>Temporary Set Command</title>
402               <para>To temporarily set the value of the parameter, the
403               <literal>lctl set_param</literal> is used:
404               <screen>lctl set_param lod.*MDT&lt;index&gt;*.dom_stripesize=&lt;value&gt;
405               </screen></para>
406           </section>
407           <section><title>Temporary Set Examples</title>
408               <para>The example below shows a change to the default DoM limit on
409               the server to 32KB and try to create a file with 1MB DoM size
410               after that.
411               <screen>mds# lctl set_param -n lod.*MDT0000*.dom_stripesize=32K
412 mds# lctl get_param -n lod.*MDT0000*.dom_stripesize
413 32768
414
415 client$ lfs setstripe -E 1M -L mdt /mnt/lustre/dom
416 Create composite file /mnt/lustre/dom failed. Invalid argument
417 error: setstripe: create composite file '/mnt/lustre/dom' failed:
418 Invalid argument</screen></para>
419           </section>
420           <section><title>Persistent Set Command</title>
421               <para>To persistently set the value of the parameter, the
422                   <literal>lctl conf_param</literal> command is used:
423                   <screen>lctl conf_param &lt;fsname&gt;-MDT&lt;index&gt;.lod.dom_stripesize=&lt;value&gt;
424                   </screen></para>
425           </section>
426           <section><title>Persistent Set Examples</title>
427               <para>The new value of the parameter is saved in config log
428               permanently:
429                   <screen>mgs# lctl conf_param lustre-MDT0000.lod.dom_stripesize=512K
430 mds# lctl get_param -n lod.*MDT0000*.dom_stripesize
431 524288</screen>
432               New settings are applied in few seconds and saved persistently in
433               server config.
434               </para>
435           </section>
436       </section>
437       <section xml:id="dbdoclet.disabledom">
438           <title>
439               <indexterm>
440                   <primary>dom</primary>
441               </indexterm>
442               <indexterm>
443                   <primary>dom</primary>
444                   <secondary>disabledom</secondary>
445               </indexterm>Disable DoM</title>
446           <para>When <literal>lclt set_param</literal> or
447           <literal>lctl conf_param</literal> sets
448           <literal>dom_stripesize</literal> to <literal>0</literal>, DoM
449           file creation will be prohibited on the selected server.</para>
450           <note><para>DoM files can still be created in existing directories
451           with the default DoM layout</para></note>
452       </section>
453   </section>
454 </chapter>