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