Whamcloud - gitweb
LUDOC-11 misc: Trivial updates to correct spelling errors
[doc/manual.git] / ManagingStripingFreeSpace.xml
1 <?xml version='1.0' encoding='UTF-8'?><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="managingstripingfreespace">
2   <title xml:id="managingstripingfreespace.title">Managing File Layout (Striping) and Free
3     Space</title>
4   <para>This chapter describes file layout (striping) and I/O options, and includes the following
5     sections:</para>
6   <itemizedlist>
7     <listitem>
8       <para><xref linkend="dbdoclet.50438209_79324"/></para>
9     </listitem>
10     <listitem>
11       <para><xref linkend="dbdoclet.50438209_48033"/></para>
12     </listitem>
13     <listitem>
14       <para><xref linkend="dbdoclet.50438209_78664"/></para>
15     </listitem>
16     <listitem>
17       <para><xref linkend="dbdoclet.50438209_44776"/></para>
18     </listitem>
19     <listitem>
20       <para><xref linkend="dbdoclet.50438209_10424"/></para>
21     </listitem>
22     <listitem>
23       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_syy_gcl_qk"/></para>
24     </listitem>
25   </itemizedlist>
26   <section xml:id="dbdoclet.50438209_79324">
27       <title>
28       <indexterm>
29         <primary>space</primary>
30       </indexterm>
31       <indexterm>
32         <primary>striping</primary>
33         <secondary>how it works</secondary>
34       </indexterm>
35       <indexterm>
36         <primary>striping</primary>
37         <see>space</see>
38       </indexterm>
39       <indexterm>
40         <primary>space</primary>
41         <secondary>striping</secondary>
42       </indexterm>How Lustre File System Striping Works</title>
43     <para>In a Lustre file system, the MDS allocates objects to OSTs using either a round-robin
44       algorithm or a weighted algorithm. When the amount of free space is well balanced (i.e., by
45       default, when the free space across OSTs differs by less than 17%), the round-robin algorithm
46       is used to select the next OST to which a stripe is to be written. Periodically, the MDS
47       adjusts the striping layout to eliminate some degenerated cases in which applications that
48       create very regular file layouts (striping patterns) preferentially use a particular OST in
49       the sequence.</para>
50     <para> Normally the usage of OSTs is well balanced. However, if users create a small number of
51       exceptionally large files or incorrectly specify striping parameters, imbalanced OST usage may
52       result. When the free space across OSTs differs by more than a specific amount (17% by
53       default), the MDS then uses weighted random allocations with a preference for allocating
54       objects on OSTs with more free space. (This can reduce I/O performance until space usage is
55       rebalanced again.) For a more detailed description of how striping is allocated, see <xref
56         linkend="dbdoclet.50438209_10424"/>.</para>
57     <para condition="l22">Files can only be striped over a finite number of OSTs. Prior to Lustre
58       software release 2.2, the maximum number of OSTs that a file could be striped across was
59       limited to 160. As of Lustre software release 2.2, the maximum number of OSTs is 2000. For
60       more information, see <xref xmlns:xlink="http://www.w3.org/1999/xlink"
61         linkend="section_syy_gcl_qk"/>.</para>
62   </section>
63   <section xml:id="dbdoclet.50438209_48033">
64       <title><indexterm>
65         <primary>file layout</primary>
66         <secondary>See striping</secondary>
67       </indexterm><indexterm>
68         <primary>striping</primary>
69         <secondary>considerations</secondary>
70       </indexterm>
71       <indexterm>
72         <primary>space</primary>
73         <secondary>considerations</secondary>
74       </indexterm> Lustre File Layout (Striping) Considerations</title>
75     <para>Whether you should set up file striping and what parameter values you select depends on
76       your needs. A good rule of thumb is to stripe over as few objects as will meet those needs and
77       no more.</para>
78     <para>Some reasons for using striping include:</para>
79     <itemizedlist>
80       <listitem>
81         <para><emphasis role="bold">Providing high-bandwidth access.</emphasis> Many applications
82           require high-bandwidth access to a single file, which may be more bandwidth than can be
83           provided by a single OSS. Examples are a scientific application that writes to a single
84           file from hundreds of nodes, or a binary executable that is loaded by many nodes when an
85           application starts.</para>
86         <para>In cases like these, a file can be striped over as many OSSs as it takes to achieve
87           the required peak aggregate bandwidth for that file. Striping across a larger number of
88           OSSs should only be used when the file size is very large and/or is accessed by many nodes
89           at a time. Currently, Lustre files can be striped across up to 2000 OSTs, the maximum
90           stripe count for an <literal>ldiskfs</literal> file system.</para>
91       </listitem>
92       <listitem>
93         <para><emphasis role="bold">Improving performance when OSS bandwidth is exceeded.</emphasis>
94           Striping across many OSSs can improve performance if the aggregate client bandwidth
95           exceeds the server bandwidth and the application reads and writes data fast enough to take
96           advantage of the additional OSS bandwidth. The largest useful stripe count is bounded by
97           the I/O rate of the clients/jobs divided by the performance per OSS.</para>
98       </listitem>
99       <listitem>
100         <para><emphasis role="bold">Providing space for very large files.</emphasis> Striping is
101           useful when a single OST does not have enough free space to hold the entire file.</para>
102       </listitem>
103     </itemizedlist>
104     <para>Some reasons to minimize or avoid striping:</para>
105     <itemizedlist>
106       <listitem>
107         <para><emphasis role="bold">Increased overhead.</emphasis> Striping results in more locks
108           and extra network operations during common operations such as <literal>stat</literal> and
109             <literal>unlink</literal>. Even when these operations are performed in parallel, one
110           network operation takes less time than 100 operations.</para>
111         <para>Increased overhead also results from server contention. Consider a cluster with 100
112           clients and 100 OSSs, each with one OST. If each file has exactly one object and the load
113           is distributed evenly, there is no contention and the disks on each server can manage
114           sequential I/O. If each file has 100 objects, then the clients all compete with one
115           another for the attention of the servers, and the disks on each node seek in 100 different
116           directions resulting in needless contention.</para>
117       </listitem>
118       <listitem>
119         <para><emphasis role="bold">Increased risk.</emphasis> When files are striped across all
120           servers and one of the servers breaks down, a small part of each striped file is lost. By
121           comparison, if each file has exactly one stripe, fewer files are lost, but they are lost
122           in their entirety. Many users would prefer to lose some of their files entirely than all
123           of their files partially.</para>
124       </listitem>
125     </itemizedlist>
126     <section remap="h3">
127         <title><indexterm><primary>striping</primary><secondary>size</secondary></indexterm>
128             Choosing a Stripe Size</title>
129       <para>Choosing a stripe size is a balancing act, but reasonable defaults are described below.
130         The stripe size has no effect on a single-stripe file.</para>
131       <itemizedlist>
132         <listitem>
133           <para><emphasis role="bold">The stripe size must be a multiple of the page
134               size.</emphasis> Lustre software tools enforce a multiple of 64 KB (the maximum page
135             size on ia64 and PPC64 nodes) so that users on platforms with smaller pages do not
136             accidentally create files that might cause problems for ia64 clients.</para>
137         </listitem>
138         <listitem>
139           <para><emphasis role="bold">The smallest recommended stripe size is 512 KB.</emphasis>
140             Although you can create files with a stripe size of 64 KB, the smallest practical stripe
141             size is 512 KB because the Lustre file system sends 1MB chunks over the network.
142             Choosing a smaller stripe size may result in inefficient I/O to the disks and reduced
143             performance.</para>
144         </listitem>
145         <listitem>
146           <para><emphasis role="bold">A good stripe size for sequential I/O using high-speed
147               networks is between 1 MB and 4 MB.</emphasis> In most situations, stripe sizes larger
148             than 4 MB may result in longer lock hold times and contention during shared file
149             access.</para>
150         </listitem>
151         <listitem>
152           <para><emphasis role="bold">The maximum stripe size is 4 GB.</emphasis> Using a large
153             stripe size can improve performance when accessing very large files. It allows each
154             client to have exclusive access to its own part of a file. However, a large stripe size
155             can be counterproductive in cases where it does not match your I/O pattern.</para>
156         </listitem>
157         <listitem>
158           <para><emphasis role="bold">Choose a stripe pattern that takes into account the write
159               patterns of your application.</emphasis> Writes that cross an object boundary are
160             slightly less efficient than writes that go entirely to one server. If the file is
161             written in a consistent and aligned way, make the stripe size a multiple of the
162               <literal>write()</literal> size.</para>
163         </listitem>
164       </itemizedlist>
165     </section>
166   </section>
167   <section xml:id="dbdoclet.50438209_78664">
168       <title><indexterm>
169         <primary>striping</primary>
170         <secondary>configuration</secondary>
171       </indexterm>Setting the File Layout/Striping Configuration (<literal>lfs
172       setstripe</literal>)</title>
173     <para>Use the <literal>lfs setstripe</literal> command to create new files with a specific file layout (stripe pattern) configuration.</para>
174     <screen>lfs setstripe [--size|-s stripe_size] [--count|-c stripe_count] \
175 [--index|-i start_ost] [--pool|-p pool_name] <replaceable>filename|dirname</replaceable> </screen>
176     <para><emphasis role="bold">
177         <literal>stripe_size</literal>
178       </emphasis>
179       </para>
180     <para>The <literal>stripe_size</literal> indicates how much data to write to one OST before
181       moving to the next OST. The default <literal>stripe_size</literal> is 1 MB. Passing a
182         <literal>stripe_size</literal> of 0 causes the default stripe size to be used. Otherwise,
183       the <literal>stripe_size</literal> value must be a multiple of 64 KB.</para>
184     <para><emphasis role="bold">
185         <literal>stripe_count</literal>
186       </emphasis>
187       </para>
188     <para>The <literal>stripe_count</literal> indicates how many OSTs to use. The default <literal>stripe_count</literal> value is 1. Setting <literal>stripe_count</literal> to 0 causes the default stripe count to be used. Setting <literal>stripe_count</literal> to -1 means stripe over all available OSTs (full OSTs are skipped).</para>
189     <para><emphasis role="bold">
190         <literal>start_ost</literal>
191       </emphasis>
192       </para>
193     <para>The start OST is the first OST to which files are written. The default value for
194         <literal>start_ost</literal> is -1, which allows the MDS to choose the starting index. This
195       setting is strongly recommended, as it allows space and load balancing to be done by the MDS
196       as needed. If the value of <literal>start_ost</literal> is set to a value other than -1, the
197       file starts on the specified OST index. OST index numbering starts at 0.</para>
198     <note>
199       <para>If the specified OST is inactive or in a degraded mode, the MDS will silently choose
200         another target.</para>
201     </note>
202     <note>
203       <para>If you pass a <literal>start_ost</literal> value of 0 and a
204           <literal>stripe_count</literal> value of <emphasis>1</emphasis>, all files are written to
205         OST 0, until space is exhausted. <emphasis role="italic">This is probably not what you meant
206           to do.</emphasis> If you only want to adjust the stripe count and keep the other
207         parameters at their default settings, do not specify any of the other parameters:</para>
208       <para><screen>client# lfs setstripe -c <replaceable>stripe_count</replaceable> <replaceable>filename</replaceable></screen></para>
209     </note>
210     <para><emphasis role="bold">
211         <literal>pool_name</literal>
212       </emphasis>
213       </para>
214     <para>The <literal>pool_name</literal> specifies the OST pool to which the file will be written.
215       This allows limiting the OSTs used to a subset of all OSTs in the file system. For more
216       details about using OST pools, see <link xl:href="ManagingFileSystemIO.html#50438211_75549"
217         >Creating and Managing OST Pools</link>.</para>
218     <section remap="h3">
219       <title>Specifying a File Layout (Striping Pattern) for a Single File</title>
220       <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>
221       <section xml:id="dbdoclet.50438209_60155">
222         <title>Setting the Stripe Size</title>
223         <para>The command to create a new file with a specified stripe size is similar to:</para>
224         <screen>[client]# lfs setstripe -s 4M /mnt/lustre/new_file</screen>
225         <para>This example command creates the new file <literal>/mnt/lustre/new_file</literal> with a stripe size of 4 MB.</para>
226         <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>
227         <screen> [client]# lfs getstripe /mnt/lustre/new_file
228 /mnt/lustre/4mb_file
229 lmm_stripe_count:   1
230 lmm_stripe_size:    4194304
231 lmm_pattern:        1
232 lmm_layout_gen:     0
233 lmm_stripe_offset:  1
234 obdidx     objid        objid           group
235 1          690550       0xa8976         0 </screen>
236         <para>In this example, the stripe size is 4 MB.</para>
237       </section>
238       <section remap="h4">
239           <title><indexterm><primary>striping</primary><secondary>count</secondary></indexterm>
240               Setting the Stripe Count</title>
241         <para>The command below creates a new file with a stripe count of <literal>-1</literal> to
242           specify striping over all available OSTs:</para>
243         <screen>[client]# lfs setstripe -c -1 /mnt/lustre/full_stripe</screen>
244         <para>The example below indicates that the file <literal>full_stripe</literal> is striped
245           over all six active OSTs in the configuration:</para>
246         <screen>[client]# lfs getstripe /mnt/lustre/full_stripe
247 /mnt/lustre/full_stripe
248   obdidx   objid   objid   group
249   0        8       0x8     0
250   1        4       0x4     0
251   2        5       0x5     0
252   3        5       0x5     0
253   4        4       0x4     0
254   5        2       0x2     0</screen>
255         <para> This is in contrast to the output in <xref linkend="dbdoclet.50438209_60155"/>, which
256           shows only a single object for the file.</para>
257       </section>
258     </section>
259     <section remap="h3">
260       <title><indexterm>
261           <primary>striping</primary>
262           <secondary>per directory</secondary>
263         </indexterm>Setting the Striping Layout for a Directory</title>
264       <para>In a directory, the <literal>lfs setstripe</literal> command sets a default striping
265         configuration for files created in the directory. The usage is the same as <literal>lfs
266           setstripe</literal> for a regular file, except that the directory must exist prior to
267         setting the default striping configuration. If a file is created in a directory with a
268         default stripe configuration (without otherwise specifying striping), the Lustre file system
269         uses those striping parameters instead of the file system default for the new file.</para>
270       <para>To change the striping pattern for a sub-directory, create a directory with desired file
271         layout as described above. Sub-directories inherit the file layout of the root/parent
272         directory.</para>
273     </section>
274     <section remap="h3">
275       <title><indexterm>
276           <primary>striping</primary>
277           <secondary>per file system</secondary>
278         </indexterm>Setting the Striping Layout for a File System</title>
279       <para>Setting the striping specification on the <literal>root</literal> directory determines
280         the striping for all new files created in the file system unless an overriding striping
281         specification takes precedence (such as a striping layout specified by the application, or
282         set using <literal>lfs setstripe</literal>, or specified for the parent directory).</para>
283       <note>
284         <para>The striping settings for a <literal>root</literal> directory are, by default, applied
285           to any new child directories created in the root directory, unless striping settings have
286           been specified for the child directory.</para>
287       </note>
288     </section>
289     <section remap="h3">
290       <title><indexterm>
291           <primary>striping</primary>
292           <secondary>on specific OST</secondary>
293         </indexterm>Creating a File on a Specific OST</title>
294       <para>You can use <literal>lfs setstripe</literal> to create a file on a specific OST. In the
295         following example, the file <literal>file1</literal> is created on the first OST (OST index
296         is 0).</para>
297       <screen>$ lfs setstripe --count 1 --index 0 file1
298 $ dd if=/dev/zero of=file1 count=1 bs=100M
299 1+0 records in
300 1+0 records out
301
302 $ lfs getstripe file1
303 /mnt/testfs/file1
304 lmm_stripe_count:   1
305 lmm_stripe_size:    1048576
306 lmm_pattern:        1
307 lmm_layout_gen:     0
308 lmm_stripe_offset:  0               
309      obdidx    objid   objid    group                    
310      0         37364   0x91f4   0</screen>
311     </section>
312   </section>
313   <section xml:id="dbdoclet.50438209_44776">
314     <title><indexterm><primary>striping</primary><secondary>getting information</secondary></indexterm>Retrieving File Layout/Striping Information (<literal>getstripe</literal>)</title>
315     <para>The <literal>lfs getstripe</literal> command is used to display information that shows
316       over which OSTs a file is distributed. For each OST, the index and UUID is displayed, along
317       with the OST index and object ID for each stripe in the file. For directories, the default
318       settings for files created in that directory are displayed.</para>
319     <section remap="h3">
320       <title>Displaying the Current Stripe Size</title>
321       <para>To see the current stripe size for a Lustre file or directory, use the <literal>lfs
322           getstripe</literal> command. For example, to view information for a directory, enter a
323         command similar to:</para>
324       <screen>[client]# lfs getstripe /mnt/lustre </screen>
325       <para>This command produces output similar to:</para>
326       <screen>/mnt/lustre 
327 (Default) stripe_count: 1 stripe_size: 1M stripe_offset: -1</screen>
328       <para>In this example, the default stripe count is <literal>1</literal> (data blocks are
329         striped over a single OST), the default stripe size is 1 MB, and the objects are created
330         over all available OSTs.</para>
331       <para>To view information for a file, enter a command similar to:</para>
332       <screen>$ lfs getstripe /mnt/lustre/foo
333 /mnt/lustre/foo
334 lmm_stripe_count:   1
335 lmm_stripe_size:    1048576
336 lmm_pattern:        1
337 lmm_layout_gen:     0
338 lmm_stripe_offset:  0
339   obdidx   objid    objid      group
340   2        835487   m0xcbf9f   0 </screen>
341       <para>In this example, the file is located on <literal>obdidx 2</literal>, which corresponds
342         to the OST <literal>lustre-OST0002</literal>. To see which node is serving that OST, run:
343         <screen>$ lctl get_param osc.lustre-OST0002-osc.ost_conn_uuid
344 osc.lustre-OST0002-osc.ost_conn_uuid=192.168.20.1@tcp</screen></para>
345     </section>
346     <section remap="h3">
347       <title>Inspecting the File Tree</title>
348       <para>To inspect an entire tree of files, use the <literal>lfs find</literal>  command:</para>
349       <screen>lfs find [--recursive | -r] <replaceable>file|directory</replaceable> ...</screen>
350     </section>
351         <section>
352       <title><indexterm>
353           <primary>striping</primary>
354           <secondary>remote directories</secondary>
355         </indexterm>Locating the MDT for a remote directory</title>
356       <para condition="l24">Lustre software release 2.4 can be configured with
357           multiple MDTs in the same file system. Each sub-directory can have a
358           different MDT. To identify on which MDT a given subdirectory is
359           located, pass the <literal>getstripe [--mdt-index|-M]</literal>
360           parameters to <literal>lfs</literal>. An example of this command is
361           provided in the section <xref linkend="dbdoclet.rmremotedir"/>.</para>
362     </section>
363   </section>
364   <section xml:id="dbdoclet.50438209_10424">
365     <title><indexterm>
366         <primary>space</primary>
367         <secondary>free space</secondary>
368       </indexterm><indexterm>
369         <primary>striping</primary>
370         <secondary>round-robin algorithm</secondary>
371       </indexterm><indexterm>
372         <primary>striping</primary>
373         <secondary>weighted algorithm</secondary>
374       </indexterm><indexterm>
375         <primary>round-robin algorithm</primary>
376       </indexterm><indexterm>
377         <primary>weighted algorithm</primary>
378       </indexterm>Managing Free Space</title>
379     <para>To optimize file system performance, the MDT assigns file stripes to OSTs based on two
380       allocation algorithms. The <emphasis role="italic">round-robin</emphasis> allocator gives
381       preference to location (spreading out stripes across OSSs to increase network bandwidth
382       utilization) and the weighted allocator gives preference to available space (balancing loads
383       across OSTs). Threshold and weighting factors for these two algorithms can be adjusted by the
384       user. The MDT reserves 0.1 percent of total OST space and 32 inodes for each OST. The MDT
385       stops object allocation for the OST if available space is less than reserved or the OST has
386       fewer than 32 free inodes. The MDT starts object allocation when available space is twice
387       as big as the reserved space and the OST has more than 64 free inodes. Note, clients
388       could append existing files no matter what object allocation state is.</para>
389     <para condition="l29"> The reserved space for each OST can be adjusted by the user. Use the
390       <literal>lctl set_param</literal> command, for example the next command reserve 1GB space
391       for all OSTs.
392       <screen>lctl set_param -P osp.*.reserved_mb_low=1024</screen></para>
393     <para>This section describes how to check available free space on disks and how free space is
394       allocated. It then describes how to set the threshold and weighting factors for the allocation
395       algorithms.</para>
396     <section xml:id="dbdoclet.50438209_35838">
397       <title>Checking File System Free Space</title>
398       <para>Free space is an important consideration in assigning file stripes. The <literal>lfs
399           df</literal> command can be used to show available disk space on the mounted Lustre file
400         system and space consumption per OST. If multiple Lustre file systems are mounted, a path
401         may be specified, but is not required. Options to the <literal>lfs df</literal> command are
402         shown below.</para>
403       <informaltable frame="all">
404         <tgroup cols="2">
405           <colspec colname="c1" colwidth="50*"/>
406           <colspec colname="c2" colwidth="50*"/>
407           <thead>
408             <row>
409               <entry>
410                 <para><emphasis role="bold">Option</emphasis></para>
411               </entry>
412               <entry>
413                 <para><emphasis role="bold">Description</emphasis></para>
414               </entry>
415             </row>
416           </thead>
417           <tbody>
418             <row>
419               <entry>
420                 <para> <literal>-h</literal></para>
421               </entry>
422               <entry>
423                 <para> Displays sizes in human readable format (for example: 1K, 234M, 5G).</para>
424               </entry>
425             </row>
426             <row>
427               <entry>
428                 <para> <literal role="bold">-i, --inodes</literal></para>
429               </entry>
430               <entry>
431                 <para> Lists inodes instead of block usage.</para>
432               </entry>
433             </row>
434           </tbody>
435         </tgroup>
436       </informaltable>
437       <note>
438         <para>The <literal>df -i</literal> and <literal>lfs df -i</literal> commands show the
439             <emphasis role="italic">minimum</emphasis> number of inodes that can be created in the
440           file system at the current time. If the total number of objects available across all of
441           the OSTs is smaller than those available on the MDT(s), taking into account the default
442           file striping, then <literal>df -i</literal> will also report a smaller number of inodes
443           than could be created. Running <literal>lfs df -i</literal> will report the actual number
444           of inodes that are free on each target.</para>
445         <para>For ZFS file systems, the number of inodes that can be created is dynamic and depends
446           on the free space in the file system. The Free and Total inode counts reported for a ZFS
447           file system are only an estimate based on the current usage for each target. The Used
448           inode count is the actual number of inodes used by the file system.</para>
449       </note>
450       <para><emphasis role="bold">Examples</emphasis></para>
451       <screen>[client1] $ lfs df
452 UUID                1K-blockS  Used      Available Use% Mounted on
453 mds-lustre-0_UUID   9174328    1020024   8154304   11%  /mnt/lustre[MDT:0]
454 ost-lustre-0_UUID   94181368   56330708  37850660  59%  /mnt/lustre[OST:0]
455 ost-lustre-1_UUID   94181368   56385748  37795620  59%  /mnt/lustre[OST:1]
456 ost-lustre-2_UUID   94181368   54352012  39829356  57%  /mnt/lustre[OST:2]
457 filesystem summary: 282544104  167068468 39829356  57%  /mnt/lustre
458  
459 [client1] $ lfs df -h
460 UUID                bytes    Used    Available   Use%  Mounted on
461 mds-lustre-0_UUID   8.7G     996.1M  7.8G        11%   /mnt/lustre[MDT:0]
462 ost-lustre-0_UUID   89.8G    53.7G   36.1G       59%   /mnt/lustre[OST:0]
463 ost-lustre-1_UUID   89.8G    53.8G   36.0G       59%   /mnt/lustre[OST:1]
464 ost-lustre-2_UUID   89.8G    51.8G   38.0G       57%   /mnt/lustre[OST:2]
465 filesystem summary: 269.5G   159.3G  110.1G      59%   /mnt/lustre
466  
467 [client1] $ lfs df -i 
468 UUID                Inodes  IUsed IFree   IUse% Mounted on
469 mds-lustre-0_UUID   2211572 41924 2169648 1%    /mnt/lustre[MDT:0]
470 ost-lustre-0_UUID   737280  12183 725097  1%    /mnt/lustre[OST:0]
471 ost-lustre-1_UUID   737280  12232 725048  1%    /mnt/lustre[OST:1]
472 ost-lustre-2_UUID   737280  12214 725066  1%    /mnt/lustre[OST:2]
473 filesystem summary: 2211572 41924 2169648 1%    /mnt/lustre[OST:2]</screen>
474     </section>
475     <section remap="h3">
476         <title><indexterm>
477           <primary>striping</primary>
478           <secondary>allocations</secondary>
479         </indexterm> Stripe Allocation Methods</title>
480       <para>Two stripe allocation methods are provided:</para>
481       <itemizedlist>
482         <listitem>
483           <para><emphasis role="bold">Round-robin allocator</emphasis> - When the OSTs have
484             approximately the same amount of free space, the round-robin allocator alternates
485             stripes between OSTs on different OSSs, so the OST used for stripe 0 of each file is
486             evenly distributed among OSTs, regardless of the stripe count. In a simple example with
487             eight OSTs numbered 0-7, objects would be allocated like this:</para>
488           <para>
489             <screen>File 1: OST1, OST2, OST3, OST4
490 File 2: OST5, OST6, OST7
491 File 3: OST0, OST1, OST2, OST3, OST4, OST5
492 File 4: OST6, OST7, OST0</screen>
493           </para>
494           <para>Here are several more sample round-robin stripe orders (each letter represents a
495             different OST on a single OSS):</para>
496           <informaltable frame="none">
497             <tgroup cols="2">
498               <colspec colname="c1" colwidth="50*"/>
499               <colspec colname="c2" colwidth="50*"/>
500               <tbody>
501                 <row>
502                   <entry>
503                     <para> 3: AAA</para>
504                   </entry>
505                   <entry>
506                     <para> One 3-OST OSS</para>
507                   </entry>
508                 </row>
509                 <row>
510                   <entry>
511                     <para> 3x3: ABABAB</para>
512                   </entry>
513                   <entry>
514                     <para> Two 3-OST OSSs</para>
515                   </entry>
516                 </row>
517                 <row>
518                   <entry>
519                     <para> 3x4: BBABABA</para>
520                   </entry>
521                   <entry>
522                     <para> One 3-OST OSS (A) and one 4-OST OSS (B)</para>
523                   </entry>
524                 </row>
525                 <row>
526                   <entry>
527                     <para> 3x5: BBABBABA</para>
528                   </entry>
529                   <entry>
530                     <para> One 3-OST OSS (A) and one 5-OST OSS (B)</para>
531                   </entry>
532                 </row>
533                 <row>
534                   <entry>
535                     <para> 3x3x3: ABCABCABC</para>
536                   </entry>
537                   <entry>
538                     <para> Three 3-OST OSSs</para>
539                   </entry>
540                 </row>
541               </tbody>
542             </tgroup>
543           </informaltable>
544         </listitem>
545         <listitem>
546           <para><emphasis role="bold">Weighted allocator</emphasis> - When the free space difference
547             between the OSTs becomes significant, the weighting algorithm is used to influence OST
548             ordering based on size (amount of free space available on each OST) and location
549             (stripes evenly distributed across OSTs). The weighted allocator fills the emptier OSTs
550             faster, but uses a weighted random algorithm, so the OST with the most free space is not
551             necessarily chosen each time.</para>
552         </listitem>
553       </itemizedlist>
554       <para>The allocation method is determined by the amount of free-space imbalance on the OSTs.
555         When free space is relatively balanced across OSTs, the faster round-robin allocator is
556         used, which maximizes network balancing. The weighted allocator is used when any two OSTs
557         are out of balance by more than the specified threshold (17% by default). The threshold
558         between the two allocation methods is defined in the file
559             <literal>/proc/fs/<replaceable>fsname</replaceable>/lov/<replaceable>fsname</replaceable>-mdtlov/qos_threshold_rr</literal>. </para>
560       <para>To set the <literal>qos_threshold_r</literal> to <literal>25</literal>,  enter this
561         command on the
562         MGS:<screen>lctl set_param lov.<replaceable>fsname</replaceable>-mdtlov.quos_threshold_rr=25</screen></para>
563     </section>
564     <section remap="h3">
565       <title><indexterm>
566           <primary>space</primary>
567           <secondary>location weighting</secondary>
568         </indexterm>Adjusting the Weighting Between Free Space and Location</title>
569       <para>The weighting priority used by the weighted allocator is set in the file
570             <literal>/proc/fs/<replaceable>fsname</replaceable>/lov/<replaceable>fsname</replaceable>-mdtlov/qos_prio_free</literal>.
571         Increasing the value of <literal>qos_prio_free</literal> puts more weighting on the amount
572         of free space available on each OST and less on how stripes are distributed across OSTs. The
573         default value is <literal>91</literal> (percent). When the free space priority is set to
574           <literal>100</literal> (percent), weighting is based entirely on free space and location
575         is no longer used by the striping algorithm. </para>
576       <para>To change the allocator weighting to <literal>100</literal>, enter this command on the
577         MGS:</para>
578       <screen>lctl conf_param <replaceable>fsname</replaceable>-MDT0000.lov.qos_prio_free=100</screen>
579       <para> .</para>
580       <note>
581         <para>When <literal>qos_prio_free</literal> is set to <literal>100</literal>, a weighted
582           random algorithm is still used to assign stripes, so, for example, if OST2 has twice as
583           much free space as OST1, OST2 is twice as likely to be used, but it is not guaranteed to
584           be used.</para>
585       </note>
586     </section>
587   </section>
588   <section xml:id="section_syy_gcl_qk">
589     <title><indexterm>
590         <primary>striping</primary>
591         <secondary>wide striping</secondary>
592       </indexterm><indexterm>
593         <primary>wide striping</primary>
594       </indexterm>Lustre Striping Internals</title>
595     <para>For Lustre releases prior to Lustre software release 2.2, files can be striped across a
596       maximum of 160 OSTs. Lustre inodes use an extended attribute to record the location of each
597       object (the object ID and the number of the OST on which it is stored). The size of the
598       extended attribute limits the maximum stripe count to 160 objects.</para>
599     <para condition="l22">In Lustre software release 2.2 and subsequent releases, the maximum number
600       of OSTs over which files can be striped has been raised to 2000 by allocating a new block on
601       which to store the extended attribute that holds the object information. This feature, known
602       as "wide striping," only allocates the additional extended attribute data block if the file is
603       striped with a stripe count greater than 160. The file layout (object ID, OST number) is
604       stored on the new data block with a pointer to this block stored in the original Lustre inode
605       for the file. For files smaller than 160 objects, the Lustre inode is used to store the file
606       layout.</para>
607   </section>
608 </chapter>