Whamcloud - gitweb
FIX: xrefs
[doc/manual.git] / ManagingStripingFreeSpace.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <chapter version="5.0" xml:lang="en-US" xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" xml:id='managingstripingfreespace'>
3   <info>
4     <title xml:id='managingstripingfreespace.title'>Managing File Striping and Free Space</title>
5   </info>
6
7   <para><anchor xml:id="dbdoclet.50438209_pgfId-1291802" xreflabel=""/>This chapter describes file striping and I/O options, and includes the following sections:</para>
8
9   <itemizedlist><listitem>
10       <para><xref linkend="dbdoclet.50438209_79324"/></para>
11     </listitem>
12 <listitem>
13       <para><xref linkend="dbdoclet.50438209_48033"/></para>
14     </listitem>
15 <listitem>
16       <para><xref linkend="dbdoclet.50438209_78664"/></para>
17     </listitem>
18 <listitem>
19       <para><xref linkend="dbdoclet.50438209_44776"/></para>
20     </listitem>
21 <listitem>
22       <para><xref linkend="dbdoclet.50438209_10424"/></para>
23     </listitem>
24 </itemizedlist>
25
26     <section xml:id="dbdoclet.50438209_79324">
27       <title>18.1 How Lustre Striping Works</title>
28       <para><anchor xml:id="dbdoclet.50438209_pgfId-1296776" xreflabel=""/>Lustre uses a round-robin algorithm for selecting the next OST to which a stripe is to be written. Normally the usage of OSTs is well balanced. However, if users create a small number of exceptionally large files or incorrectly specify striping parameters, imbalanced OST usage may result.</para>
29       <para><anchor xml:id="dbdoclet.50438209_pgfId-1296839" xreflabel=""/>The MDS allocates objects on seqential OSTs. Periodically, it will adjust the striping layout to eliminate some degenerated cases where applications that create very regular file layouts (striping patterns) would preferentially use a particular OST in the sequence.</para>
30       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297552" xreflabel=""/>Stripes are written to sequential OSTs until free space across the OSTs differs by more than 20%. The MDS will then use weighted random allocations with a preference for allocating objects on OSTs with more free space. This can reduce I/O performance until space usage is rebalanced to within 20% again.</para>
31       <para><anchor xml:id="dbdoclet.50438209_pgfId-1296783" xreflabel=""/>For a more detailed description of stripe assignments, see <xref linkend='dbdoclet.50438209_10424'/>.</para>
32     </section>
33     <section xml:id="dbdoclet.50438209_48033">
34       <title>18.2 Lustre File <anchor xml:id="dbdoclet.50438209_marker-1291832" xreflabel=""/>Striping Considerations</title>
35       <para><anchor xml:id="dbdoclet.50438209_pgfId-1296641" xreflabel=""/>Whether you should set up file striping and what parameter values you select depends on your need. A good rule of thumb is to stripe over as few objects as will meet those needs and no more.</para>
36       <para><anchor xml:id="dbdoclet.50438209_pgfId-1296653" xreflabel=""/>Some reasons for using striping include:</para>
37       <itemizedlist><listitem>
38           <para><anchor xml:id="dbdoclet.50438209_pgfId-1296634" xreflabel=""/><emphasis role="bold">Providing high-bandwidth access</emphasis>  - Many applications require high-bandwidth access to a single file - more bandwidth than can be provided by a single OSS. For example, scientific applications that write to a single file from hundreds of nodes, or a binary executable that is loaded by many nodes when an application starts.</para>
39
40       <para><anchor xml:id="dbdoclet.50438209_pgfId-1294264" xreflabel=""/>In cases like these, a file can be striped over as many OSSs as it takes to achieve the required peak aggregate bandwidth for that file. Striping across a larger number of OSSs should only be used when the file size is very large and/or is accessed by many nodes at a time. Currently, Lustre files can be striped across up to 160 OSSs, the maximum stripe count for an ldiskfs file system.</para>
41   </listitem><listitem>
42           <para><anchor xml:id="dbdoclet.50438209_pgfId-1294265" xreflabel=""/><emphasis role="bold">Improving performance when OSS bandwidth is exceeded</emphasis>  - Striping across many OSSs can improve performance if the aggregate client bandwidth exceeds the server bandwidth and the application reads and writes data fast enough to take advantage of the additional OSS bandwidth. The largest useful stripe count is bounded by the I/O rate of the clients/jobs divided by the performance per OSS.</para>
43         </listitem>
44 <listitem>
45           <para><anchor xml:id="dbdoclet.50438209_pgfId-1294262" xreflabel=""/><emphasis role="bold">Providing space for very large files.</emphasis>  Striping is also useful when a single OST does not have enough free space to hold the entire file.</para>
46         </listitem>
47 </itemizedlist>
48       <para><anchor xml:id="dbdoclet.50438209_pgfId-1296431" xreflabel=""/>Some reasons to minimize or avoid striping:</para>
49       <itemizedlist><listitem>
50           <para><anchor xml:id="dbdoclet.50438209_pgfId-1296706" xreflabel=""/><emphasis role="bold">Increased overhead</emphasis>  - Striping results in more locks and extra network operations during common operations such as stat and unlink. Even when these operations are performed in parallel, one network operation takes less time than 100 operations.</para>
51       <para><anchor xml:id="dbdoclet.50438209_pgfId-1291856" xreflabel=""/>Increased overhead also results from server contention. Consider a cluster with 100 clients and 100 OSSs, each with one OST. If each file has exactly one object and the load is distributed evenly, there is no contention and the disks on each server can manage sequential I/O. If each file has 100 objects, then the clients all compete with one another for the attention of the servers, and the disks on each node seek in 100 different directions. In this case, there is needless contention.</para>
52   </listitem><listitem>
53           <para><anchor xml:id="dbdoclet.50438209_pgfId-1291857" xreflabel=""/><emphasis role="bold">Increased risk</emphasis>  - When a file is striped across all servers and one of the servers breaks down, a small part of each striped file is lost. By comparison, if each file has exactly one stripe, you lose fewer files, but you lose them in their entirety. Many users would prefer to lose some of their files entirely than all of their files partially.</para>
54         </listitem>
55 </itemizedlist>
56       <section remap="h3">
57         <title><anchor xml:id="dbdoclet.50438209_pgfId-1291860" xreflabel=""/>18.2.1 Choosing a Stripe <anchor xml:id="dbdoclet.50438209_marker-1291859" xreflabel=""/>Size</title>
58         <para><anchor xml:id="dbdoclet.50438209_pgfId-1296612" xreflabel=""/>Choosing a stripe size is a small balancing act, but there are reasonable defaults.</para>
59         <itemizedlist><listitem>
60             <para><anchor xml:id="dbdoclet.50438209_pgfId-1296443" xreflabel=""/><emphasis role="bold">The stripe size must be a multiple of the page size.</emphasis>  Lustre’s tools enforce a multiple of 64 KB (the maximum page size on ia64 and PPC64 nodes) so that users on platforms with smaller pages do not accidentally create files that might cause problems for ia64 clients.</para>
61           </listitem>
62 <listitem>
63             <para><anchor xml:id="dbdoclet.50438209_pgfId-1291862" xreflabel=""/><emphasis role="bold">The smallest recommended stripe size is 512 KB.</emphasis>  Although you can create files with a stripe size of 64 KB, the smallest practical stripe size is 512 KB because Lustre sends 1MB chunks over the network. Choosing a smaller stripe size may result in inefficient I/O to the disks and reduced performance.</para>
64           </listitem>
65 <listitem>
66             <para><anchor xml:id="dbdoclet.50438209_pgfId-1291864" xreflabel=""/><emphasis role="bold">A good stripe size for sequential I/O using high-speed networks is between 1 MB and 4 MB.</emphasis>  In most situations, stripe sizes larger than 4 MB may result in longer lock hold times and contention on shared file access.</para>
67           </listitem>
68 <listitem>
69             <para><anchor xml:id="dbdoclet.50438209_pgfId-1297206" xreflabel=""/><emphasis role="bold">The maximum stripe size is 4GB.</emphasis>  Using a large stripe size can improve performance when accessing very large files. It allows each client to have exclusive access to its own part of a file. However, it can be counterproductive in some cases if it does not match your I/O pattern.</para>
70           </listitem>
71 <listitem>
72             <para><anchor xml:id="dbdoclet.50438209_pgfId-1291865" xreflabel=""/><emphasis role="bold">Choose a stripe pattern that takes into account your application’s write patterns.</emphasis>  Writes that cross an object boundary are slightly less efficient than writes that go entirely to one server. If the file is written in a very consistent and aligned way, make the stripe size a multiple of the write() size.</para>
73           </listitem>
74 <listitem>
75             <para><anchor xml:id="dbdoclet.50438209_pgfId-1291866" xreflabel=""/><emphasis role="bold">The choice of stripe size has no effect on a single-stripe file.</emphasis></para>
76           </listitem>
77 </itemizedlist>
78       </section>
79     </section>
80     <section xml:id="dbdoclet.50438209_78664">
81       <title>18.3 Setting the File Layout/Striping Configuration (lfs setstripe)</title>
82       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297878" xreflabel=""/>Use the lfs setstripe command to create new files with a specific file layout (stripe pattern) configuration.</para>
83       <screen><anchor xml:id="dbdoclet.50438209_pgfId-1297879" xreflabel=""/>lfs setstripe [--size|-s stripe_size] [--count|-c stripe_count] 
84 <anchor xml:id="dbdoclet.50438209_pgfId-1297880" xreflabel=""/>[--index|-i start_ost] [--pool|-p pool_name] &lt;filename|dirname&gt; 
85 </screen>
86       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297881" xreflabel=""/><emphasis role="bold">stripe_size</emphasis></para>
87       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297882" xreflabel=""/>The stripe size indicates how much data to write to one OST before moving to the next OST. The default stripe_size is 1 MB, and passing a stripe_size of 0 causes the default stripe size to be used. Otherwise, the stripe_size value must be a multiple of 64 KB.</para>
88       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297883" xreflabel=""/><emphasis role="bold">stripe_count</emphasis></para>
89       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297884" xreflabel=""/>The stripe count indicates how many OSTs to use. The default stripe_count value is 1. Setting stripe_count to 0 causes the default stripe count to be used. Setting stripe_count to -1 means stripe over all available OSTs (full OSTs are skipped).</para>
90       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297885" xreflabel=""/><emphasis role="bold">start_ost</emphasis></para>
91       <para><anchor xml:id="dbdoclet.50438209_pgfId-1298131" xreflabel=""/>The start OST is the first OST to which files are written. The default value for start_ost is -1 , which allows the MDS to choose the starting index. This setting is strongly recommended, as it allows space and load balancing to be done by the MDS as needed. Otherwise, the file starts on the specified OST index. The numbering of the OSTs starts at 0.</para>
92               <note><para>If you pass a start_ost value of 0 and a stripe_count value of <emphasis>1</emphasis>, all files are written to OST 0, until space is exhausted. This is probably not what you meant to do. If you only want to adjust the stripe count and keep the other parameters at their default settings, do not specify any of the other parameters:</para><para>lfs setstripe -c &lt;stripe_count&gt; &lt;file&gt;</para></note>
93        <para><anchor xml:id="dbdoclet.50438209_pgfId-1297973" xreflabel=""/><emphasis role="bold">pool_name</emphasis></para>
94       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297976" xreflabel=""/>Specify the OST pool on which the file will be written. This allows limiting the OSTs used to a subset of all OSTs in the file system. For more details about using OST pools, see <link xl:href="ManagingFileSystemIO.html#50438211_75549">Creating and Managing OST Pools</link>.</para>
95       <section remap="h3">
96         <title><anchor xml:id="dbdoclet.50438209_pgfId-1297896" xreflabel=""/>18.3.1 <anchor xml:id="dbdoclet.50438209_48100" xreflabel=""/>Using a Specific Striping Pattern/File Layout for a Single File</title>
97         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297948" xreflabel=""/>It is possible to specify the file layout when a new file is created using the command lfssetstripe. This allows users to override the file system default parameters to tune the file layout more optimally for their application. Execution of an lfssetstripe command fails if the file already exists.</para>
98         <section remap="h4">
99           <title><anchor xml:id="dbdoclet.50438209_pgfId-1298004" xreflabel=""/>18.3.1.1 <anchor xml:id="dbdoclet.50438209_60155" xreflabel=""/>Setting the Stripe Size</title>
100           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298005" xreflabel=""/>The command to create a new file with a specified stripe size is similar to:</para>
101           <screen><anchor xml:id="dbdoclet.50438209_pgfId-1298006" xreflabel=""/>[client]# lfs setstripe -s 4M /mnt/lustre/new_file
102 </screen>
103           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298007" xreflabel=""/>This example command creates the new file /mnt/lustre/new_file with a stripe size of 4 MB.</para>
104           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298232" xreflabel=""/>Now, when a file is created, the new stripe setting evenly distributes the data over all the available OSTs:</para>
105           <screen><anchor xml:id="dbdoclet.50438209_pgfId-1298011" xreflabel=""/> 
106 <anchor xml:id="dbdoclet.50438209_pgfId-1298012" xreflabel=""/>[client]# lfs getstripe /mnt/lustre/new_file
107 <anchor xml:id="dbdoclet.50438209_pgfId-1298013" xreflabel=""/>/mnt/lustre/4mb_file
108 <anchor xml:id="dbdoclet.50438209_pgfId-1298014" xreflabel=""/>lmm_stripe_count:   1
109 <anchor xml:id="dbdoclet.50438209_pgfId-1298015" xreflabel=""/>lmm_stripe_size:    4194304
110 <anchor xml:id="dbdoclet.50438209_pgfId-1298016" xreflabel=""/>lmm_stripe_offset:  1
111 <anchor xml:id="dbdoclet.50438209_pgfId-1298017" xreflabel=""/>obdidx     objid                   objid                           group
112 <anchor xml:id="dbdoclet.50438209_pgfId-1298018" xreflabel=""/>1  690550                  0xa8976                         0 
113 </screen>
114           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298019" xreflabel=""/>As can be seen, the stripe size is 4 MB.</para>
115         </section>
116         <section remap="h4">
117           <title><anchor xml:id="dbdoclet.50438209_pgfId-1298020" xreflabel=""/>18.3.1.2 Setting the Stripe Count</title>
118           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298021" xreflabel=""/>The command below creates a new file with a stripe count of -1 to specify striping over all available OSTs:</para>
119           <screen><anchor xml:id="dbdoclet.50438209_pgfId-1298022" xreflabel=""/>[client]# lfs setstripe -c -1 /mnt/lustre/full_stripe
120 </screen>
121           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298028" xreflabel=""/>The example below indicates that the file full_stripe is striped over all six active OSTs in the configuration:</para>
122           <screen><anchor xml:id="dbdoclet.50438209_pgfId-1298029" xreflabel=""/>[client]# lfs getstripe /mnt/lustre/full_stripe
123 <anchor xml:id="dbdoclet.50438209_pgfId-1298030" xreflabel=""/>/mnt/lustre/full_stripe
124 <anchor xml:id="dbdoclet.50438209_pgfId-1298031" xreflabel=""/>obdidx objid objid group
125 <anchor xml:id="dbdoclet.50438209_pgfId-1298032" xreflabel=""/>0  8       0x8             0
126 <anchor xml:id="dbdoclet.50438209_pgfId-1298033" xreflabel=""/>1  4       0x4             0
127 <anchor xml:id="dbdoclet.50438209_pgfId-1298034" xreflabel=""/>2  5       0x5             0
128 <anchor xml:id="dbdoclet.50438209_pgfId-1298035" xreflabel=""/>3  5       0x5             0
129 <anchor xml:id="dbdoclet.50438209_pgfId-1298036" xreflabel=""/>4  4       0x4             0
130 <anchor xml:id="dbdoclet.50438209_pgfId-1298037" xreflabel=""/>5  2       0x2             0
131 </screen>
132           <para><anchor xml:id="dbdoclet.50438209_pgfId-1298040" xreflabel=""/> This is in contrast to the output in <link xl:href="ManagingStripingFreeSpace.html#50438209_60155">Setting the Stripe Size</link> which shows only a single object for the file.</para>
133         </section>
134       </section>
135       <section remap="h3">
136         <title><anchor xml:id="dbdoclet.50438209_pgfId-1297942" xreflabel=""/>18.3.2 Changing Striping for a Directory</title>
137         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297943" xreflabel=""/>In a directory, the lfssetstripe command sets a default striping configuration for files created in the directory. The usage is the same as lfssetstripe for a regular file, except that the directory must exist prior to setting the default striping configuration. If a file is created in a directory with a default stripe configuration (without otherwise specifying striping), Lustre uses those striping parameters instead of the file system default for the new file.</para>
138         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297944" xreflabel=""/>To change the striping pattern (file layout) for a sub-directory, create a directory with desired file layout as described above. Sub-directories inherit the file layout of the root/parent directory.</para>
139       </section>
140       <section remap="h3">
141         <title><anchor xml:id="dbdoclet.50438209_pgfId-1298250" xreflabel=""/>18.3.3 Changing Striping for a File System</title>
142         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297945" xreflabel=""/>Change the striping on the file system root will change the striping for all newly created files that would otherwise have a striping parameter from the parent directory or explicitly on the command line.</para>
143         <informaltable frame="none">
144           <tgroup cols="1">
145             <colspec colname="c1" colwidth="100*"/>
146             <tbody>
147               <row>
148                 <entry><para><emphasis role="bold">Note -</emphasis><anchor xml:id="dbdoclet.50438209_pgfId-1298262" xreflabel=""/>Striping of new files and sub-directories is done per the striping parameter settings of the root directory. Once you set striping on the root directory, then, by default, it applies to any new child directories created in that root directory (unless they have their own striping settings).</para></entry>
149               </row>
150             </tbody>
151           </tgroup>
152         </informaltable>
153       </section>
154       <section remap="h3">
155         <title><anchor xml:id="dbdoclet.50438209_pgfId-1297901" xreflabel=""/>18.3.4 Creating a File on a Specific OST</title>
156         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297902" xreflabel=""/>You can use lfs setstripe to create a file on a specific OST. In the following example, the file &quot;bob&quot; will be created on the first OST (id 0).</para>
157         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1297903" xreflabel=""/>$ lfs setstripe --count 1 --index 0 bob
158 <anchor xml:id="dbdoclet.50438209_pgfId-1297904" xreflabel=""/>$ dd if=/dev/zero of=bob count=1 bs=100M
159 <anchor xml:id="dbdoclet.50438209_pgfId-1297905" xreflabel=""/>1+0 records in
160 <anchor xml:id="dbdoclet.50438209_pgfId-1297906" xreflabel=""/>1+0 records out
161 <anchor xml:id="dbdoclet.50438209_pgfId-1297907" xreflabel=""/>$ lfs getstripe bob
162 </screen>
163         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297908" xreflabel=""/>OBDS:</para>
164         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1297909" xreflabel=""/>0: home-OST0000_UUID ACTIVE
165 <anchor xml:id="dbdoclet.50438209_pgfId-1297910" xreflabel=""/>[...]
166 <anchor xml:id="dbdoclet.50438209_pgfId-1297911" xreflabel=""/>bob
167 <anchor xml:id="dbdoclet.50438209_pgfId-1297912" xreflabel=""/>   obdidx          objid                   objid                   group
168 <anchor xml:id="dbdoclet.50438209_pgfId-1297913" xreflabel=""/>   0               33459243                0x1fe8c2b               0
169 </screen>
170       </section>
171     </section>
172     <section xml:id="dbdoclet.50438209_44776">
173       <title>18.4 Retrieving File Layout/Striping Information (getstripe)</title>
174       <para><anchor xml:id="dbdoclet.50438209_pgfId-1297836" xreflabel=""/>The lfsgetstripe command is used to display information that shows over which OSTs a file is distributed. For each OST, the index and UUID is displayed, along with the OST index and object ID for each stripe in the file. For directories, the default settings for files created in that directory are printed.</para>
175       <section remap="h3">
176         <title><anchor xml:id="dbdoclet.50438209_pgfId-1297837" xreflabel=""/>18.4.1 Displaying the Current Stripe Size</title>
177         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297838" xreflabel=""/>To see the current stripe size, use the lfsgetstripe command on a Lustre file or directory. For example:</para>
178         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295575" xreflabel=""/>[client]# lfs getstripe /mnt/lustre 
179 </screen>
180         <para><anchor xml:id="dbdoclet.50438209_pgfId-1296462" xreflabel=""/>This command produces output similar to this:</para>
181         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295583" xreflabel=""/>/mnt/lustre 
182 <anchor xml:id="dbdoclet.50438209_pgfId-1295584" xreflabel=""/>(Default) stripe_count: 1 stripe_size: 1M stripe_offset: -1
183 </screen>
184         <para><anchor xml:id="dbdoclet.50438209_pgfId-1295585" xreflabel=""/>In this example, the default stripe count is 1 (data blocks are striped over a single OSTs), the default stripe size is 1 MB, and objects are created over all available OSTs.</para>
185       </section>
186       <section remap="h3">
187         <title><anchor xml:id="dbdoclet.50438209_pgfId-1297424" xreflabel=""/>18.4.2 Inspecting the File Tree</title>
188         <para><anchor xml:id="dbdoclet.50438209_pgfId-1296903" xreflabel=""/>To inspect an entire tree of files, use the lfs find command:</para>
189         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295699" xreflabel=""/>lfs find [--recursive | -r] &lt;file or directory&gt; ...
190 </screen>
191         <para><anchor xml:id="dbdoclet.50438209_pgfId-1295700" xreflabel=""/>You can also use ls -l /proc/<emphasis>&lt;pid&gt;</emphasis>/fd/ to find open files using Lustre. For example:</para>
192         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295701" xreflabel=""/>$ lfs getstripe $(readlink /proc/$(pidof cat)/fd/1)
193 </screen>
194         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297751" xreflabel=""/>Typical output is:</para>
195         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295707" xreflabel=""/>/mnt/lustre/foo
196 <anchor xml:id="dbdoclet.50438209_pgfId-1295708" xreflabel=""/>obdidx                     objid                   objid                   \
197 group
198 <anchor xml:id="dbdoclet.50438209_pgfId-1297465" xreflabel=""/>2                  835487                  0xcbf9f                 0
199 </screen>
200         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297466" xreflabel=""/>In this example, the file lives on obdidx 2, which is lustre-OST0002. To see which node is serving that OST, run:</para>
201         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1297482" xreflabel=""/>$ lctl get_param osc.lustre-OST0002-osc.ost_conn_uuid
202 </screen>
203         <para><anchor xml:id="dbdoclet.50438209_pgfId-1297761" xreflabel=""/>Typical output is:</para>
204         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295712" xreflabel=""/>osc.lustre-OST0002-osc.ost_conn_uuid=192.168.20.1@tcp
205 </screen>
206       </section>
207     </section>
208     <section xml:id="dbdoclet.50438209_10424">
209       <title>18.5 Managing Free <anchor xml:id="dbdoclet.50438209_marker-1295520" xreflabel=""/>Space</title>
210       <para><anchor xml:id="dbdoclet.50438209_pgfId-1293927" xreflabel=""/>The MDT assigns file stripes to OSTs based on location (which OSS) and size considerations (free space) to optimize file system performance. Emptier OSTs are preferentially selected for stripes, and stripes are preferentially spread out between OSSs to increase network bandwidth utilization. The weighting factor between these two optimizations can be adjusted by the user.</para>
211       <section remap="h3">
212         <title><anchor xml:id="dbdoclet.50438209_pgfId-1293929" xreflabel=""/>18.5.1 <anchor xml:id="dbdoclet.50438209_35838" xreflabel=""/>Checking File System Free Space</title>
213         <para><anchor xml:id="dbdoclet.50438209_pgfId-1293930" xreflabel=""/>Free space is an important consideration in assigning file stripes. The lfsdf command shows available disk space on the mounted Lustre file system and space consumption per OST. If multiple Lustre file systems are mounted, a path may be specified, but is not required.</para>
214         <informaltable frame="all">
215           <tgroup cols="2">
216             <colspec colname="c1" colwidth="50*"/>
217             <colspec colname="c2" colwidth="50*"/>
218             <thead>
219               <row>
220                 <entry><para><emphasis role="bold"><anchor xml:id="dbdoclet.50438209_pgfId-1293933" xreflabel=""/>Option</emphasis></para></entry>
221                 <entry><para><emphasis role="bold"><anchor xml:id="dbdoclet.50438209_pgfId-1293935" xreflabel=""/>Description</emphasis></para></entry>
222               </row>
223             </thead>
224             <tbody>
225               <row>
226                 <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293937" xreflabel=""/><emphasis role="bold">-h</emphasis></para></entry>
227                 <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293939" xreflabel=""/>Human-readable print sizes in human readable format (for example: 1K, 234M, 5G).</para></entry>
228               </row>
229               <row>
230                 <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293941" xreflabel=""/><emphasis role="bold">-i, --inodes</emphasis></para></entry>
231                 <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293943" xreflabel=""/>Lists inodes instead of block usage.</para></entry>
232               </row>
233             </tbody>
234           </tgroup>
235         </informaltable>
236          <informaltable frame="none">
237           <tgroup cols="1">
238             <colspec colname="c1" colwidth="100*"/>
239             <tbody>
240               <row>
241                 <entry><para><emphasis role="bold">Note -</emphasis><anchor xml:id="dbdoclet.50438209_pgfId-1293944" xreflabel=""/>The df-i and lfsdf-i commands show the minimum number of inodes that can be created in the file system. Depending on the configuration, it may be possible to create more inodes than initially reported by df-i. Later, df-i operations will show the current, estimated free inode count.</para><para> If the underlying file system has fewer free blocks than inodes, then the total inode count for the file system reports only as many inodes as there are free blocks. This is done because Lustre may need to store an external attribute for each new inode, and it is better to report a free inode count that is the guaranteed, minimum number of inodes that can be created.</para></entry>
242               </row>
243             </tbody>
244           </tgroup>
245         </informaltable>
246          <para><anchor xml:id="dbdoclet.50438209_pgfId-1293952" xreflabel=""/><emphasis role="bold">Examples</emphasis></para>
247         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1293953" xreflabel=""/>[lin-cli1] $ lfs df
248 <anchor xml:id="dbdoclet.50438209_pgfId-1293954" xreflabel=""/>UUID                       1K-blockS               Used                    \
249 Available               Use%            Mounted on
250 <anchor xml:id="dbdoclet.50438209_pgfId-1293955" xreflabel=""/>mds-lustre-0_UUID  9174328                 1020024                 8154304 \
251                 11%             /mnt/lustre[MDT:0]
252 <anchor xml:id="dbdoclet.50438209_pgfId-1293956" xreflabel=""/>ost-lustre-0_UUID  94181368                56330708                37850660\
253                 59%             /mnt/lustre[OST:0]
254 <anchor xml:id="dbdoclet.50438209_pgfId-1293957" xreflabel=""/>ost-lustre-1_UUID  94181368                56385748                37795620\
255                 59%             /mnt/lustre[OST:1]
256 <anchor xml:id="dbdoclet.50438209_pgfId-1293958" xreflabel=""/>ost-lustre-2_UUID  94181368                54352012                39829356\
257                 57%             /mnt/lustre[OST:2]
258 <anchor xml:id="dbdoclet.50438209_pgfId-1293959" xreflabel=""/>filesystem summary:        282544104               167068468               \
259 39829356                57%             /mnt/lustre
260 <anchor xml:id="dbdoclet.50438209_pgfId-1293960" xreflabel=""/> 
261 <anchor xml:id="dbdoclet.50438209_pgfId-1293961" xreflabel=""/>[lin-cli1] $ lfs df -h
262 <anchor xml:id="dbdoclet.50438209_pgfId-1293962" xreflabel=""/>UUID                       bytes                   Used                    \
263 Available               Use%            Mounted on
264 <anchor xml:id="dbdoclet.50438209_pgfId-1293963" xreflabel=""/>mds-lustre-0_UUID  8.7G                    996.1M                  7.8G    \
265                 11%             /mnt/lustre[MDT:0]
266 <anchor xml:id="dbdoclet.50438209_pgfId-1293964" xreflabel=""/>ost-lustre-0_UUID  89.8G                   53.7G                   36.1G   \
267                 59%             /mnt/lustre[OST:0]
268 <anchor xml:id="dbdoclet.50438209_pgfId-1293965" xreflabel=""/>ost-lustre-1_UUID  89.8G                   53.8G                   36.0G   \
269                 59%             /mnt/lustre[OST:1]
270 <anchor xml:id="dbdoclet.50438209_pgfId-1293966" xreflabel=""/>ost-lustre-2_UUID  89.8G                   51.8G                   38.0G   \
271                 57%             /mnt/lustre[OST:2]
272 <anchor xml:id="dbdoclet.50438209_pgfId-1293967" xreflabel=""/>filesystem summary:        269.5G                  159.3G                  \
273 110.1G                  59%             /mnt/lustre
274 <anchor xml:id="dbdoclet.50438209_pgfId-1293968" xreflabel=""/> 
275 <anchor xml:id="dbdoclet.50438209_pgfId-1293969" xreflabel=""/>[lin-cli1] $ lfs df -i 
276 <anchor xml:id="dbdoclet.50438209_pgfId-1293970" xreflabel=""/>UUID                       Inodes                  IUsed                   \
277 IFree                   IUse%           Mounted on
278 <anchor xml:id="dbdoclet.50438209_pgfId-1293971" xreflabel=""/>mds-lustre-0_UUID  2211572                 41924                   2169648 \
279                 1%              /mnt/lustre[MDT:0]
280 <anchor xml:id="dbdoclet.50438209_pgfId-1293972" xreflabel=""/>ost-lustre-0_UUID  737280                  12183                   725097  \
281                 1%              /mnt/lustre[OST:0]
282 <anchor xml:id="dbdoclet.50438209_pgfId-1293973" xreflabel=""/>ost-lustre-1_UUID  737280                  12232                   725048  \
283                 1%              /mnt/lustre[OST:1]
284 <anchor xml:id="dbdoclet.50438209_pgfId-1293974" xreflabel=""/>ost-lustre-2_UUID  737280                  12214                   725066  \
285                 1%              /mnt/lustre[OST:2]
286 <anchor xml:id="dbdoclet.50438209_pgfId-1293975" xreflabel=""/>filesystem summary:        2211572                 41924                   \
287 2169648                 1%              /mnt/lustre[OST:2]
288 </screen>
289       </section>
290       <section remap="h3">
291         <title><anchor xml:id="dbdoclet.50438209_pgfId-1293986" xreflabel=""/>18.5.2 Using Stripe Allocations</title>
292         <para><anchor xml:id="dbdoclet.50438209_pgfId-1295862" xreflabel=""/>Two stripe allocation methods are provided: <emphasis>round-robin</emphasis> and <emphasis>weighted</emphasis>. By default, the allocation method is determined by the amount of free-space imbalance on the OSTs. The weighted allocator is used when any two OSTs are imbalanced by more than 20%. Otherwise, the faster round-robin allocator is used. (The round-robin order maximizes network balancing.)</para>
293         <itemizedlist><listitem>
294             <para><anchor xml:id="dbdoclet.50438209_pgfId-1293989" xreflabel=""/><emphasis role="bold">Round-robin allocator</emphasis><anchor xml:id="dbdoclet.50438209_marker-1293988" xreflabel=""/>  - When OSTs have approximately the same amount of free space (within 20%), an efficient round-robin allocator is used. The round-robin allocator alternates stripes between OSTs on different OSSs, so the OST used for stripe 0 of each file is evenly distributed among OSTs, regardless of the stripe count. Here are several sample round-robin stripe orders (each letter represents a different OST on a single OSS):</para>
295              <informaltable frame="none">
296               <tgroup cols="2">
297                 <colspec colname="c1" colwidth="50*"/>
298                 <colspec colname="c2" colwidth="50*"/>
299                 <tbody>
300                   <row>
301                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293993" xreflabel=""/>3: AAA</para></entry>
302                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293995" xreflabel=""/>One 3-OST OSS</para></entry>
303                   </row>
304                   <row>
305                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293997" xreflabel=""/>3x3: ABABAB</para></entry>
306                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1293999" xreflabel=""/>Two 3-OST OSSs</para></entry>
307                   </row>
308                   <row>
309                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1294001" xreflabel=""/>3x4: BBABABA</para></entry>
310                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1294003" xreflabel=""/>One 3-OST OSS (A) and one 4-OST OSS (B)</para></entry>
311                   </row>
312                   <row>
313                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1294005" xreflabel=""/>3x5: BBABBABA</para></entry>
314                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1294007" xreflabel=""/>One 3-OST OSS (A) and one 5-OST OSS (B)</para></entry>
315                   </row>
316                   <row>
317                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1294009" xreflabel=""/>3x3x3: ABCABCABC</para></entry>
318                     <entry><para> <anchor xml:id="dbdoclet.50438209_pgfId-1294011" xreflabel=""/>Three 3-OST OSSs</para></entry>
319                   </row>
320                 </tbody>
321               </tgroup>
322             </informaltable>
323            </listitem>
324 <listitem>
325             <para><anchor xml:id="dbdoclet.50438209_pgfId-1294021" xreflabel=""/><emphasis role="bold">Weighted allocator</emphasis><anchor xml:id="dbdoclet.50438209_marker-1294020" xreflabel=""/>  - When the free space difference between the OSTs is significant (by default, 20% of the free space), then a weighting algorithm is used to influence OST ordering based on size and location. Note that these are weightings for a random algorithm, so the OST with the most free space is not necessarily chosen each time. On average, the weighted allocator fills the emptier OSTs faster.</para>
326           </listitem>
327 </itemizedlist>
328       </section>
329       <section remap="h3">
330         <title><anchor xml:id="dbdoclet.50438209_pgfId-1294034" xreflabel=""/>18.5.3 Adjusting the <anchor xml:id="dbdoclet.50438209_marker-1294033" xreflabel=""/>Weighting Between Free Space and Location</title>
331         <para><anchor xml:id="dbdoclet.50438209_pgfId-1295878" xreflabel=""/>The weighting priority can be adjusted in the /proc file /proc/fs/lustre/lov/lustre-mdtlov/qos_prio_free proc. The default value is 90%. Use this command on the MGS to permanently change this weighting:</para>
332         <screen><anchor xml:id="dbdoclet.50438209_pgfId-1295879" xreflabel=""/>lctl conf_param &lt;fsname&gt;-MDT0000.lov.qos_prio_free=90
333 </screen>
334         <para><anchor xml:id="dbdoclet.50438209_pgfId-1295880" xreflabel=""/>Increasing this value puts more weighting on free space. When the free space priority is set to 100%, then location is no longer used in stripe-ordering calculations and weighting is based entirely on free space.</para>
335                 <note><para>Setting the priority to 100% means that OSS distribution does not count in the weighting, but the stripe assignment is still done via a weighting. For example, if OST2 has twice as much free space as OST1, then OST2 is twice as likely to be used, but it is not guaranteed to be used.</para></note>
336       </section>
337     </section>
338 </chapter>