Whamcloud - gitweb
LUDOC-394 manual: Remove extra 'held' word
[doc/manual.git] / ManagingStripingFreeSpace.xml
1 <?xml version='1.0' encoding='UTF-8'?>
2 <chapter xmlns="http://docbook.org/ns/docbook"
3  xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US"
4  xml:id="managingstripingfreespace">
5   <title xml:id="managingstripingfreespace.title">Managing File Layout (Striping) and Free
6     Space</title>
7   <para>This chapter describes file layout (striping) and I/O options, and includes the following
8     sections:</para>
9   <itemizedlist>
10     <listitem>
11       <para><xref linkend="file_striping.how_it_works"/></para>
12     </listitem>
13     <listitem>
14       <para><xref linkend="file_striping.considerations"/></para>
15     </listitem>
16     <listitem>
17       <para><xref linkend="file_striping.lfs_setstripe"/></para>
18     </listitem>
19     <listitem>
20       <para><xref linkend="file_striping.lfs_getstripe"/></para>
21     </listitem>
22     <listitem>
23       <para><xref linkend="file_striping.managing_free_space"/></para>
24     </listitem>
25     <listitem>
26       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="wide_striping"/></para>
27     </listitem>
28   </itemizedlist>
29   <section xml:id="file_striping.how_it_works">
30       <title>
31       <indexterm>
32         <primary>space</primary>
33       </indexterm>
34       <indexterm>
35         <primary>striping</primary>
36         <secondary>how it works</secondary>
37       </indexterm>
38       <indexterm>
39         <primary>striping</primary>
40         <see>space</see>
41       </indexterm>
42       <indexterm>
43         <primary>space</primary>
44         <secondary>striping</secondary>
45       </indexterm>How Lustre File System Striping Works</title>
46     <para>In a Lustre file system, the MDS allocates objects to OSTs using either a round-robin
47       algorithm or a weighted algorithm. When the amount of free space is well balanced (i.e., by
48       default, when the free space across OSTs differs by less than 17%), the round-robin algorithm
49       is used to select the next OST to which a stripe is to be written. Periodically, the MDS
50       adjusts the striping layout to eliminate some degenerated cases in which applications that
51       create very regular file layouts (striping patterns) preferentially use a particular OST in
52       the sequence.</para>
53     <para> Normally the usage of OSTs is well balanced. However, if users create a small number of
54       exceptionally large files or incorrectly specify striping parameters, imbalanced OST usage may
55       result. When the free space across OSTs differs by more than a specific amount (17% by
56       default), the MDS then uses weighted random allocations with a preference for allocating
57       objects on OSTs with more free space. (This can reduce I/O performance until space usage is
58       rebalanced again.) For a more detailed description of how striping is allocated, see <xref
59         linkend="file_striping.managing_free_space"/>.</para>
60     <para>Files can only be striped over a finite number of OSTs, based on the
61     maximum size of the attributes that can be stored on the MDT. If the MDT
62     is ldiskfs-based without the <literal>ea_inode</literal> feature, a file
63     can be striped across at most 160 OSTs.  With a ZFS-based MDT, or if the
64     <literal>ea_inode</literal> feature is enabled for an ldiskfs-based MDT
65     (the default since Lustre 2.13.0),
66     a file can be striped across up to 2000 OSTs. For more information, see
67     <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="wide_striping"/>.
68     </para>
69   </section>
70   <section xml:id="file_striping.considerations">
71       <title><indexterm>
72         <primary>file layout</primary>
73         <secondary>See striping</secondary>
74       </indexterm><indexterm>
75         <primary>striping</primary>
76         <secondary>considerations</secondary>
77       </indexterm>
78       <indexterm>
79         <primary>space</primary>
80         <secondary>considerations</secondary>
81       </indexterm> Lustre File Layout (Striping) Considerations</title>
82     <para>Whether you should set up file striping and what parameter values you select depends on
83       your needs. A good rule of thumb is to stripe over as few objects as will meet those needs and
84       no more.</para>
85     <para>Some reasons for using striping include:</para>
86     <itemizedlist>
87       <listitem>
88         <para><emphasis role="bold">Providing high-bandwidth access.</emphasis> Many applications
89           require high-bandwidth access to a single file, which may be more bandwidth than can be
90           provided by a single OSS. Examples are a scientific application that writes to a single
91           file from hundreds of nodes, or a binary executable that is loaded by many nodes when an
92           application starts.</para>
93         <para>In cases like these, a file can be striped over as many OSSs as it takes to achieve
94           the required peak aggregate bandwidth for that file. Striping across a larger number of
95           OSSs should only be used when the file size is very large and/or is accessed by many nodes
96           at a time. Currently, Lustre files can be striped across up to 2000 OSTs</para>
97       </listitem>
98       <listitem>
99         <para><emphasis role="bold">Improving performance when OSS bandwidth is exceeded.</emphasis>
100           Striping across many OSSs can improve performance if the aggregate client bandwidth
101           exceeds the server bandwidth and the application reads and writes data fast enough to take
102           advantage of the additional OSS bandwidth. The largest useful stripe count is bounded by
103           the I/O rate of the clients/jobs divided by the performance per OSS.</para>
104       </listitem>
105       <listitem>
106         <para condition="l2D"><emphasis role="bold">Matching stripes to I/O
107         pattern.</emphasis>When writing to a single file from multiple nodes,
108         having more than one client writing to a stripe can lead to issues
109         with lock exchange, where clients contend over writing to that stripe,
110         even if their I/Os do not overlap.  This can be avoided if I/O can be
111         stripe aligned so that each stripe is accessed by only one client.
112         Since Lustre 2.13, the 'overstriping' feature is available, allowing more
113         than one stripe per OST.  This is particularly helpful for the case where
114         thread count exceeds OST count, making it possible to match stripe count
115         to thread count even in this case.</para>
116       </listitem>
117       <listitem>
118         <para><emphasis role="bold">Providing space for very large files.</emphasis> Striping is
119           useful when a single OST does not have enough free space to hold the entire file.</para>
120       </listitem>
121     </itemizedlist>
122     <para>Some reasons to minimize or avoid striping:</para>
123     <itemizedlist>
124       <listitem>
125         <para><emphasis role="bold">Increased overhead.</emphasis> Striping results in more locks
126           and extra network operations during common operations such as <literal>stat</literal> and
127             <literal>unlink</literal>. Even when these operations are performed in parallel, one
128           network operation takes less time than 100 operations.</para>
129         <para>Increased overhead also results from server contention. Consider a cluster with 100
130           clients and 100 OSSs, each with one OST. If each file has exactly one object and the load
131           is distributed evenly, there is no contention and the disks on each server can manage
132           sequential I/O. If each file has 100 objects, then the clients all compete with one
133           another for the attention of the servers, and the disks on each node seek in 100 different
134           directions resulting in needless contention.</para>
135       </listitem>
136       <listitem>
137         <para><emphasis role="bold">Increased risk.</emphasis> When files are striped across all
138           servers and one of the servers breaks down, a small part of each striped file is lost. By
139           comparison, if each file has exactly one stripe, fewer files are lost, but they are lost
140           in their entirety. Many users would prefer to lose some of their files entirely than all
141           of their files partially.</para>
142       </listitem>
143       <listitem>
144         <para><emphasis role="bold">Small files.</emphasis> Small files do not benefit from striping
145           because they can be efficiently stored and accessed as a single OST object or even with
146           Data on MDT.</para>
147       </listitem>
148       <listitem>
149         <para><emphasis role="bold">O_APPEND mode.</emphasis> When files are opened for append, they
150           instantiate all uninitialized components expressed in the layout.  Typically, log files are
151           opened for append, and complex layouts can be inefficient.</para>
152         <note>
153           <para>The <literal>mdd.*.append_stripe_count</literal> and <literal>mdd.*.append_pool
154             </literal> options can be used to specify special default striping for files created
155             with <literal> O_APPEND</literal>.</para>
156         </note>
157       </listitem>
158     </itemizedlist>
159     <section remap="h3">
160         <title><indexterm><primary>striping</primary><secondary>size</secondary></indexterm>
161             Choosing a Stripe Size</title>
162       <para>Choosing a stripe size is a balancing act, but reasonable defaults are described below.
163         The stripe size has no effect on a single-stripe file.</para>
164       <itemizedlist>
165         <listitem>
166           <para><emphasis role="bold">The stripe size must be a multiple of the page
167               size.</emphasis> Lustre software tools enforce a multiple of 64 KB (the maximum page
168             size on ia64 and PPC64 nodes) so that users on platforms with smaller pages do not
169             accidentally create files that might cause problems for ia64 clients.</para>
170         </listitem>
171         <listitem>
172           <para><emphasis role="bold">The smallest recommended stripe size is 512 KB.</emphasis>
173             Although you can create files with a stripe size of 64 KB, the smallest practical stripe
174             size is 512 KB because the Lustre file system sends 1MB chunks over the network.
175             Choosing a smaller stripe size may result in inefficient I/O to the disks and reduced
176             performance.</para>
177         </listitem>
178         <listitem>
179           <para><emphasis role="bold">A good stripe size for sequential I/O using high-speed
180               networks is between 1 MB and 4 MB.</emphasis> In most situations, stripe sizes larger
181             than 4 MB may result in longer lock hold times and contention during shared file
182             access.</para>
183         </listitem>
184         <listitem>
185           <para><emphasis role="bold">The maximum stripe size is 4 GB.</emphasis> Using a large
186             stripe size can improve performance when accessing very large files. It allows each
187             client to have exclusive access to its own part of a file. However, a large stripe size
188             can be counterproductive in cases where it does not match your I/O pattern.</para>
189         </listitem>
190         <listitem>
191           <para><emphasis role="bold">Choose a stripe pattern that takes into account the write
192               patterns of your application.</emphasis> Writes that cross an object boundary are
193             slightly less efficient than writes that go entirely to one server. If the file is
194             written in a consistent and aligned way, make the stripe size a multiple of the
195               <literal>write()</literal> size.</para>
196         </listitem>
197       </itemizedlist>
198     </section>
199   </section>
200   <section xml:id="file_striping.lfs_setstripe">
201       <title><indexterm>
202         <primary>striping</primary>
203         <secondary>configuration</secondary>
204       </indexterm>Setting the File Layout/Striping Configuration (<literal>lfs
205       setstripe</literal>)</title>
206     <para>Use the <literal>lfs setstripe</literal> command to create new files with a specific file layout (stripe pattern) configuration.</para>
207     <screen>lfs setstripe [--size|-s stripe_size] [--stripe-count|-c stripe_count] [--overstripe-count|-C stripe_count] \
208 [--index|-i start_ost] [--pool|-p pool_name] <replaceable>filename|dirname</replaceable> </screen>
209     <para><emphasis role="bold">
210         <literal>stripe_size</literal>
211       </emphasis>
212       </para>
213     <para>The <literal>stripe_size</literal> indicates how much data to write to one OST before
214       moving to the next OST. The default <literal>stripe_size</literal> is 1 MB. Passing a
215         <literal>stripe_size</literal> of 0 causes the default stripe size to be used. Otherwise,
216       the <literal>stripe_size</literal> value must be a multiple of 64 KB.</para>
217     <para><emphasis role="bold">
218         <literal>stripe_count (--stripe-count, --overstripe-count)</literal>
219       </emphasis>
220     </para>
221     <para>The <literal>stripe_count</literal> indicates how many stripes to use.
222     The default <literal>stripe_count</literal> value is 1. Setting
223     <literal>stripe_count</literal> to 0 causes the default stripe count to be
224     used. Setting <literal>stripe_count</literal> to -1 means stripe over all
225     available OSTs (full OSTs are skipped).  When --overstripe-count is used,
226     per OST if necessary.</para>
227     <para><emphasis role="bold">
228         <literal>start_ost</literal>
229       </emphasis>
230       </para>
231     <para>The start OST is the first OST to which files are written. The default value for
232         <literal>start_ost</literal> is -1, which allows the MDS to choose the starting index. This
233       setting is strongly recommended, as it allows space and load balancing to be done by the MDS
234       as needed. If the value of <literal>start_ost</literal> is set to a value other than -1, the
235       file starts on the specified OST index. OST index numbering starts at 0.</para>
236     <note>
237       <para>If the specified OST is inactive or in a degraded mode, the MDS will silently choose
238         another target.</para>
239     </note>
240     <note>
241       <para>If you pass a <literal>start_ost</literal> value of 0 and a
242           <literal>stripe_count</literal> value of <emphasis>1</emphasis>, all files are written to
243         OST 0, until space is exhausted. <emphasis role="italic">This is probably not what you meant
244           to do.</emphasis> If you only want to adjust the stripe count and keep the other
245         parameters at their default settings, do not specify any of the other parameters:</para>
246       <para><screen>client# lfs setstripe -c <replaceable>stripe_count</replaceable> <replaceable>filename</replaceable></screen></para>
247     </note>
248     <para><emphasis role="bold">
249         <literal>pool_name</literal>
250       </emphasis>
251       </para>
252     <para>The <literal>pool_name</literal> specifies the OST pool to which the
253       file will be written.  This allows limiting the OSTs used to a subset of
254       all OSTs in the file system. For more details about using OST pools, see
255       <xref linkend="managingfilesystemio.managing_ost_pools" />.</para>
256     <section remap="h3">
257       <title>Specifying a File Layout (Striping Pattern) for a Single File</title>
258       <para>It is possible to specify the file layout when a new file is created using the command <literal>lfs setstripe</literal>. This allows users to override the file system default parameters to tune the file layout more optimally for their application. Execution of an <literal>lfs setstripe</literal> command fails if the file already exists.</para>
259       <section xml:id="file_striping.stripe_size">
260         <title>Setting the Stripe Size</title>
261         <para>The command to create a new file with a specified stripe size is similar to:</para>
262         <screen>[client]# lfs setstripe -s 4M /mnt/lustre/new_file</screen>
263         <para>This example command creates the new file <literal>/mnt/lustre/new_file</literal> with a stripe size of 4 MB.</para>
264         <para>Now, when the file is created, the new stripe setting creates the file on a single OST with a stripe size of 4M:</para>
265         <screen> [client]# lfs getstripe /mnt/lustre/new_file
266 /mnt/lustre/4mb_file
267 lmm_stripe_count:   1
268 lmm_stripe_size:    4194304
269 lmm_pattern:        1
270 lmm_layout_gen:     0
271 lmm_stripe_offset:  1
272 obdidx     objid        objid           group
273 1          690550       0xa8976         0 </screen>
274         <para>In this example, the stripe size is 4 MB.</para>
275       </section>
276       <section remap="h4">
277           <title><indexterm><primary>striping</primary><secondary>count</secondary></indexterm>
278               Setting the Stripe Count</title>
279         <para>The command below creates a new file with a stripe count of <literal>-1</literal> to
280           specify striping over all available OSTs:</para>
281         <screen>[client]# lfs setstripe -c -1 /mnt/lustre/full_stripe</screen>
282         <para>The example below indicates that the file
283           <literal>full_stripe</literal> is striped
284           over all six active OSTs in the configuration:</para>
285         <screen>[client]# lfs getstripe /mnt/lustre/full_stripe
286 /mnt/lustre/full_stripe
287   obdidx   objid   objid   group
288   0        8       0x8     0
289   1        4       0x4     0
290   2        5       0x5     0
291   3        5       0x5     0
292   4        4       0x4     0
293   5        2       0x2     0</screen>
294         <para> This is in contrast to the output in
295           <xref linkend="file_striping.stripe_size"/>,
296           which shows only a single object for the file.</para>
297       </section>
298     </section>
299     <section remap="h3">
300       <title><indexterm>
301           <primary>striping</primary>
302           <secondary>per directory</secondary>
303         </indexterm>Setting the Striping Layout for a Directory</title>
304       <para>In a directory, the <literal>lfs setstripe</literal> command sets a default striping
305         configuration for files created in the directory. The usage is the same as <literal>lfs
306           setstripe</literal> for a regular file, except that the directory must exist prior to
307         setting the default striping configuration. If a file is created in a directory with a
308         default stripe configuration (without otherwise specifying striping), the Lustre file system
309         uses those striping parameters instead of the file system default for the new file.</para>
310       <para>To change the striping pattern for a sub-directory, create a directory with desired file
311         layout as described above. Sub-directories inherit the file layout of the root/parent
312         directory.</para>
313       <note>
314         <para>Special default striping can be used for files created with <literal>O_APPEND</literal>.
315           Files with uninitialized layouts opened with <literal>O_APPEND</literal> will
316           override a directory's default striping configuration and abide by the <literal>
317           mdd.*.append_pool</literal> and <literal>mdd.*.append_stripe_count</literal> options (if
318           they are specified).</para>
319       </note>
320     </section>
321     <section remap="h3">
322       <title><indexterm>
323           <primary>striping</primary>
324           <secondary>per file system</secondary>
325         </indexterm>Setting the Striping Layout for a File System</title>
326       <para>Setting the striping specification on the <literal>root</literal> directory determines
327         the striping for all new files created in the file system unless an overriding striping
328         specification takes precedence (such as a striping layout specified by the application, or
329         set using <literal>lfs setstripe</literal>, or specified for the parent directory).</para>
330       <note>
331         <para>The striping settings for a <literal>root</literal> directory are, by default, applied
332           to any new child directories created in the root directory, unless striping settings have
333           been specified for the child directory.</para>
334       </note>
335       <note>
336         <para>Special default striping can be used for files created with <literal>O_APPEND</literal>.
337           Files with uninitialized layouts opened with <literal>O_APPEND</literal> will
338           override a file system's default striping configuration and abide by the <literal>
339           mdd.*.append_pool</literal> and <literal>mdd.*.append_stripe_count</literal> options (if
340           they are specified).</para>
341       </note>
342     </section>
343     <section remap="h3">
344       <title><indexterm>
345           <primary>striping</primary>
346           <secondary>stripe count limit</secondary>
347         </indexterm>Per File System Stripe Count Limit</title>
348       <para>Sometime there are many OSTs in a filesystem, but it is not always
349         desirable to stripe file to across all OSTs, even if the given
350         <literal>stripe_count=-1</literal> (unlimited).
351         In this case, the per-filesystem tunable parameter
352         <literal>lod.*.max_stripecount</literal> can be used to limit the real
353         stripe count of file to a lower number than the OST count.
354         If <literal>lod.*.max_stripecount</literal> is not 0, and the file
355         <literal>stripe_count=-1</literal>, the real stripe count will be
356         the minimum of the OST count and <literal>max_stripecount</literal>. If
357         <literal>lod.*.max_stripecount=0</literal>, or an explicit stripe count
358         is given for the file, it is ignored.</para>
359       <para>To set <literal>max_stripecount</literal>, on all MDSes of
360         file system, run:
361         <screen>
362 mgs# lctl set_param -P lod.$fsname-MDTxxxx-mdtlov.max_stripecount=&lt;N&gt;
363         </screen>
364       </para>
365       <para>To check <literal>max_stripecount</literal>, run:
366         <screen>
367 mds# lctl get_param lod.$fsname-MDTxxxx-mdtlov.max_stripecount
368         </screen>
369       </para>
370       <para>To reset <literal>max_stripecount</literal>, run:
371         <screen>
372 mgs# lctl set_param -P -d lod.$fsname-MDTxxxx-mdtlov.max_stripecount
373         </screen>
374       </para>
375     </section>
376
377     <section remap="h3">
378       <title><indexterm>
379           <primary>striping</primary>
380           <secondary>on specific OST</secondary>
381         </indexterm>Creating a File on a Specific OST</title>
382       <para>You can use <literal>lfs setstripe</literal> to create a file on a specific OST. In the
383         following example, the file <literal>file1</literal> is created on the first OST (OST index
384         is 0).</para>
385       <screen>$ lfs setstripe --stripe-count 1 --index 0 file1
386 $ dd if=/dev/zero of=file1 count=1 bs=100M
387 1+0 records in
388 1+0 records out
389
390 $ lfs getstripe file1
391 /mnt/testfs/file1
392 lmm_stripe_count:   1
393 lmm_stripe_size:    1048576
394 lmm_pattern:        1
395 lmm_layout_gen:     0
396 lmm_stripe_offset:  0
397      obdidx    objid   objid    group
398      0         37364   0x91f4   0</screen>
399     </section>
400   </section>
401   <section xml:id="file_striping.lfs_getstripe">
402     <title><indexterm><primary>striping</primary><secondary>getting information</secondary></indexterm>Retrieving File Layout/Striping Information (<literal>getstripe</literal>)</title>
403     <para>The <literal>lfs getstripe</literal> command is used to display information that shows
404       over which OSTs a file is distributed. For each OST, the index and UUID is displayed, along
405       with the OST index and object ID for each stripe in the file. For directories, the default
406       settings for files created in that directory are displayed.</para>
407     <section remap="h3">
408       <title>Displaying the Current Stripe Size</title>
409       <para>To see the current stripe size for a Lustre file or directory, use the <literal>lfs
410           getstripe</literal> command. For example, to view information for a directory, enter a
411         command similar to:</para>
412       <screen>[client]# lfs getstripe /mnt/lustre </screen>
413       <para>This command produces output similar to:</para>
414       <screen>/mnt/lustre
415 (Default) stripe_count: 1 stripe_size: 1M stripe_offset: -1</screen>
416       <para>In this example, the default stripe count is <literal>1</literal> (data blocks are
417         striped over a single OST), the default stripe size is 1 MB, and the objects are created
418         over all available OSTs.</para>
419       <para>To view information for a file, enter a command similar to:</para>
420       <screen>$ lfs getstripe /mnt/lustre/foo
421 /mnt/lustre/foo
422 lmm_stripe_count:   1
423 lmm_stripe_size:    1048576
424 lmm_pattern:        1
425 lmm_layout_gen:     0
426 lmm_stripe_offset:  0
427   obdidx   objid    objid      group
428   2        835487   m0xcbf9f   0 </screen>
429       <para>In this example, the file is located on <literal>obdidx 2</literal>, which corresponds
430         to the OST <literal>lustre-OST0002</literal>. To see which node is serving that OST, run:
431         <screen>$ lctl get_param osc.lustre-OST0002-osc.ost_conn_uuid
432 osc.lustre-OST0002-osc.ost_conn_uuid=192.168.20.1@tcp</screen></para>
433     </section>
434     <section remap="h3">
435       <title>Inspecting the File Tree</title>
436       <para>To inspect an entire tree of files, use the <literal>lfs find</literal>  command:</para>
437       <screen>lfs find [--recursive | -r] <replaceable>file|directory</replaceable> ...</screen>
438     </section>
439         <section>
440       <title><indexterm>
441           <primary>striping</primary>
442           <secondary>remote directories</secondary>
443         </indexterm>Locating the MDT for a remote directory</title>
444       <para>Lustre can be configured with multiple MDTs in the same file
445         system. Each directory and file could be located on a different MDT.
446         To identify which MDT a given subdirectory is located, pass the
447         <literal>getstripe [--mdt-index|-M]</literal> parameter to
448         <literal>lfs</literal>. An example of this command is provided in
449         the section <xref linkend="lustremaint.rmremotedir"/>.</para>
450     </section>
451   </section>
452   <section xml:id="pfl" condition='l2A'>
453     <title><indexterm>
454         <primary>striping</primary>
455         <secondary>PFL</secondary>
456     </indexterm>Progressive File Layout(PFL)</title>
457     <para>The Lustre Progressive File Layout (PFL) feature simplifies the use
458       of Lustre so that users can expect reasonable performance for a variety of
459       normal file IO patterns without the need to explicitly understand their IO
460       model or Lustre usage details in advance. In particular, users do not
461       necessarily need to know the size or concurrency of output files in
462       advance of their creation and explicitly specify an optimal layout for
463       each file in order to achieve good performance for both highly concurrent
464       shared-single-large-file IO or parallel IO to many smaller per-process
465       files. </para>
466     <para>The layout of a PFL file is stored on disk as <literal>composite
467       layout</literal>. A PFL file is essentially an array of
468       <literal>sub-layout components</literal>, with each sub-layout component
469       being a plain layout covering different and non-overlapped extents of
470       the file. For PFL files, the file layout is composed of a series of
471       components, therefore it's possible that there are some file extents are
472       not described by any components.</para>
473     <para>An example of how data blocks of PFL files are mapped to OST objects
474       of components is shown in the following PFL object mapping diagram:</para>
475     <figure  xml:id="managinglayout.fig.pfl">
476       <title>PFL object mapping diagram</title>
477       <mediaobject>
478         <imageobject>
479           <imagedata scalefit="1" width="100%"
480           fileref="figures/PFL_object_mapping_diagram.png" />
481         </imageobject>
482         <textobject>
483           <phrase>PFL object mapping diagram</phrase>
484         </textobject>
485       </mediaobject>
486     </figure>
487     <para>The PFL file in <xref linkend="managinglayout.fig.pfl"/> has 3
488       components and shows the mapping for the blocks of a 2055MB file.
489       The stripe size for the first two components is 1MB, while the stripe size
490       for the third component is 4MB. The stripe count is increasing for each
491       successive component. The first component only has two 1MB blocks and the
492       single object has a size of 2MB. The second component holds the next 254MB
493       of the file spread over 4 separate OST objects in RAID-0, each one will
494       have a size of 256MB / 4 objects = 64MB per object. Note the first two
495       objects <literal>obj 2,0</literal> and <literal>obj 2,1</literal>
496       have a 1MB hole at the start where the data is stored in the first
497       component. The final component holds the next 1800MB spread over 32 OST
498       objects. There is a 256MB / 32 = 8MB hole at the start each one for the
499       data stored in the first two components. Each object will be
500       2048MB / 32 objects = 64MB per object, except the
501       <literal>obj 3,0</literal> that holds an extra 4MB chunk and
502       <literal>obj 3,1</literal> that holds an extra 3MB chunk. If more data
503       was written to the file, only the objects in component 3 would increase
504       in size.</para>
505     <para>When a file range with defined but not instantiated component is
506       accessed, clients will send a Layout Intent RPC to the MDT, and the MDT
507       would instantiate the objects of the components covering that range.
508     </para>
509     <para>Next, some commands for user to operate PFL files are introduced and
510       some examples of possible composite layout are illustrated as well.
511       Lustre provides commands
512       <literal>lfs setstripe</literal> and <literal>lfs migrate</literal> for
513       users to operate PFL files. <literal>lfs setstripe</literal> commands
514       are used to create PFL files, add or delete components to or from an
515       existing composite file; <literal>lfs migrate</literal> commands are used
516       to re-layout the data in existing files using the new layout parameter by
517       copying the data from the existing OST(s) to the new OST(s). Also,
518       as introduced in the previous sections, <literal>lfs getstripe</literal>
519       commands can be used to list the striping/component information for a
520       given PFL file, and <literal>lfs find</literal> commands can be used to
521       search the directory tree rooted at the given directory or file name for
522       the files that match the given PFL component parameters.</para>
523     <note><para>Using PFL files requires both the client and server to
524       understand the PFL file layout, which isn't available for Lustre 2.9 and
525       earlier. And it will not prevent older clients from accessing non-PFL
526       files in the filesystem.</para></note>
527     <section remap="h3">
528       <title><literal>lfs setstripe</literal></title>
529       <para><literal>lfs setstripe</literal> commands are used to create PFL
530         files, add or delete components to or from an existing composite file.
531         (Suppose we have 8 OSTs in the following examples and stripe size is 1MB
532         by default.)</para>
533       <section remap="h4">
534         <title>Create a PFL file</title>
535         <para><emphasis role="bold">Command</emphasis></para>
536         <screen>lfs setstripe
537 [--component-end|-E end1] [STRIPE_OPTIONS]
538 [--component-end|-E end2] [STRIPE_OPTIONS] ... <replaceable>filename</replaceable></screen>
539         <para>The <literal>-E</literal> option is used to specify the end offset
540           (in bytes or using a suffix “kMGTP”, e.g. 256M) of each component, and
541           it also indicates the following <literal>STRIPE_OPTIONS</literal> are
542           for this component. Each component defines the stripe pattern of the
543           file in the range of [start, end). The first component must start from
544           offset 0 and all components must be adjacent with each other, no holes
545           are allowed, so each extent will start at the end of previous extent.
546           A <literal>-1</literal> end offset or <literal>eof</literal> indicates
547           this is the last component extending to the end of file.</para>
548         <para><emphasis role="bold">Example</emphasis></para>
549         <screen>$ lfs setstripe -E 4M -c 1 -E 64M -c 4 -E -1 -c -1 -i 4 \
550 /mnt/testfs/create_comp</screen>
551         <para>This command creates a file with composite layout illustrated in
552           the following figure. The first component has 1 stripe and covers
553           [0, 4M), the second component has 4 stripes and covers [4M, 64M), and
554           the last component stripes start at OST4, cross over all available
555           OSTs and covers [64M, EOF).</para>
556         <figure  xml:id="managinglayout.fig.pfl_create">
557           <title>Example: create a composite file</title>
558           <mediaobject>
559             <imageobject>
560               <imagedata scalefit="1" depth="2.75in" align="center"
561               fileref="figures/PFL_createfile.png" />
562             </imageobject>
563             <textobject>
564               <phrase>Example: create a composite file</phrase>
565             </textobject>
566           </mediaobject>
567         </figure>
568         <para>The composite layout can be output by the following command:</para>
569         <screen>$ lfs getstripe /mnt/testfs/create_comp
570 /mnt/testfs/create_comp
571   lcm_layout_gen:  3
572   lcm_entry_count: 3
573     lcme_id:             1
574     lcme_flags:          init
575     lcme_extent.e_start: 0
576     lcme_extent.e_end:   4194304
577       lmm_stripe_count:  1
578       lmm_stripe_size:   1048576
579       lmm_pattern:       1
580       lmm_layout_gen:    0
581       lmm_stripe_offset: 0
582       lmm_objects:
583       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }
584
585     lcme_id:             2
586     lcme_flags:          0
587     lcme_extent.e_start: 4194304
588     lcme_extent.e_end:   67108864
589       lmm_stripe_count:  4
590       lmm_stripe_size:   1048576
591       lmm_pattern:       1
592       lmm_layout_gen:    0
593       lmm_stripe_offset: -1
594     lcme_id:             3
595     lcme_flags:          0
596     lcme_extent.e_start: 67108864
597     lcme_extent.e_end:   EOF
598       lmm_stripe_count:  -1
599       lmm_stripe_size:   1048576
600       lmm_pattern:       1
601       lmm_layout_gen:    0
602       lmm_stripe_offset: 4</screen>
603         <note><para>Only the first component’s OST objects of the PFL file are
604           instantiated when the layout is being set. Other instantiation is
605           delayed to later write/truncate operations.</para></note>
606         <para>If we write 128M data to this PFL file, the second and third
607           components will be instantiated:</para>
608         <screen>$ dd if=/dev/zero of=/mnt/testfs/create_comp bs=1M count=128
609 $ lfs getstripe /mnt/testfs/create_comp
610 /mnt/testfs/create_comp
611   lcm_layout_gen:  5
612   lcm_entry_count: 3
613     lcme_id:             1
614     lcme_flags:          init
615     lcme_extent.e_start: 0
616     lcme_extent.e_end:   4194304
617       lmm_stripe_count:  1
618       lmm_stripe_size:   1048576
619       lmm_pattern:       1
620       lmm_layout_gen:    0
621       lmm_stripe_offset: 0
622       lmm_objects:
623       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }
624
625     lcme_id:             2
626     lcme_flags:          init
627     lcme_extent.e_start: 4194304
628     lcme_extent.e_end:   67108864
629       lmm_stripe_count:  4
630       lmm_stripe_size:   1048576
631       lmm_pattern:       1
632       lmm_layout_gen:    0
633       lmm_stripe_offset: 1
634       lmm_objects:
635       - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x2:0x0] }
636       - 1: { l_ost_idx: 2, l_fid: [0x100020000:0x2:0x0] }
637       - 2: { l_ost_idx: 3, l_fid: [0x100030000:0x2:0x0] }
638       - 3: { l_ost_idx: 4, l_fid: [0x100040000:0x2:0x0] }
639
640     lcme_id:             3
641     lcme_flags:          init
642     lcme_extent.e_start: 67108864
643     lcme_extent.e_end:   EOF
644       lmm_stripe_count:  8
645       lmm_stripe_size:   1048576
646       lmm_pattern:       1
647       lmm_layout_gen:    0
648       lmm_stripe_offset: 4
649       lmm_objects:
650       - 0: { l_ost_idx: 4, l_fid: [0x100040000:0x3:0x0] }
651       - 1: { l_ost_idx: 5, l_fid: [0x100050000:0x2:0x0] }
652       - 2: { l_ost_idx: 6, l_fid: [0x100060000:0x2:0x0] }
653       - 3: { l_ost_idx: 7, l_fid: [0x100070000:0x2:0x0] }
654       - 4: { l_ost_idx: 0, l_fid: [0x100000000:0x3:0x0] }
655       - 5: { l_ost_idx: 1, l_fid: [0x100010000:0x3:0x0] }
656       - 6: { l_ost_idx: 2, l_fid: [0x100020000:0x3:0x0] }
657       - 7: { l_ost_idx: 3, l_fid: [0x100030000:0x3:0x0] }</screen>
658       </section>
659       <section remap="h4">
660         <title>Add component(s) to an existing composite file</title>
661         <para><emphasis role="bold">Command</emphasis></para>
662         <screen>lfs setstripe --component-add
663 [--component-end|-E end1] [STRIPE_OPTIONS]
664 [--component-end|-E end2] [STRIPE_OPTIONS] ... <replaceable>filename</replaceable></screen>
665         <para>The option <literal>--component-add</literal> is used to add
666           components to an existing composite file. The extent start of
667           the first component to be added is equal to the extent end of last
668           component in the existing file, and all components to be added must
669           be adjacent with each other.</para>
670         <note><para>If the last existing component is specified by
671           <literal>-E -1</literal> or <literal>-E eof</literal>, which covers
672           to the end of the file, it must be deleted before a new one is added.
673         </para></note>
674         <para><emphasis role="bold">Example</emphasis></para>
675         <screen>$ lfs setstripe -E 4M -c 1 -E 64M -c 4 /mnt/testfs/add_comp
676 $ lfs setstripe --component-add -E -1 -c 4 -o 6-7,0,5 \
677 /mnt/testfs/add_comp</screen>
678         <para>This command adds a new component which starts from the end of
679           the last existing component to the end of file. The layout of this
680           example is illustrated in
681           <xref linkend="managinglayout.fig.pfl_addcomp"/>. The last component
682           stripes across 4 OSTs in sequence OST6, OST7, OST0 and OST5, covers
683           [64M, EOF).</para>
684         <figure  xml:id="managinglayout.fig.pfl_addcomp">
685           <title>Example: add a component to an existing composite file</title>
686           <mediaobject>
687             <imageobject>
688               <imagedata scalefit="1" depth="2.75in" align="center"
689               fileref="figures/PFL_addcomp.png" />
690             </imageobject>
691             <textobject>
692               <phrase>Example: add a component to an existing composite file
693               </phrase>
694             </textobject>
695           </mediaobject>
696         </figure>
697         <para>The layout can be printed out by the following command:</para>
698         <screen>$ lfs getstripe /mnt/testfs/add_comp
699 /mnt/testfs/add_comp
700   lcm_layout_gen:  5
701   lcm_entry_count: 3
702     lcme_id:             1
703     lcme_flags:          init
704     lcme_extent.e_start: 0
705     lcme_extent.e_end:   4194304
706       lmm_stripe_count:  1
707       lmm_stripe_size:   1048576
708       lmm_pattern:       1
709       lmm_layout_gen:    0
710       lmm_stripe_offset: 0
711       lmm_objects:
712       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }
713
714     lcme_id:             2
715     lcme_flags:          init
716     lcme_extent.e_start: 4194304
717     lcme_extent.e_end:   67108864
718       lmm_stripe_count:  4
719       lmm_stripe_size:   1048576
720       lmm_pattern:       1
721       lmm_layout_gen:    0
722       lmm_stripe_offset: 1
723       lmm_objects:
724       - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x2:0x0] }
725       - 1: { l_ost_idx: 2, l_fid: [0x100020000:0x2:0x0] }
726       - 2: { l_ost_idx: 3, l_fid: [0x100030000:0x2:0x0] }
727       - 3: { l_ost_idx: 4, l_fid: [0x100040000:0x2:0x0] }
728
729     lcme_id:             5
730     lcme_flags:          0
731     lcme_extent.e_start: 67108864
732     lcme_extent.e_end:   EOF
733       lmm_stripe_count:  4
734       lmm_stripe_size:   1048576
735       lmm_pattern:       1
736       lmm_layout_gen:    0
737       lmm_stripe_offset: -1</screen>
738         <para>The component ID "lcme_id" changes as layout generation
739           changes. It is not necessarily sequential and does not imply ordering
740           of individual components.</para>
741         <note><para>Similar to specifying a full-file composite layout at file
742           creation time, <literal>--component-add</literal> won't instantiate
743           OST objects, the instantiation is delayed to later write/truncate
744           operations. For example, after writing beyond the 64MB start of the
745           file's last component, the new component has had objects allocated:
746         </para></note>
747         <screen>$ lfs getstripe -I5 /mnt/testfs/add_comp
748 /mnt/testfs/add_comp
749   lcm_layout_gen:  6
750   lcm_entry_count: 3
751     lcme_id:             5
752     lcme_flags:          init
753     lcme_extent.e_start: 67108864
754     lcme_extent.e_end:   EOF
755       lmm_stripe_count:  4
756       lmm_stripe_size:   1048576
757       lmm_pattern:       1
758       lmm_layout_gen:    0
759       lmm_stripe_offset: 6
760       lmm_objects:
761       - 0: { l_ost_idx: 6, l_fid: [0x100060000:0x4:0x0] }
762       - 1: { l_ost_idx: 7, l_fid: [0x100070000:0x4:0x0] }
763       - 2: { l_ost_idx: 0, l_fid: [0x100000000:0x5:0x0] }
764       - 3: { l_ost_idx: 5, l_fid: [0x100050000:0x4:0x0] }</screen>
765       </section>
766       <section remap="h4">
767         <title>Delete component(s) from an existing file</title>
768         <para><emphasis role="bold">Command</emphasis></para>
769         <screen>lfs setstripe --component-del
770 [--component-id|-I comp_id | --component-flags comp_flags]
771 <replaceable>filename</replaceable></screen>
772         <para>The option <literal>--component-del</literal> is used to remove
773           the component(s) specified by component ID or flags from an existing
774         file. Any data stored in the deleted component will be lost after
775         this operation.</para>
776         <para>The ID specified by <literal>-I</literal> option is the numerical
777           unique ID of the component, which can be obtained by command
778           <literal>lfs getstripe -I</literal> command, and the flag specified by
779           <literal>--component-flags</literal> option is a certain type of
780           components, which can be obtained by command
781           <literal>lfs getstripe --component-flags</literal>. For now, we only
782           have two flags <literal>init</literal> and <literal>^init</literal>
783           for instantiated and un-instantiated components respectively.</para>
784         <note><para>Deletion must start with the last component because creation
785         of a hole in the middle of a file layout is not allowed.</para></note>
786         <para><emphasis role="bold">Example</emphasis></para>
787         <screen>$ lfs getstripe -I /mnt/testfs/del_comp
788 1
789 2
790 5
791 $ lfs setstripe --component-del -I 5 /mnt/testfs/del_comp</screen>
792         <para>This example deletes the component with ID 5 from file
793           <literal>/mnt/testfs/del_comp</literal>. If we still use the last
794           example, the final result is illustrated in
795           <xref linkend="managinglayout.fig.pfl_delcomp"/>.</para>
796         <figure  xml:id="managinglayout.fig.pfl_delcomp">
797           <title>Example: delete a component from an existing file</title>
798           <mediaobject>
799             <imageobject>
800               <imagedata scalefit="1" depth="2.75in" align="center"
801               fileref="figures/PFL_delcomp.png" />
802             </imageobject>
803             <textobject>
804               <phrase>Example: delete a component from an existing file</phrase>
805             </textobject>
806           </mediaobject>
807         </figure>
808         <para>If you try to delete a non-last component, you will see the
809           following error:</para>
810         <screen>$ lfs setstripe -component-del -I 2 /mnt/testfs/del_comp
811 Delete component 0x2 from /mnt/testfs/del_comp failed. Invalid argument
812 error: setstripe: delete component of file '/mnt/testfs/del_comp' failed: Invalid argument</screen>
813       </section>
814       <section remap="h4">
815         <title>Set default PFL layout to an existing directory</title>
816         <para>Similar to create a PFL file, you can set default PFL layout to
817           an existing directory. After that, all the files created will inherit
818           this layout by default.</para>
819         <para><emphasis role="bold">Command</emphasis></para>
820         <screen>lfs setstripe
821 [--component-end|-E end1] [STRIPE_OPTIONS]
822 [--component-end|-E end2] [STRIPE_OPTIONS] ... <replaceable>dirname</replaceable></screen>
823         <para><emphasis role="bold">Example</emphasis></para>
824         <screen>
825 $ mkdir /mnt/testfs/pfldir
826 $ lfs setstripe -E 256M -c 1 -E 16G -c 4 -E -1 -S 4M -c -1 /mnt/testfs/pfldir
827 </screen>
828         <para>When you run <literal>lfs getstripe</literal>, you will see:
829         </para>
830         <screen>
831 $ lfs getstripe /mnt/testfs/pfldir
832 /mnt/testfs/pfldir
833   lcm_layout_gen:  0
834   lcm_entry_count: 3
835     lcme_id:             N/A
836     lcme_flags:          0
837     lcme_extent.e_start: 0
838     lcme_extent.e_end:   268435456
839       stripe_count:  1       stripe_size:   1048576       stripe_offset: -1
840     lcme_id:             N/A
841     lcme_flags:          0
842     lcme_extent.e_start: 268435456
843     lcme_extent.e_end:   17179869184
844       stripe_count:  4       stripe_size:   1048576       stripe_offset: -1
845     lcme_id:             N/A
846     lcme_flags:          0
847     lcme_extent.e_start: 17179869184
848     lcme_extent.e_end:   EOF
849       stripe_count:  -1       stripe_size:   4194304       stripe_offset: -1
850 </screen>
851         <para>If you create a file under <literal>/mnt/testfs/pfldir</literal>,
852           the layout of that file will inherit the layout from its parent
853           directory:</para>
854         <screen>
855 $ touch /mnt/testfs/pfldir/pflfile
856 $ lfs getstripe /mnt/testfs/pfldir/pflfile
857 /mnt/testfs/pfldir/pflfile
858   lcm_layout_gen:  2
859   lcm_entry_count: 3
860     lcme_id:             1
861     lcme_flags:          init
862     lcme_extent.e_start: 0
863     lcme_extent.e_end:   268435456
864       lmm_stripe_count:  1
865       lmm_stripe_size:   1048576
866       lmm_pattern:       raid0
867       lmm_layout_gen:    0
868       lmm_stripe_offset: 1
869       lmm_objects:
870       - 0: { l_ost_idx: 1, l_fid: [0x100010000:0xa:0x0] }
871
872     lcme_id:             2
873     lcme_flags:          0
874     lcme_extent.e_start: 268435456
875     lcme_extent.e_end:   17179869184
876       lmm_stripe_count:  4
877       lmm_stripe_size:   1048576
878       lmm_pattern:       raid0
879       lmm_layout_gen:    0
880       lmm_stripe_offset: -1
881
882     lcme_id:             3
883     lcme_flags:          0
884     lcme_extent.e_start: 17179869184
885     lcme_extent.e_end:   EOF
886       lmm_stripe_count:  -1
887       lmm_stripe_size:   4194304
888       lmm_pattern:       raid0
889       lmm_layout_gen:    0
890       lmm_stripe_offset: -1
891 </screen>
892         <note><para>
893           <literal>lfs setstripe --component-add/del</literal> can't be run
894           on a directory, because the default layout in directory is like a config,
895           which can be arbitrarily changed by <literal>lfs setstripe</literal>,
896           while the layout of a file may have data (OST objects) attached.
897           If you want to delete the default layout in a directory, run
898           <literal>lfs setstripe -d <replaceable>dirname</replaceable></literal>
899           to return the directory to the filesystem-wide defaults, like:
900         <screen>
901 $ lfs setstripe -d /mnt/testfs/pfldir
902 $ lfs getstripe -d /mnt/testfs/pfldir
903 /mnt/testfs/pfldir
904 stripe_count:  1 stripe_size:   1048576 stripe_offset: -1
905 /mnt/testfs/pfldir/commonfile
906 lmm_stripe_count:  1
907 lmm_stripe_size:   1048576
908 lmm_pattern:       1
909 lmm_layout_gen:    0
910 lmm_stripe_offset: 0
911         obdidx           objid           objid           group
912              2               9            0x9                0
913 </screen>
914         </para></note>
915       </section>
916     </section>
917     <section remap="h3">
918       <title><literal>lfs migrate</literal></title>
919       <para><literal>lfs migrate</literal> commands are used to re-layout the
920         data in the existing files with the new layout parameter by copying the
921         data from the existing OST(s) to the new OST(s).</para>
922       <para><emphasis role="bold">Command</emphasis></para>
923       <screen>lfs migrate [--component-end|-E comp_end] [STRIPE_OPTIONS] ...
924 <replaceable>filename</replaceable></screen>
925       <para>The difference between <literal>migrate</literal> and
926         <literal>setstripe</literal> is that <literal>migrate</literal> is to
927         re-layout the data in the existing files, while
928         <literal>setstripe</literal> is to create new files with the specified
929         layout.</para>
930       <para><emphasis role="bold">Example</emphasis></para>
931       <para><emphasis role="bold">Case1. Migrate a normal one to a composite
932         layout</emphasis></para>
933       <screen>$ lfs setstripe -c 1 -S 128K /mnt/testfs/norm_to_2comp
934 $ dd if=/dev/urandom of=/mnt/testfs/norm_to_2comp bs=1M count=5
935 $ lfs getstripe /mnt/testfs/norm_to_2comp --yaml
936 /mnt/testfs/norm_to_comp
937 lmm_stripe_count:  1
938 lmm_stripe_size:   131072
939 lmm_pattern:       1
940 lmm_layout_gen:    0
941 lmm_stripe_offset: 7
942 lmm_objects:
943       - l_ost_idx: 7
944         l_fid:     0x100070000:0x2:0x0
945 $ lfs migrate -E 1M -S 512K -c 1 -E -1 -S 1M -c 2 \
946 /mnt/testfs/norm_to_2comp</screen>
947       <para>In this example, a 5MB size file with 1 stripe and 128K stripe size
948         is migrated to a composite layout file with 2 components, illustrated in
949         <xref linkend="managinglayout.fig.pfl_norm_to_comp"/>.</para>
950       <figure  xml:id="managinglayout.fig.pfl_norm_to_comp">
951         <title>Example: migrate normal to composite</title>
952         <mediaobject>
953           <imageobject>
954             <imagedata scalefit="1" depth="2.75in" align="center"
955             fileref="figures/PFL_norm_to_comp.png" />
956           </imageobject>
957           <textobject>
958             <phrase>Example: migrate normal to composite</phrase>
959           </textobject>
960         </mediaobject>
961       </figure>
962       <para>The stripe information after migration is like:</para>
963       <screen>$ lfs getstripe /mnt/testfs/norm_to_2comp
964 /mnt/testfs/norm_to_2comp
965   lcm_layout_gen:  4
966   lcm_entry_count: 2
967     lcme_id:             1
968     lcme_flags:          init
969     lcme_extent.e_start: 0
970     lcme_extent.e_end:   1048576
971       lmm_stripe_count:  1
972       lmm_stripe_size:   524288
973       lmm_pattern:       1
974       lmm_layout_gen:    0
975       lmm_stripe_offset: 0
976       lmm_objects:
977       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }
978
979     lcme_id:             2
980     lcme_flags:          init
981     lcme_extent.e_start: 1048576
982     lcme_extent.e_end:   EOF
983       lmm_stripe_count:  2
984       lmm_stripe_size:   1048576
985       lmm_pattern:       1
986       lmm_layout_gen:    0
987       lmm_stripe_offset: 2
988       lmm_objects:
989       - 0: { l_ost_idx: 2, l_fid: [0x100020000:0x2:0x0] }
990       - 1: { l_ost_idx: 3, l_fid: [0x100030000:0x2:0x0] }</screen>
991       <para><emphasis role="bold">Case2. Migrate a composite layout to another
992         composite layout</emphasis></para>
993       <screen>$ lfs setstripe -E 1M -S 512K -c 1 -E -1 -S 1M -c 2 \
994 /mnt/testfs/2comp_to_3comp
995 $ dd if=/dev/urandom of=/mnt/testfs/norm_to_2comp bs=1M count=5
996 $ lfs migrate -E 1M -S 1M -c 2 -E 4M -S 1M -c 2 -E -1 -S 3M -c 3 \
997 /mnt/testfs/2comp_to_3comp</screen>
998       <para>In this example, a composite layout file with 2 components is
999         migrated a composite layout file with 3 components. If we still use
1000         the example in case1, the migration process is illustrated in
1001         <xref linkend="managinglayout.fig.pfl_comp_to_comp"/>.</para>
1002       <figure  xml:id="managinglayout.fig.pfl_comp_to_comp">
1003         <title>Example: migrate composite to composite</title>
1004         <mediaobject>
1005           <imageobject>
1006             <imagedata scalefit="1" depth="2.75in" align="center"
1007             fileref="figures/PFL_comp_to_comp.png" />
1008           </imageobject>
1009           <textobject>
1010             <phrase>Example: migrate composite to composite</phrase>
1011           </textobject>
1012         </mediaobject>
1013       </figure>
1014       <para>The stripe information is like:</para>
1015       <screen>$ lfs getstripe /mnt/testfs/2comp_to_3comp
1016 /mnt/testfs/2comp_to_3comp
1017   lcm_layout_gen:  6
1018   lcm_entry_count: 3
1019     lcme_id:             1
1020     lcme_flags:          init
1021     lcme_extent.e_start: 0
1022     lcme_extent.e_end:   1048576
1023       lmm_stripe_count:  2
1024       lmm_stripe_size:   1048576
1025       lmm_pattern:       1
1026       lmm_layout_gen:    0
1027       lmm_stripe_offset: 4
1028       lmm_objects:
1029       - 0: { l_ost_idx: 4, l_fid: [0x100040000:0x2:0x0] }
1030       - 1: { l_ost_idx: 5, l_fid: [0x100050000:0x2:0x0] }
1031
1032     lcme_id:             2
1033     lcme_flags:          init
1034     lcme_extent.e_start: 1048576
1035     lcme_extent.e_end:   4194304
1036       lmm_stripe_count:  2
1037       lmm_stripe_size:   1048576
1038       lmm_pattern:       1
1039       lmm_layout_gen:    0
1040       lmm_stripe_offset: 6
1041       lmm_objects:
1042       - 0: { l_ost_idx: 6, l_fid: [0x100060000:0x2:0x0] }
1043       - 1: { l_ost_idx: 7, l_fid: [0x100070000:0x3:0x0] }
1044
1045     lcme_id:             3
1046     lcme_flags:          init
1047     lcme_extent.e_start: 4194304
1048     lcme_extent.e_end:   EOF
1049       lmm_stripe_count:  3
1050       lmm_stripe_size:   3145728
1051       lmm_pattern:       1
1052       lmm_layout_gen:    0
1053       lmm_stripe_offset: 0
1054       lmm_objects:
1055       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x3:0x0] }
1056       - 1: { l_ost_idx: 1, l_fid: [0x100010000:0x2:0x0] }
1057       - 2: { l_ost_idx: 2, l_fid: [0x100020000:0x3:0x0] }</screen>
1058       <para><emphasis role="bold">Case3. Migrate a composite layout to a
1059         normal one</emphasis></para>
1060       <screen>$ lfs migrate -E 1M -S 1M -c 2 -E 4M -S 1M -c 2 -E -1 -S 3M -c 3 \
1061 /mnt/testfs/3comp_to_norm
1062 $ dd if=/dev/urandom of=/mnt/testfs/norm_to_2comp bs=1M count=5
1063 $ lfs migrate -c 2 -S 2M /mnt/testfs/3comp_to_normal</screen>
1064       <para>In this example, a composite file with 3 components is migrated to
1065         a normal file with 2 stripes and 2M stripe size. If we still use the
1066         example in Case2, the migration process is illustrated in
1067         <xref linkend="managinglayout.fig.pfl_comp_to_norm"/>.</para>
1068       <figure  xml:id="managinglayout.fig.pfl_comp_to_norm">
1069         <title>Example: migrate composite to normal</title>
1070         <mediaobject>
1071           <imageobject>
1072             <imagedata scalefit="1" depth="2.75in" align="center"
1073             fileref="figures/PFL_comp_to_norm.png" />
1074           </imageobject>
1075           <textobject>
1076             <phrase>Example: migrate composite to normal</phrase>
1077           </textobject>
1078         </mediaobject>
1079       </figure>
1080       <para>The stripe information is like:</para>
1081       <screen>$ lfs getstripe /mnt/testfs/3comp_to_norm --yaml
1082 /mnt/testfs/3comp_to_norm
1083 lmm_stripe_count:  2
1084 lmm_stripe_size:   2097152
1085 lmm_pattern:       1
1086 lmm_layout_gen:    7
1087 lmm_stripe_offset: 4
1088 lmm_objects:
1089       - l_ost_idx: 4
1090         l_fid:     0x100040000:0x3:0x0
1091       - l_ost_idx: 5
1092         l_fid:     0x100050000:0x3:0x0</screen>
1093     </section>
1094     <section remap="h3">
1095       <title><literal>lfs getstripe</literal></title>
1096       <para><literal>lfs getstripe</literal> commands can be used to list the
1097         striping/component information for a given PFL file. Here, only those
1098         parameters new for PFL files are shown.</para>
1099       <para><emphasis role="bold">Command</emphasis></para>
1100       <screen>lfs getstripe
1101 [--component-id|-I [comp_id]]
1102 [--component-flags [comp_flags]]
1103 [--component-count]
1104 [--component-start [+-][N][kMGTPE]]
1105 [--component-end|-E [+-][N][kMGTPE]]
1106 <replaceable>dirname|filename</replaceable></screen>
1107       <para><emphasis role="bold">Example</emphasis></para>
1108       <para>Suppose we already have a composite file
1109         <literal>/mnt/testfs/3comp</literal>, created by the following
1110         command:</para>
1111       <screen>$ lfs setstripe -E 4M -c 1 -E 64M -c 4 -E -1 -c -1 -i 4 \
1112 /mnt/testfs/3comp</screen>
1113       <para>And write some data</para>
1114       <screen>$ dd if=/dev/zero of=/mnt/testfs/3comp bs=1M count=5</screen>
1115       <para><emphasis role="bold">Case1. List component ID and its related
1116         information</emphasis></para>
1117       <itemizedlist>
1118         <listitem>
1119           <para>List all the components ID</para>
1120           <screen>$ lfs getstripe -I /mnt/testfs/3comp
1121 1
1122 2
1123 3</screen>
1124         </listitem>
1125         <listitem>
1126           <para>List the detailed striping information of component ID=2</para>
1127           <screen>$ lfs getstripe -I2 /mnt/testfs/3comp
1128 /mnt/testfs/3comp
1129   lcm_layout_gen:  4
1130   lcm_entry_count: 3
1131     lcme_id:             2
1132     lcme_flags:          init
1133     lcme_extent.e_start: 4194304
1134     lcme_extent.e_end:   67108864
1135       lmm_stripe_count:  4
1136       lmm_stripe_size:   1048576
1137       lmm_pattern:       1
1138       lmm_layout_gen:    0
1139       lmm_stripe_offset: 5
1140       lmm_objects:
1141       - 0: { l_ost_idx: 5, l_fid: [0x100050000:0x2:0x0] }
1142       - 1: { l_ost_idx: 6, l_fid: [0x100060000:0x2:0x0] }
1143       - 2: { l_ost_idx: 7, l_fid: [0x100070000:0x2:0x0] }
1144       - 3: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }</screen>
1145         </listitem>
1146         <listitem>
1147           <para>List the stripe offset and stripe count of component ID=2</para>
1148           <screen>$ lfs getstripe -I2 -i -c /mnt/testfs/3comp
1149       lmm_stripe_count:  4
1150       lmm_stripe_offset: 5</screen>
1151         </listitem>
1152       </itemizedlist>
1153       <para><emphasis role="bold">Case2. List the component which contains the
1154         specified flag</emphasis></para>
1155       <itemizedlist>
1156         <listitem>
1157           <para>List the flag of each component</para>
1158           <screen>$ lfs getstripe -component-flag -I /mnt/testfs/3comp
1159     lcme_id:             1
1160     lcme_flags:          init
1161     lcme_id:             2
1162     lcme_flags:          init
1163     lcme_id:             3
1164     lcme_flags:          0</screen>
1165         </listitem>
1166         <listitem>
1167           <para>List component(s) who is not instantiated</para>
1168           <screen>$ lfs getstripe --component-flags=^init /mnt/testfs/3comp
1169 /mnt/testfs/3comp
1170   lcm_layout_gen:  4
1171   lcm_entry_count: 3
1172     lcme_id:             3
1173     lcme_flags:          0
1174     lcme_extent.e_start: 67108864
1175     lcme_extent.e_end:   EOF
1176       lmm_stripe_count:  -1
1177       lmm_stripe_size:   1048576
1178       lmm_pattern:       1
1179       lmm_layout_gen:    4
1180       lmm_stripe_offset: 4</screen>
1181         </listitem>
1182       </itemizedlist>
1183       <para><emphasis role="bold">Case3. List the total number of all the
1184         component(s)</emphasis></para>
1185       <itemizedlist>
1186         <listitem>
1187           <para>List the total number of all the components</para>
1188           <screen>$ lfs getstripe --component-count /mnt/testfs/3comp
1189 3</screen>
1190         </listitem>
1191       </itemizedlist>
1192       <para><emphasis role="bold">Case4. List the component with the specified
1193         extent start or end positions</emphasis></para>
1194       <itemizedlist>
1195         <listitem>
1196           <para>List the start position in bytes of each component</para>
1197           <screen>$ lfs getstripe --component-start /mnt/testfs/3comp
1198 0
1199 4194304
1200 67108864</screen>
1201         </listitem>
1202         <listitem>
1203           <para>List the start position in bytes of component ID=3</para>
1204           <screen>$ lfs getstripe --component-start -I3 /mnt/testfs/3comp
1205 67108864</screen>
1206         </listitem>
1207         <listitem>
1208           <para>List the component with start = 64M</para>
1209           <screen>$ lfs getstripe --component-start=64M /mnt/testfs/3comp
1210 /mnt/testfs/3comp
1211   lcm_layout_gen:  4
1212   lcm_entry_count: 3
1213     lcme_id:             3
1214     lcme_flags:          0
1215     lcme_extent.e_start: 67108864
1216     lcme_extent.e_end:   EOF
1217       lmm_stripe_count:  -1
1218       lmm_stripe_size:   1048576
1219       lmm_pattern:       1
1220       lmm_layout_gen:    4
1221       lmm_stripe_offset: 4</screen>
1222         </listitem>
1223         <listitem>
1224           <para>List the component(s) with start &gt; 5M</para>
1225           <screen>$ lfs getstripe --component-start=+5M /mnt/testfs/3comp
1226 /mnt/testfs/3comp
1227   lcm_layout_gen:  4
1228   lcm_entry_count: 3
1229     lcme_id:             3
1230     lcme_flags:          0
1231     lcme_extent.e_start: 67108864
1232     lcme_extent.e_end:   EOF
1233       lmm_stripe_count:  -1
1234       lmm_stripe_size:   1048576
1235       lmm_pattern:       1
1236       lmm_layout_gen:    4
1237       lmm_stripe_offset: 4</screen>
1238         </listitem>
1239         <listitem>
1240           <para>List the component(s) with start &lt; 5M</para>
1241           <screen>$ lfs getstripe --component-start=-5M /mnt/testfs/3comp
1242 /mnt/testfs/3comp
1243   lcm_layout_gen:  4
1244   lcm_entry_count: 3
1245     lcme_id:             1
1246     lcme_flags:          init
1247     lcme_extent.e_start: 0
1248     lcme_extent.e_end:   4194304
1249       lmm_stripe_count:  1
1250       lmm_stripe_size:   1048576
1251       lmm_pattern:       1
1252       lmm_layout_gen:    0
1253       lmm_stripe_offset: 4
1254       lmm_objects:
1255       - 0: { l_ost_idx: 4, l_fid: [0x100040000:0x2:0x0] }
1256
1257     lcme_id:             2
1258     lcme_flags:          init
1259     lcme_extent.e_start: 4194304
1260     lcme_extent.e_end:   67108864
1261       lmm_stripe_count:  4
1262       lmm_stripe_size:   1048576
1263       lmm_pattern:       1
1264       lmm_layout_gen:    0
1265       lmm_stripe_offset: 5
1266       lmm_objects:
1267       - 0: { l_ost_idx: 5, l_fid: [0x100050000:0x2:0x0] }
1268       - 1: { l_ost_idx: 6, l_fid: [0x100060000:0x2:0x0] }
1269       - 2: { l_ost_idx: 7, l_fid: [0x100070000:0x2:0x0] }
1270       - 3: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }</screen>
1271         </listitem>
1272         <listitem>
1273           <para>List the component(s) with start &gt; 3M and end &lt; 70M</para>
1274           <screen>$ lfs getstripe --component-start=+3M --component-end=-70M \
1275 /mnt/testfs/3comp
1276 /mnt/testfs/3comp
1277   lcm_layout_gen:  4
1278   lcm_entry_count: 3
1279     lcme_id:             2
1280     lcme_flags:          init
1281     lcme_extent.e_start: 4194304
1282     lcme_extent.e_end:   67108864
1283       lmm_stripe_count:  4
1284       lmm_stripe_size:   1048576
1285       lmm_pattern:       1
1286       lmm_layout_gen:    0
1287       lmm_stripe_offset: 5
1288       lmm_objects:
1289       - 0: { l_ost_idx: 5, l_fid: [0x100050000:0x2:0x0] }
1290       - 1: { l_ost_idx: 6, l_fid: [0x100060000:0x2:0x0] }
1291       - 2: { l_ost_idx: 7, l_fid: [0x100070000:0x2:0x0] }
1292       - 3: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }</screen>
1293         </listitem>
1294       </itemizedlist>
1295     </section>
1296     <section remap="h3">
1297       <title><literal>lfs find</literal></title>
1298       <para><literal>lfs find</literal> commands can be used to search the
1299         directory tree rooted at the given directory or file name for the files
1300         that match the given PFL component parameters. Here, only those
1301         parameters new for PFL files are shown. Their usages are similar to
1302         <literal>lfs getstripe</literal> commands.</para>
1303       <para><emphasis role="bold">Command</emphasis></para>
1304       <screen>lfs find <replaceable>directory|filename</replaceable>
1305 [[!] --component-count [+-=]<replaceable>comp_cnt</replaceable>]
1306 [[!] --component-start [+-=]<replaceable>N</replaceable>[kMGTPE]]
1307 [[!] --component-end|-E [+-=]<replaceable>N</replaceable>[kMGTPE]]
1308 [[!] --component-flags=<replaceable>comp_flags</replaceable>]</screen>
1309       <note><para>If you use <literal>--component-xxx</literal> options, only
1310         the composite files will be searched; but if you use
1311         <literal>! --component-xxx</literal> options, all the files will be
1312         searched.</para></note>
1313       <para><emphasis role="bold">Example</emphasis></para>
1314       <para>We use the following directory and composite files to show how
1315         <literal>lfs find</literal> works.</para>
1316         <screen>$ mkdir /mnt/testfs/testdir
1317 $ lfs setstripe -E 1M -E 10M -E eof /mnt/testfs/testdir/3comp
1318 $ lfs setstripe -E 4M -E 20M -E 30M -E eof /mnt/testfs/testdir/4comp
1319 $ mkdir -p /mnt/testfs/testdir/dir_3comp
1320 $ lfs setstripe -E 6M -E 30M -E eof /mnt/testfs/testdir/dir_3comp
1321 $ lfs setstripe -E 8M -E eof /mnt/testfs/testdir/dir_3comp/2comp
1322 $ lfs setstripe -c 1 /mnt/testfs/testdir/dir_3comp/commnfile</screen>
1323       <para><emphasis role="bold">Case1. Find the files that match the specified
1324         component count condition</emphasis></para>
1325       <para>Find the files under directory /mnt/testfs/testdir whose number of
1326         components is not equal to 3.</para>
1327       <screen>$ lfs find /mnt/testfs/testdir ! --component-count=3
1328 /mnt/testfs/testdir
1329 /mnt/testfs/testdir/4comp
1330 /mnt/testfs/testdir/dir_3comp/2comp
1331 /mnt/testfs/testdir/dir_3comp/commonfile</screen>
1332       <para><emphasis role="bold">Case2. Find the files/dirs that match the
1333         specified component start/end condition</emphasis></para>
1334       <para>Find the file(s) under directory /mnt/testfs/testdir with component
1335         start = 4M and end &lt; 70M</para>
1336       <screen>$ lfs find /mnt/testfs/testdir --component-start=4M -E -30M
1337 /mnt/testfs/testdir/4comp</screen>
1338       <para><emphasis role="bold">Case3. Find the files/dirs that match the
1339         specified component flag condition</emphasis></para>
1340       <para>Find the file(s) under directory /mnt/testfs/testdir whose component
1341         flags contain <literal>init</literal></para>
1342       <screen>$ lfs find /mnt/testfs/testdir --component-flag=init
1343 /mnt/testfs/testdir/3comp
1344 /mnt/testfs/testdir/4comp
1345 /mnt/testfs/testdir/dir_3comp/2comp</screen>
1346       <note><para>Since <literal>lfs find</literal> uses
1347         &quot;<literal>!</literal>&quot; to do negative search, we don’t support
1348         flag <literal>^init</literal> here.</para></note>
1349     </section>
1350   </section>
1351
1352   <section xml:id="striping.sel" condition='l2D'>
1353     <title>
1354       <indexterm><primary>striping</primary><secondary>SEL</secondary>
1355       </indexterm>Self-Extending Layout (SEL)</title>
1356     <para>The Lustre Self-Extending Layout (SEL) feature is an extension of the
1357     <xref linkend="pfl"/> feature, which allows the MDS to change the defined
1358     PFL layout dynamically. With this feature, the MDS monitors the used space
1359     on OSTs and swaps the OSTs for the current file when they are low on space.
1360     This avoids <literal>ENOSPC</literal> problems for SEL files when
1361     applications are writing to them.</para>
1362     <para>Whereas PFL delays the instantiation of some components until an IO
1363     operation occurs on this region, SEL allows splitting such non-instantiated
1364     components in two parts: an “extendable” component and an “extension”
1365     component.  The extendable component is a regular PFL component, covering
1366     just a part of the region, which is small originally. The extension (or SEL)
1367     component is a new component type which is always non-instantiated and
1368     unassigned, covering the other part of the region. When a write reaches this
1369     unassigned space, and the client calls the MDS to have it instantiated, the
1370     MDS makes a decision as to whether to grant additional space to the extendable
1371     component.  The granted region moves from the head of the extension
1372     component to the tail of the extendable component, thus the extendable
1373     component grows and the SEL one is shortened.  Therefore, it allows the file
1374     to continue on the same OSTs, or in the case where space is low on one of
1375     the current OSTs, to modify the layout to switch to a new component on new
1376     OSTs. In particular, it lets IO automatically spill over to a large HDD OST
1377     pool once a small SSD OST pool is getting low on space.</para>
1378     <para>The default extension policy modifies the layout in the following
1379     ways:</para>
1380     <orderedlist numeration="arabic">
1381       <listitem>
1382         <para>Extension: continue on the same OSTs – used when not low on space
1383         on any of the OSTs of the current component; a particular extent is
1384         granted to the extendable component.</para>
1385       </listitem>
1386       <listitem>
1387         <para>Spill over: switch to next component OSTs – it is used only for
1388         not the last component when <emphasis>at least one</emphasis>
1389         of the current OSTs is low on space; the whole region of the SEL
1390         component moves to the next component and the SEL component is removed
1391         in its turn.</para>
1392       </listitem>
1393       <listitem>
1394       <para>Repeating: create a new component with the same layout but on
1395         free OSTs – it is used only for the last component when <emphasis>
1396         at least one</emphasis> of the current OSTs is low on space; a new
1397         component has the same layout but instantiated on different OSTs (from
1398         the same pool) which have enough space.</para>
1399       </listitem>
1400       <listitem>
1401         <para>Forced extension: continue with the current component OSTs despite
1402         the low on space condition – it is used only for the last component when
1403         a repeating attempt detected low on space condition as well - spillover
1404         is impossible and there is no sense in the repeating.</para>
1405       </listitem>
1406       <listitem>
1407         <para>Each spill event increments the <literal>spill_hit</literal>
1408         counter, which can be accessed with:
1409         <literal>lctl lod.*.<replaceable>POOLNAME</replaceable>.spill_hit</literal></para>
1410       </listitem>
1411     </orderedlist>
1412     <note><para>The SEL feature does not require clients to understand the SEL
1413     format of already created files, only the MDS support is needed which is
1414     introduced in Lustre 2.13.  However, old clients will have some limitations
1415     as the Lustre tools will not support it.</para></note>
1416     <section>
1417       <title><literal>lfs setstripe</literal></title>
1418       <para>The <literal>lfs setstripe</literal> command is used to create files
1419       with composite layouts, as well as add or delete components to or from an
1420       existing file. It is extended to support SEL components.</para>
1421       <section>
1422         <title>Create a SEL file</title>
1423         <para><emphasis role="bold">Command</emphasis></para>
1424         <screen>lfs setstripe
1425 [--component-end|-E end1] [STRIPE_OPTIONS] ... <replaceable>FILENAME</replaceable>
1426
1427 STRIPE OPTIONS:
1428 --extension-size, --ext-size, -z &lt;ext_size&gt;</screen>
1429         <para>The <literal>-z</literal> option is added to specify the size of
1430         the region which is granted to the extendable component on each
1431         iteration. While declaring any component, this option turns the declared
1432         component to a pair of components: extendable and extension ones.</para>
1433         <para><emphasis role="bold">Example</emphasis></para>
1434         <para>The following command creates 2 pairs of extendable and
1435         extension components:
1436         <screen># lfs setstripe -E 1G -z 64M -E -1 -z 256M /mnt/lustre/file</screen>
1437         <figure  xml:id="managinglayout.fig.sel_createfile">
1438           <title>Example: create a SEL file</title>
1439           <mediaobject>
1440             <imageobject>
1441               <imagedata scalefit="1" depth="0.8in" align="center"
1442               fileref="figures/SEL_Createfile.png" />
1443             </imageobject>
1444             <textobject>
1445               <phrase>Example: create a SEL file</phrase>
1446             </textobject>
1447           </mediaobject>
1448         </figure>
1449         </para>
1450         <note><para>As usual, only the first PFL component is instantiated at
1451         the creation time, thus it is immediately extended to the extension
1452         size (64M for the first component), whereas the third component is left
1453         zero-length.</para></note>
1454         <screen># lfs getstripe /mnt/lustre/file
1455 /mnt/lustre/file
1456   lcm_layout_gen: 4
1457   lcm_mirror_count: 1
1458   lcm_entry_count: 4
1459     lcme_id: 1
1460     lcme_mirror_id: 0
1461     lcme_flags: init
1462     lcme_extent.e_start: 0
1463     lcme_extent.e_end: 67108864
1464       lmm_stripe_count: 1
1465       lmm_stripe_size: 1048576
1466       lmm_pattern: raid0
1467       lmm_layout_gen: 0
1468       lmm_stripe_offset: 0
1469       lmm_objects:
1470       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x5:0x0] }
1471
1472     lcme_id: 2
1473     lcme_mirror_id: 0
1474     lcme_flags: extension
1475     lcme_extent.e_start: 67108864
1476     lcme_extent.e_end: 1073741824
1477       lmm_stripe_count: 0
1478       lmm_extension_size: 67108864
1479       lmm_pattern: raid0
1480       lmm_layout_gen: 0
1481       lmm_stripe_offset: -1
1482
1483     lcme_id: 3
1484     lcme_mirror_id: 0
1485     lcme_flags: 0
1486     lcme_extent.e_start: 1073741824
1487     lcme_extent.e_end: 1073741824
1488       lmm_stripe_count: 1
1489       lmm_stripe_size: 1048576
1490       lmm_pattern: raid0
1491       lmm_layout_gen: 0
1492       lmm_stripe_offset: -1
1493
1494     lcme_id: 4
1495     lcme_mirror_id: 0
1496     lcme_flags: extension
1497     lcme_extent.e_start: 1073741824
1498     lcme_extent.e_end: EOF
1499       lmm_stripe_count: 0
1500       lmm_extension_size: 268435456
1501       lmm_pattern: raid0
1502       lmm_layout_gen: 0
1503       lmm_stripe_offset: -1</screen>
1504       </section>
1505       <section>
1506         <title>Create a SEL layout template</title>
1507         <para>Similar to PFL, it is possible to set a SEL layout template to
1508         a directory. After that, all the files created under it will inherit this
1509         layout by default.</para>
1510         <screen># lfs setstripe -E 1G -z 64M -E -1 -z 256M /mnt/lustre/dir
1511 # ./lustre/utils/lfs getstripe  /mnt/lustre/dir
1512 /mnt/lustre/dir
1513   lcm_layout_gen:    0
1514   lcm_mirror_count:  1
1515   lcm_entry_count:   4
1516     lcme_id:             N/A
1517     lcme_mirror_id:      N/A
1518     lcme_flags:          0
1519     lcme_extent.e_start: 0
1520     lcme_extent.e_end:   67108864
1521       stripe_count:  1       stripe_size:   1048576       pattern:       raid0       stripe_offset: -1
1522
1523     lcme_id:             N/A
1524     lcme_mirror_id:      N/A
1525     lcme_flags:          extension
1526     lcme_extent.e_start: 67108864
1527     lcme_extent.e_end:   1073741824
1528       stripe_count:  1       extension_size: 67108864       pattern:       raid0       stripe_offset: -1
1529
1530     lcme_id:             N/A
1531     lcme_mirror_id:      N/A
1532     lcme_flags:          0
1533     lcme_extent.e_start: 1073741824
1534     lcme_extent.e_end:   1073741824
1535       stripe_count:  1       stripe_size:   1048576       pattern:       raid0       stripe_offset: -1
1536
1537     lcme_id:             N/A
1538     lcme_mirror_id:      N/A
1539     lcme_flags:          extension
1540     lcme_extent.e_start: 1073741824
1541     lcme_extent.e_end:   EOF
1542       stripe_count:  1       extension_size: 268435456       pattern:       raid0       stripe_offset: -1
1543         </screen>
1544       </section>
1545     </section>
1546     <section>
1547       <title><literal>lfs getstripe</literal></title>
1548       <para><literal>lfs getstripe</literal> commands can be used to list the
1549       striping/component information for a given SEL file. Here, only those parameters
1550       new for SEL files are shown.</para>
1551       <para><emphasis role="bold">Command</emphasis></para>
1552       <screen>lfs getstripe
1553 [--extension-size|--ext-size|-z] <replaceable>filename</replaceable></screen>
1554       <para>The <literal>-z</literal> option is added to print the extension
1555       size in bytes. For composite files this is the extension size of the
1556       first extension component. If a particular component is identified by
1557       other options (<literal>--component-id, --component-start</literal>,
1558       etc...), this component extension size is printed.</para>
1559       <para><emphasis role="bold">Example 1: List a SEL component information
1560       </emphasis></para>
1561       <para>Suppose we already have a composite file
1562         <literal>/mnt/lustre/file</literal>, created by the following command:</para>
1563       <screen># lfs setstripe -E 1G -z 64M -E -1 -z 256M /mnt/lustre/file</screen>
1564       <para>The 2nd component could be listed with the following command:</para>
1565       <screen># lfs getstripe -I2 /mnt/lustre/file
1566 /mnt/lustre/file
1567   lcm_layout_gen: 4
1568   lcm_mirror_count: 1
1569   lcm_entry_count: 4
1570     lcme_id: 2
1571     lcme_mirror_id: 0
1572     lcme_flags: extension
1573     lcme_extent.e_start: 67108864
1574     lcme_extent.e_end: 1073741824
1575       lmm_stripe_count: 0
1576       lmm_extension_size: 67108864
1577       lmm_pattern: raid0
1578       lmm_layout_gen: 0
1579       lmm_stripe_offset: -1
1580       </screen>
1581       <note><para>As you can see the SEL components are marked by the <literal>
1582       extension</literal> flag and <literal>lmm_extension_size</literal> field
1583       keeps the specified extension size.</para></note>
1584       <para><emphasis role="bold">Example 2: List the extension size</emphasis></para>
1585       <para>Having the same file as in the above example, the extension size of
1586       the second component could be listed with:</para>
1587       <screen># lfs getstripe -z -I2 /mnt/lustre/file
1588 67108864</screen>
1589       <para><emphasis role="bold">Example 3: Extension</emphasis></para>
1590       <para>Having the same file as in the above example, suppose there is a
1591       write which crosses the end of the first component (64M), and then another
1592       write another write which crosses the end of the first component (128M) again,
1593       the layout changes as following:</para>
1594       <figure  xml:id="managinglayout.fig.sel_extension">
1595         <title>Example: an extension of a SEL file</title>
1596         <mediaobject>
1597           <imageobject>
1598             <imagedata scalefit="1" depth="3.5in" align="center"
1599             fileref="figures/SEL_extension.png" />
1600           </imageobject>
1601           <textobject>
1602             <phrase>Example: an extension of a SEL file</phrase>
1603           </textobject>
1604         </mediaobject>
1605       </figure>
1606       <para>The layout can be printed out by the following command:</para>
1607       <screen># lfs getstripe /mnt/lustre/file
1608 /mnt/lustre/file
1609   lcm_layout_gen: 6
1610   lcm_mirror_count: 1
1611   lcm_entry_count: 4
1612     lcme_id: 1
1613     lcme_mirror_id: 0
1614     lcme_flags: init
1615     lcme_extent.e_start: 0
1616     lcme_extent.e_end: 201326592
1617       lmm_stripe_count: 1
1618       lmm_stripe_size: 1048576
1619       lmm_pattern: raid0
1620       lmm_layout_gen: 0
1621       lmm_stripe_offset: 0
1622       lmm_objects:
1623       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x5:0x0] }
1624
1625     lcme_id: 2
1626     lcme_mirror_id: 0
1627     lcme_flags: extension
1628     lcme_extent.e_start: 201326592
1629     lcme_extent.e_end: 1073741824
1630       lmm_stripe_count: 0
1631       lmm_extension_size: 67108864
1632       lmm_pattern: raid0
1633       lmm_layout_gen: 0
1634       lmm_stripe_offset: -1
1635
1636     lcme_id: 3
1637     lcme_mirror_id: 0
1638     lcme_flags: 0
1639     lcme_extent.e_start: 1073741824
1640     lcme_extent.e_end: 1073741824
1641       lmm_stripe_count: 1
1642       lmm_stripe_size: 1048576
1643       lmm_pattern: raid0
1644       lmm_layout_gen: 0
1645       lmm_stripe_offset: -1
1646
1647     lcme_id: 4
1648     lcme_mirror_id: 0
1649     lcme_flags: extension
1650     lcme_extent.e_start: 1073741824
1651     lcme_extent.e_end: EOF
1652       lmm_stripe_count: 0
1653       lmm_extension_size: 268435456
1654       lmm_pattern: raid0
1655       lmm_layout_gen: 0
1656       lmm_stripe_offset: -1</screen>
1657       <para><emphasis role="bold">Example 4: Spillover</emphasis></para>
1658       <para>In case where <literal>OST0</literal> is low on space and an IO
1659       happens to a SEL component, a spillover happens: the full region of the
1660       SEL component is added to the next component, e.g. in the example above
1661       the next layout modification will look like:</para>
1662       <figure  xml:id="managinglayout.fig.sel_spillover">
1663         <title>Example: a spillover in a SEL file</title>
1664         <mediaobject>
1665           <imageobject>
1666             <imagedata scalefit="1" depth="2.25in" align="center"
1667             fileref="figures/SEL_spillover.png" />
1668           </imageobject>
1669           <textobject>
1670             <phrase>Example: a spillover in a SEL file</phrase>
1671           </textobject>
1672         </mediaobject>
1673       </figure>
1674       <note><para>Despite the fact the third component was [1G, 1G] originally,
1675       while it is not instantiated, instead of getting extended backward, it is
1676       moved backward to the start of the previous SEL component (192M) and
1677       extended on its extension size (256M) from that position, thus it becomes
1678       <literal>[192M, 448M]</literal>.</para></note>
1679       <screen># lfs getstripe /mnt/lustre/file
1680 /mnt/lustre/file
1681   lcm_layout_gen: 7
1682   lcm_mirror_count: 1
1683   lcm_entry_count: 3
1684     lcme_id: 1
1685     lcme_mirror_id: 0
1686     lcme_flags: init
1687     lcme_extent.e_start: 0
1688     lcme_extent.e_end: 201326592
1689       lmm_stripe_count: 1
1690       lmm_stripe_size: 1048576
1691       lmm_pattern: raid0
1692       lmm_layout_gen: 0
1693       lmm_stripe_offset: 0
1694       lmm_objects:
1695       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x5:0x0] }
1696
1697     lcme_id: 3
1698     lcme_mirror_id: 0
1699     lcme_flags: init
1700     lcme_extent.e_start: 201326592
1701     lcme_extent.e_end: 469762048
1702       lmm_stripe_count: 1
1703       lmm_stripe_size: 1048576
1704       lmm_pattern: raid0
1705       lmm_layout_gen: 0
1706       lmm_stripe_offset: 1
1707       lmm_objects:
1708       - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x8:0x0] }
1709
1710     lcme_id: 4
1711     lcme_mirror_id: 0
1712     lcme_flags: extension
1713     lcme_extent.e_start: 469762048
1714     lcme_extent.e_end: EOF
1715       lmm_stripe_count: 0
1716       lmm_extension_size: 268435456
1717       lmm_pattern: raid0
1718       lmm_layout_gen: 0
1719       lmm_stripe_offset: -1</screen>
1720       <para><emphasis role="bold">Example 5: Repeating</emphasis></para>
1721       <para>Suppose in the example above, <literal>OST0</literal> got
1722       enough free space back but <literal>OST1</literal> is low on space,
1723       the following write to the last SEL component leads to a new component
1724       allocation before the SEL component, which repeats the previous
1725       component layout but instantiated on free OSTs:</para>
1726       <figure  xml:id="managinglayout.fig.sel_repeat">
1727         <title>Example: repeat a SEL component</title>
1728         <mediaobject>
1729           <imageobject>
1730             <imagedata scalefit="1" depth="2.25in" align="center"
1731             fileref="figures/SEL_repeating.png" />
1732           </imageobject>
1733           <textobject>
1734             <phrase>Example: repeat a SEL component
1735             </phrase>
1736           </textobject>
1737         </mediaobject>
1738       </figure>
1739       <screen># lfs getstripe /mnt/lustre/file
1740 /mnt/lustre/file
1741   lcm_layout_gen: 9
1742   lcm_mirror_count: 1
1743   lcm_entry_count: 4
1744     lcme_id: 1
1745     lcme_mirror_id: 0
1746     lcme_flags: init
1747     lcme_extent.e_start: 0
1748     lcme_extent.e_end: 201326592
1749       lmm_stripe_count: 1
1750       lmm_stripe_size: 1048576
1751       lmm_pattern: raid0
1752       lmm_layout_gen: 0
1753       lmm_stripe_offset: 0
1754       lmm_objects:
1755       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x5:0x0] }
1756
1757     lcme_id: 3
1758     lcme_mirror_id: 0
1759     lcme_flags: init
1760     lcme_extent.e_start: 201326592
1761     lcme_extent.e_end: 469762048
1762       lmm_stripe_count: 1
1763       lmm_stripe_size: 1048576
1764       lmm_pattern: raid0
1765       lmm_layout_gen: 0
1766       lmm_stripe_offset: 1
1767       lmm_objects:
1768       - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x8:0x0] }
1769
1770     lcme_id: 8
1771     lcme_mirror_id: 0
1772     lcme_flags: init
1773     lcme_extent.e_start: 469762048
1774     lcme_extent.e_end: 738197504
1775       lmm_stripe_count: 1
1776       lmm_stripe_size: 1048576
1777       lmm_pattern: raid0
1778       lmm_layout_gen: 65535
1779       lmm_stripe_offset: 0
1780       lmm_objects:
1781       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x6:0x0] }
1782
1783     lcme_id: 4
1784     lcme_mirror_id: 0
1785     lcme_flags: extension
1786     lcme_extent.e_start: 738197504
1787     lcme_extent.e_end: EOF
1788       lmm_stripe_count: 0
1789       lmm_extension_size: 268435456
1790       lmm_pattern: raid0
1791       lmm_layout_gen: 0
1792       lmm_stripe_offset: -1</screen>
1793       <para><emphasis role="bold">Example 6: Forced extension</emphasis></para>
1794       <para>Suppose in the example above, both <literal>OST0</literal> and
1795       <literal>OST1</literal> are low on space, the following write to the
1796       last SEL component will behave as an extension as there is no sense to
1797       repeat.</para>
1798       <figure  xml:id="managinglayout.fig.pfl_forced">
1799         <title>Example: forced extension in a SEL file</title>
1800         <mediaobject>
1801           <imageobject>
1802             <imagedata scalefit="1" depth="2.25in" align="center"
1803             fileref="figures/SEL_forced.png" />
1804           </imageobject>
1805           <textobject>
1806             <phrase>Example: forced extension in a SEL file.
1807             </phrase>
1808           </textobject>
1809         </mediaobject>
1810       </figure>
1811       <screen># lfs getstripe /mnt/lustre/file
1812 /mnt/lustre/file
1813   lcm_layout_gen: 11
1814   lcm_mirror_count: 1
1815   lcm_entry_count: 4
1816     lcme_id: 1
1817     lcme_mirror_id: 0
1818     lcme_flags: init
1819     lcme_extent.e_start: 0
1820     lcme_extent.e_end: 201326592
1821       lmm_stripe_count: 1
1822       lmm_stripe_size: 1048576
1823       lmm_pattern: raid0
1824       lmm_layout_gen: 0
1825       lmm_stripe_offset: 0
1826       lmm_objects:
1827       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x5:0x0] }
1828
1829     lcme_id: 3
1830     lcme_mirror_id: 0
1831     lcme_flags: init
1832     lcme_extent.e_start: 201326592
1833     lcme_extent.e_end: 469762048
1834       lmm_stripe_count: 1
1835       lmm_stripe_size: 1048576
1836       lmm_pattern: raid0
1837       lmm_layout_gen: 0
1838       lmm_stripe_offset: 1
1839       lmm_objects:
1840       - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x8:0x0] }
1841
1842     lcme_id: 8
1843     lcme_mirror_id: 0
1844     lcme_flags: init
1845     lcme_extent.e_start: 469762048
1846     lcme_extent.e_end: 1006632960
1847       lmm_stripe_count: 1
1848       lmm_stripe_size: 1048576
1849       lmm_pattern: raid0
1850       lmm_layout_gen: 65535
1851       lmm_stripe_offset: 0
1852       lmm_objects:
1853       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x6:0x0] }
1854
1855     lcme_id: 4
1856     lcme_mirror_id: 0
1857     lcme_flags: extension
1858     lcme_extent.e_start: 1006632960
1859     lcme_extent.e_end: EOF
1860       lmm_stripe_count: 0
1861       lmm_extension_size: 268435456
1862       lmm_pattern: raid0
1863       lmm_layout_gen: 0
1864       lmm_stripe_offset: -1</screen>
1865     </section>
1866     <section>
1867         <title><literal>lfs find</literal></title>
1868         <para><literal>lfs find</literal> commands can be used to search for
1869         the files that match the given SEL component paremeters. Here, only
1870         those parameters new for the SEL files are shown.</para>
1871         <screen>lfs find
1872 [[!] --extension-size|--ext-size|-z [+-]ext-size[KMG]
1873 [[!] --component-flags=extension]</screen>
1874         <para>The <literal>-z</literal> option is added to specify the extension
1875         size to search for.  The files which have any component with the
1876         extension size matched the given criteria are printed out. As always
1877         “+” and “-“ signs are allowed to specify the least and the most size.
1878         </para>
1879         <para>A new <literal>extension</literal> component flag is added.  Only
1880         files which have at least one SEL component are printed.</para>
1881         <note><para>The negative search for flags searches the files which
1882         <emphasis role="strong">have</emphasis> a non-SEL component (not files
1883         which <emphasis role="strong">do not have</emphasis> any SEL component).
1884         </para></note>
1885         <para><emphasis role="bold">Example</emphasis></para>
1886         <screen># lfs setstripe --extension-size 64M -c 1 -E -1 /mnt/lustre/file
1887
1888 # lfs find --comp-flags extension /mnt/lustre/*
1889 /mnt/lustre/file
1890
1891 # lfs find ! --comp-flags extension /mnt/lustre/*
1892 /mnt/lustre/file
1893
1894 # lfs find -z 64M /mnt/lustre/*
1895 /mnt/lustre/file
1896
1897 # lfs find -z +64M /mnt/lustre/*
1898
1899 # lfs find -z -64M /mnt/lustre/*
1900
1901 # lfs find -z +63M /mnt/lustre/*
1902 /mnt/lustre/file
1903
1904 # lfs find -z -65M /mnt/lustre/*
1905 /mnt/lustre/file
1906
1907 # lfs find -z 65M /mnt/lustre/*
1908
1909 # lfs find ! -z 64M /mnt/lustre/*
1910
1911 # lfs find ! -z +64M /mnt/lustre/*
1912 /mnt/lustre/file
1913
1914 # lfs find ! -z -64M /mnt/lustre/*
1915 /mnt/lustre/file
1916
1917 # lfs find ! -z +63M /mnt/lustre/*
1918
1919 # lfs find ! -z -65M /mnt/lustre/*
1920
1921 # lfs find ! -z 65M /mnt/lustre/*
1922 /mnt/lustre/file</screen>
1923     </section>
1924   </section>
1925
1926   <section xml:id="foreign_layout" condition='l2D'>
1927     <title>
1928       <indexterm><primary>striping</primary><secondary>Foreign</secondary>
1929       </indexterm>Foreign Layout</title>
1930     <para>The Lustre Foreign Layout feature is an extension of both the
1931     LOV and LMV formats which allows the creation of empty files and directories
1932     with the necessary specifications to point to corresponding objects outside
1933     from Lustre namespace.</para>
1934     <para>The new LOV/LMV foreign internal format can be represented as:</para>
1935     <figure  xml:id="managinglayout.fig.foreign_format">
1936       <title>LOV/LMV foreign format</title>
1937       <mediaobject>
1938         <imageobject>
1939           <imagedata scalefit="1" width="100%"
1940           fileref="figures/Foreign_Format.png" />
1941         </imageobject>
1942         <textobject>
1943           <phrase>LOV/LMV foreign format</phrase>
1944         </textobject>
1945       </mediaobject>
1946     </figure>
1947     <section>
1948       <title><literal>lfs set[dir]stripe</literal></title>
1949       <para>The <literal>lfs set[dir]stripe</literal> commands are used to
1950       create files or directories with foreign layouts, by calling the
1951       corresponding API, itself invoking the appropriate ioctl().</para>
1952       <section>
1953         <title>Create a Foreign file/dir</title>
1954         <para><emphasis role="bold">Command</emphasis></para>
1955         <screen>lfs set[dir]stripe \
1956 --foreign[=&lt;foreign_type&gt;] --xattr|-x &lt;layout_string&gt; \
1957 [--flags &lt;hex_bitmask&gt;] [--mode &lt;mode_bits&gt;] \
1958 <replaceable>{file,dir}name</replaceable></screen>
1959         <para>Both the <literal>--foreign</literal> and
1960         <literal>--xattr|-x</literal> options are mandatory.
1961         The <literal>&lt;foreign_type&gt;</literal> (default is "none", meaning
1962         no special behavior), and both <literal>--flags</literal> and
1963         <literal>--mode</literal> (default is 0666) options are optional.</para>
1964         <para><emphasis role="bold">Example</emphasis></para>
1965         <para>The following command creates a foreign file of "none" type and
1966         with "foo@bar" LOV content and specific mode and flags:
1967         <screen># lfs setstripe --foreign=none --flags=0xda08 --mode=0640 \
1968 --xattr=foo@bar /mnt/lustre/file</screen>
1969         <figure  xml:id="managinglayout.fig.foreign_createfile">
1970           <title>Example: create a foreign file</title>
1971           <mediaobject>
1972             <imageobject>
1973               <imagedata scalefit="1" width="100%" align="center"
1974               fileref="figures/Foreign_Createfile.png" />
1975             </imageobject>
1976             <textobject>
1977               <phrase>Example: create a foreign file</phrase>
1978             </textobject>
1979           </mediaobject>
1980         </figure>
1981         </para>
1982       </section>
1983     </section>
1984     <section>
1985       <title><literal>lfs get[dir]stripe</literal></title>
1986       <para><literal>lfs get[dir]stripe</literal> commands can be used to
1987       retrieve foreign LOV/LMV informations and content.</para>
1988       <para><emphasis role="bold">Command</emphasis></para>
1989       <screen>lfs get[dir]stripe [-v] <replaceable>filename</replaceable></screen>
1990       <para><emphasis role="bold">List foreign layout information
1991       </emphasis></para>
1992       <para>Suppose we already have a foreign file
1993         <literal>/mnt/lustre/file</literal>, created by the following command:</para>
1994       <screen># lfs setstripe --foreign=none --flags=0xda08 --mode=0640 \
1995 --xattr=foo@bar /mnt/lustre/file</screen>
1996       <para>The full foreign layout informations can be listed using the
1997       following command:</para>
1998       <screen># lfs getstripe -v /mnt/lustre/file
1999 /mnt/lustre/file
2000   lfm_magic: 0x0BD70BD0
2001   lfm_length: 7
2002   lfm_type: none
2003   lfm_flags: 0x0000DA08
2004   lfm_value: foo@bar
2005       </screen>
2006       <note><para>As you can see the <literal>lfm_length</literal> field
2007       value is the characters number in the variable length
2008       <literal>lfm_value</literal> field.</para></note>
2009     </section>
2010     <section>
2011         <title><literal>lfs find</literal></title>
2012         <para><literal>lfs find</literal> commands can be used to search for
2013         all the foreign files/directories or those that match the given
2014         selection paremeters.</para>
2015         <screen>lfs find
2016 [[!] --foreign[=&lt;foreign_type&gt;]</screen>
2017         <para>The <literal>--foreign[=&lt;foreign_type&gt;]</literal> option
2018         has been added to specify that all [!,but not] files and/or directories
2019         with a foreign layout [and [!,but not] of
2020         <literal>&lt;foreign_type&gt;</literal>] will be retrieved.</para>
2021         <para><emphasis role="bold">Example</emphasis></para>
2022         <screen># lfs setstripe --foreign=none --xattr=foo@bar /mnt/lustre/file
2023 # touch /mnt/lustre/file2
2024
2025 # lfs find --foreign /mnt/lustre/*
2026 /mnt/lustre/file
2027
2028 # lfs find ! --foreign /mnt/lustre/*
2029 /mnt/lustre/file2
2030
2031 # lfs find --foreign=none /mnt/lustre/*
2032 /mnt/lustre/file</screen>
2033     </section>
2034   </section>
2035
2036   <section xml:id="file_striping.managing_free_space">
2037     <title><indexterm>
2038         <primary>space</primary>
2039         <secondary>free space</secondary>
2040       </indexterm><indexterm>
2041         <primary>striping</primary>
2042         <secondary>round-robin algorithm</secondary>
2043       </indexterm><indexterm>
2044         <primary>striping</primary>
2045         <secondary>weighted algorithm</secondary>
2046       </indexterm><indexterm>
2047         <primary>round-robin algorithm</primary>
2048       </indexterm><indexterm>
2049         <primary>weighted algorithm</primary>
2050       </indexterm>Managing Free Space</title>
2051     <para>To optimize file system performance, the MDT assigns file stripes to OSTs based on two
2052       allocation algorithms. The <emphasis role="italic">round-robin</emphasis> allocator gives
2053       preference to location (spreading out stripes across OSSs to increase network bandwidth
2054       utilization) and the weighted allocator gives preference to available space (balancing loads
2055       across OSTs). Threshold and weighting factors for these two algorithms can be adjusted by the
2056       user. The MDT reserves 0.1 percent of total OST space and 32 inodes for each OST. The MDT
2057       stops object allocation for the OST if available space is less than reserved or the OST has
2058       fewer than 32 free inodes. The MDT starts object allocation when available space is twice
2059       as big as the reserved space and the OST has more than 64 free inodes. Note, clients
2060       could append existing files no matter what object allocation state is.</para>
2061     <para condition="l29"> The reserved space for each OST can be adjusted by the user. Use the
2062       <literal>lctl set_param</literal> command, for example the next command reserve 1GB space
2063       for all OSTs.
2064       <screen>lctl set_param -P osp.*.reserved_mb_low=1024</screen></para>
2065     <para>This section describes how to check available free space on disks
2066       and how free space is allocated. It then describes how to set the
2067       threshold and weighting factors for the allocation algorithms.</para>
2068     <section xml:id="file_striping.checking_free_space">
2069       <title>Checking File System Free Space</title>
2070       <para>Free space is an important consideration in assigning file stripes.
2071         The <literal>lfs df</literal> command can be used to show available
2072         disk space on the mounted Lustre file system and space consumption per
2073         OST. If multiple Lustre file systems are mounted, a path may be
2074         specified, but is not required. Options to the <literal>lfs df</literal>
2075         command are shown below.</para>
2076       <informaltable frame="all">
2077         <tgroup cols="2">
2078           <colspec colname="c1" colwidth="50*"/>
2079           <colspec colname="c2" colwidth="50*"/>
2080           <thead>
2081             <row>
2082               <entry>
2083                 <para><emphasis role="bold">Option</emphasis></para>
2084               </entry>
2085               <entry>
2086                 <para><emphasis role="bold">Description</emphasis></para>
2087               </entry>
2088             </row>
2089           </thead>
2090           <tbody>
2091             <row>
2092               <entry>
2093                 <para>
2094                   <literal>-h</literal>, <literal>--human-readable</literal>
2095                 </para>
2096               </entry>
2097               <entry>
2098                 <para> Displays sizes in human readable format (for example: 1K,
2099                 234M, 5G) using base-2 (binary) values (i.e. 1G = 1024M).</para>
2100               </entry>
2101             </row>
2102             <row>
2103               <entry>
2104                 <para>
2105                   <literal>-H</literal>, <literal>--si</literal>
2106                 </para>
2107               </entry>
2108               <entry>
2109                 <para>Like <literal>-h</literal>, this displays counts in human
2110                 readable format, but using base-10 (decimal) values
2111                 (i.e. 1G = 1000M).</para>
2112               </entry>
2113             </row>
2114             <row>
2115               <entry>
2116                 <para> <literal role="bold">-i, --inodes</literal></para>
2117               </entry>
2118               <entry>
2119                 <para> Lists inodes instead of block usage.</para>
2120               </entry>
2121             </row>
2122             <row>
2123               <entry>
2124                 <para> <literal role="bold">-l, --lazy</literal></para>
2125               </entry>
2126               <entry>
2127                 <para>Do not attempt to contact any OST or MDT not currently
2128                   connected to the client.  This avoids blocking the
2129                   <literal>lfs df</literal> output if a target is offline or
2130                   unreachable, and only returns the space on OSTs that can
2131                   currently be accessed.</para>
2132               </entry>
2133             </row>
2134             <row>
2135               <entry>
2136                 <para> <literal role="bold">-p, --pool</literal></para>
2137               </entry>
2138               <entry>
2139                 <para>Limit the usage to report only OSTs that are in the
2140                   specified <replaceable>pool</replaceable>.  If multiple
2141                   Lustre filesystems are mounted, list the OSTs in
2142                   <replaceable>pool</replaceable> for each filesystem, or
2143                   limit the display to only a pool for a specific filesystem
2144                   if <replaceable>fsname.pool</replaceable> is given.
2145                   Specifying both <replaceable>fsname</replaceable> and
2146                   <replaceable>pool</replaceable> is equivalent to providing
2147                   a specific mountpoint.
2148                 </para>
2149               </entry>
2150             </row>
2151             <row>
2152               <entry>
2153                 <para>
2154                   <literal>-v</literal>, <literal>--verbose</literal>
2155                 </para>
2156               </entry>
2157               <entry>
2158                 <para>Display verbose status of MDTs and OSTs.  This may
2159                   include one or more optional flags at the end of each line.
2160                 </para>
2161               </entry>
2162             </row>
2163           </tbody>
2164         </tgroup>
2165       </informaltable>
2166       <para>
2167         <literal>lfs df</literal> may also report additional target status
2168         as the last column in the display, if there are issues with that target.
2169         Target states include:
2170       </para>
2171       <itemizedlist>
2172         <listitem><para>
2173           <literal>D</literal>: OST/MDT is <literal>Degraded</literal>.
2174           The target has a failed drive in the RAID device, or is
2175           undergoing RAID reconstruction.  This state is marked on
2176           the server automatically for ZFS targets via
2177           <literal>zed</literal>, or a (user-supplied) script that
2178           monitors the target device and sets
2179           "<literal>lctl set_param obdfilter.<replaceable>target</replaceable>.degraded=1</literal>"
2180           on the OST.  This target will be avoided for new
2181           allocations, but will still be used to read existing files
2182           located there or if there are not enough non-degraded OSTs
2183           to make up a widely-striped file.
2184         </para></listitem>
2185         <listitem><para>
2186           <literal>R</literal>: OST/MDT is <literal>Read-only</literal>.
2187           The target filesystem is marked read-only due to filesystem
2188           corruption detected by ldiskfs or ZFS.  No modifications
2189           are allowed on this OST, and it needs to be unmounted and
2190           <literal>e2fsck</literal> or <literal>zpool scrub</literal>
2191           run to repair the underlying filesystem.
2192         </para></listitem>
2193         <listitem><para>
2194           <literal>N</literal>: OST/MDT is <literal>No-precreate</literal>.
2195           The target is configured to deny object precreation set by
2196           "<literal>lctl set_param obdfilter.<replaceable>target</replaceable>.no_precreate=1</literal>"
2197           parameter or the "<literal>-o no_precreate</literal>" mount option.
2198           This may be done to add an OST to the filesystem without allowing
2199           objects to be allocated on it yet, or for other reasons.
2200         </para></listitem>
2201         <listitem><para>
2202           <literal>S</literal>: OST/MDT is out of <literal>Space</literal>.
2203           The target filesystem has less than the minimum required
2204           free space and will not be used for new object allocations
2205           until it has more free space.
2206         </para></listitem>
2207         <listitem><para>
2208           <literal>I</literal>: OST/MDT is out of <literal>Inodes</literal>.
2209           The target filesystem has less than the minimum required
2210           free inodes and will not be used for new object allocations
2211           until it has more free inodes.
2212         </para></listitem>
2213         <listitem><para>
2214           <literal>f</literal>: OST/MDT is on <literal>flash</literal>.
2215           The target filesystem is using a flash (non-rotational)
2216           storage device.  This is normally detected from the
2217           underlying Linux block device, but can be set manually
2218           with "<literal>lctl set_param osd-*.*.nonrotational=1</literal>
2219           on the respective OSTs.  This lower-case status is only
2220           shown in conjunction with the <literal>-v</literal> option,
2221           since it is not an error condition.
2222         </para></listitem>
2223       </itemizedlist>
2224       <note>
2225         <para>The <literal>df -i</literal> and <literal>lfs df -i</literal>
2226           commands show the <emphasis role="italic">minimum</emphasis> number
2227           of inodes that can be created in the file system at the current time.
2228           If the total number of objects available across all of the OSTs is
2229           smaller than those available on the MDT(s), taking into account the
2230           default file striping, then <literal>df -i</literal> will also
2231           report a smaller number of inodes than could be created. Running
2232           <literal>lfs df -i</literal> will report the actual number of inodes
2233           that are free on each target.
2234         </para>
2235         <para>For ZFS file systems, the number of inodes that can be created
2236           is dynamic and depends on the free space in the file system. The
2237           Free and Total inode counts reported for a ZFS file system are only
2238           an estimate based on the current usage for each target. The Used
2239           inode count is the actual number of inodes used by the file system.
2240         </para>
2241       </note>
2242       <para><emphasis role="bold">Examples</emphasis></para>
2243       <screen>client$ lfs df
2244 UUID                 1K-blocks       Used Available Use%  Mounted on
2245 testfs-OST0000_UUID    9174328    1020024   8154304  11%  /mnt/lustre[MDT:0]
2246 testfs-OST0000_UUID   94181368   56330708  37850660  59%  /mnt/lustre[OST:0]
2247 testfs-OST0001_UUID   94181368   56385748  37795620  59%  /mnt/lustre[OST:1]
2248 testfs-OST0002_UUID   94181368   54352012  39829356  57%  /mnt/lustre[OST:2]
2249 filesystem summary:  282544104  167068468  39829356  57%  /mnt/lustre
2250
2251 [client1] $ lfs df -hv
2252 UUID                    bytes        Used Available Use%  Mounted on
2253 testfs-MDT0000_UUID      8.7G      996.1M      7.8G  11%  /mnt/lustre[MDT:0]
2254 testfs-OST0000_UUID     89.8G       53.7G     36.1G  59%  /mnt/lustre[OST:0] f
2255 testfs-OST0001_UUID     89.8G       53.8G     36.0G  59%  /mnt/lustre[OST:1] f
2256 testfs-OST0002_UUID     89.8G       51.8G     38.0G  57%  /mnt/lustre[OST:2] f
2257 filesystem summary:    269.5G      159.3G    110.1G  59%  /mnt/lustre
2258
2259 [client1] $ lfs df -iH
2260 UUID                   Inodes       IUsed    IFree IUse%  Mounted on
2261 testfs-MDT0000_UUID     2.21M       41.9k     2.17M   1%  /mnt/lustre[MDT:0]
2262 testfs-OST0000_UUID    737.3k       12.1k    725.1k   1%  /mnt/lustre[OST:0]
2263 testfs-OST0001_UUID    737.3k       12.2k    725.0k   1%  /mnt/lustre[OST:1]
2264 testfs-OST0002_UUID    737.3k       12.2k    725.0k   1%  /mnt/lustre[OST:2]
2265 filesystem summary:     2.21M       41.9k     2.17M   1%  /mnt/lustre[OST:2]
2266 </screen>
2267     </section>
2268     <section remap="h3">
2269         <title><indexterm>
2270           <primary>striping</primary>
2271           <secondary>allocations</secondary>
2272         </indexterm> Stripe Allocation Methods</title>
2273       <para>Two stripe allocation methods are provided:</para>
2274       <itemizedlist>
2275         <listitem>
2276           <para><emphasis role="bold">Round-robin allocator</emphasis> - When the OSTs have
2277             approximately the same amount of free space, the round-robin allocator alternates
2278             stripes between OSTs on different OSSs, so the OST used for stripe 0 of each file is
2279             evenly distributed among OSTs, regardless of the stripe count. In a simple example with
2280             eight OSTs numbered 0-7, objects would be allocated like this:</para>
2281           <para>
2282             <screen>File 1: OST1, OST2, OST3, OST4
2283 File 2: OST5, OST6, OST7
2284 File 3: OST0, OST1, OST2, OST3, OST4, OST5
2285 File 4: OST6, OST7, OST0</screen>
2286           </para>
2287           <para>Here are several more sample round-robin stripe orders (each letter represents a
2288             different OST on a single OSS):</para>
2289           <informaltable frame="none">
2290             <tgroup cols="2">
2291               <colspec colname="c1" colwidth="50*"/>
2292               <colspec colname="c2" colwidth="50*"/>
2293               <tbody>
2294                 <row>
2295                   <entry>
2296                     <para> 3: AAA</para>
2297                   </entry>
2298                   <entry>
2299                     <para> One 3-OST OSS</para>
2300                   </entry>
2301                 </row>
2302                 <row>
2303                   <entry>
2304                     <para> 3x3: ABABAB</para>
2305                   </entry>
2306                   <entry>
2307                     <para> Two 3-OST OSSs</para>
2308                   </entry>
2309                 </row>
2310                 <row>
2311                   <entry>
2312                     <para> 3x4: BBABABA</para>
2313                   </entry>
2314                   <entry>
2315                     <para> One 3-OST OSS (A) and one 4-OST OSS (B)</para>
2316                   </entry>
2317                 </row>
2318                 <row>
2319                   <entry>
2320                     <para> 3x5: BBABBABA</para>
2321                   </entry>
2322                   <entry>
2323                     <para> One 3-OST OSS (A) and one 5-OST OSS (B)</para>
2324                   </entry>
2325                 </row>
2326                 <row>
2327                   <entry>
2328                     <para> 3x3x3: ABCABCABC</para>
2329                   </entry>
2330                   <entry>
2331                     <para> Three 3-OST OSSs</para>
2332                   </entry>
2333                 </row>
2334               </tbody>
2335             </tgroup>
2336           </informaltable>
2337         </listitem>
2338         <listitem>
2339           <para><emphasis role="bold">Weighted allocator</emphasis> - When the free space difference
2340             between the OSTs becomes significant, the weighting algorithm is used to influence OST
2341             ordering based on size (amount of free space available on each OST) and location
2342             (stripes evenly distributed across OSTs). The weighted allocator fills the emptier OSTs
2343             faster, but uses a weighted random algorithm, so the OST with the most free space is not
2344             necessarily chosen each time.</para>
2345         </listitem>
2346       </itemizedlist>
2347       <para>The allocation method is determined by the amount of free-space
2348         imbalance on the OSTs. When free space is relatively balanced across
2349         OSTs, the faster round-robin allocator is used, which maximizes network
2350         balancing. The weighted allocator is used when any two OSTs are out of
2351         balance by more than the specified threshold (17% by default). The
2352         threshold between the two allocation methods is defined by the
2353         <literal>qos_threshold_rr</literal> parameter. </para>
2354         <para>To temporarily set the <literal>qos_threshold_rr</literal> to
2355         <literal>25</literal>, enter the folowing on each MDS:
2356         <screen>mds# lctl set_param lod.<replaceable>fsname</replaceable>*.qos_threshold_rr=25</screen></para>
2357     </section>
2358     <section remap="h3">
2359       <title><indexterm>
2360           <primary>space</primary>
2361           <secondary>location weighting</secondary>
2362         </indexterm>Adjusting the Weighting Between Free Space and Location</title>
2363       <para>The weighting priority used by the weighted allocator is set by the
2364         the <literal>qos_prio_free</literal> parameter.
2365         Increasing the value of <literal>qos_prio_free</literal> puts more
2366         weighting on the amount of free space available on each OST and less
2367         on how stripes are distributed across OSTs. The default value is
2368         <literal>91</literal> (percent). When the free space priority is set to
2369           <literal>100</literal> (percent), weighting is based entirely on free space and location
2370         is no longer used by the striping algorithm. </para>
2371       <para>To permanently change the allocator weighting to <literal>100</literal>, enter this command on the
2372         MGS:</para>
2373       <screen>lctl conf_param <replaceable>fsname</replaceable>-MDT0000-*.lod.qos_prio_free=100</screen>
2374       <para> .</para>
2375       <note>
2376         <para>When <literal>qos_prio_free</literal> is set to <literal>100</literal>, a weighted
2377           random algorithm is still used to assign stripes, so, for example, if OST2 has twice as
2378           much free space as OST1, OST2 is twice as likely to be used, but it is not guaranteed to
2379           be used.</para>
2380       </note>
2381     </section>
2382   </section>
2383   <section xml:id="wide_striping">
2384     <title><indexterm>
2385         <primary>striping</primary>
2386         <secondary>wide striping</secondary>
2387       </indexterm><indexterm>
2388         <primary>wide striping</primary>
2389       </indexterm>Lustre Striping Internals</title>
2390     <para>Individual files can only be striped over a finite number of OSTs,
2391     based on the maximum size of the attributes that can be stored on the MDT.
2392     If the MDT is ldiskfs-based without the <literal>ea_inode</literal>
2393     feature, a file can be striped across at most 160 OSTs.  With ZFS-based
2394     MDTs, or if the <literal>ea_inode</literal> feature is enabled for an
2395     ldiskfs-based MDT, a file can be striped across up to 2000 OSTs.
2396     </para>
2397     <para>Lustre inodes use an extended attribute to record on which OST each
2398     object is located, and the identifier each object on that OST. The size of
2399     the extended attribute is a function of the number of stripes.</para>
2400     <para>If using an ldiskfs-based MDT, the maximum number of OSTs over which
2401     files can be striped can been raised to 2000 by enabling the
2402     <literal>ea_inode</literal> feature on the MDT:
2403     <screen>tune2fs -O ea_inode /dev/<replaceable>mdtdev</replaceable></screen>
2404     </para>
2405     <note condition='l2D'><para>Since Lustre 2.13 the
2406     <literal>ea_inode</literal> feature is enabled by default on all newly
2407     formatted ldiskfs MDT filesystems.</para></note>
2408     <note><para>The maximum stripe count for a single file does not limit the
2409     maximum number of OSTs that are in the filesystem as a whole, only the
2410     maximum possible size and maximum aggregate bandwidth for the file.
2411     </para></note>
2412   </section>
2413 </chapter>
2414 <!--
2415   vim:expandtab:shiftwidth=2:tabstop=8:
2416   -->