Whamcloud - gitweb
LUDOC-445 fix minor typo
[doc/manual.git] / ConfiguringStorage.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="configuringstorage">
2   <title xml:id="configuringstorage.title">Configuring Storage on a Lustre File System</title>
3   <para>This chapter describes best practices for storage selection and file system options to optimize performance on RAID, and includes the following sections:</para>
4   <itemizedlist>
5     <listitem>
6       <para>
7             <xref linkend="dbdoclet.50438208_60972"/>
8         </para>
9     </listitem>
10     <listitem>
11       <para>
12             <xref linkend="dbdoclet.50438208_23285"/>
13         </para>
14     </listitem>
15     <listitem>
16       <para>
17             <xref linkend="dbdoclet.50438208_40705"/>
18         </para>
19     </listitem>
20     <listitem>
21       <para>
22             <xref linkend="dbdoclet.ldiskfs_raid_opts"/>
23         </para>
24     </listitem>
25     <listitem>
26       <para>
27             <xref linkend="dbdoclet.50438208_88516"/>
28         </para>
29     </listitem>
30   </itemizedlist>
31   <note>
32     <para><emphasis role="bold">It is strongly recommended that storage used in a Lustre file system
33         be configured with hardware RAID.</emphasis> The Lustre software does not support redundancy
34       at the file system level and RAID is required to protect against disk failure.</para>
35   </note>
36   <section xml:id="dbdoclet.50438208_60972">
37       <title>
38           <indexterm><primary>storage</primary><secondary>configuring</secondary></indexterm>
39           Selecting Storage for the MDT and OSTs</title>
40     <para>The Lustre architecture allows the use of any kind of block device as backend storage. The characteristics of such devices, particularly in the case of failures, vary significantly and have an impact on configuration choices.</para>
41     <para>This section describes issues and recommendations regarding backend storage.</para>
42     <section remap="h3">
43         <title><indexterm><primary>storage</primary><secondary>configuring</secondary><tertiary>MDT</tertiary></indexterm>Metadata Target (MDT)</title>
44       <para>I/O on the MDT is typically mostly reads and writes of small amounts of data. For this reason, we recommend that you use RAID 1 for MDT storage. If you require more capacity for an MDT than one disk provides, we recommend RAID 1 + 0 or RAID 10.</para>
45     </section>
46     <section remap="h3">
47       <title><indexterm><primary>storage</primary><secondary>configuring</secondary><tertiary>OST</tertiary></indexterm>Object Storage Server (OST)</title>
48       <para>A quick calculation makes it clear that without further redundancy, RAID 6 is required for large clusters and RAID 5 is not acceptable:</para>
49       <blockquote>
50         <para>For a 2 PB file system (2,000 disks of 1 TB capacity) assume the mean time to failure (MTTF) of a disk is about 1,000 days. This means that the expected failure rate is 2000/1000 = 2 disks per day. Repair time at 10% of disk bandwidth is 1000 GB at 10MB/sec = 100,000 sec, or about 1 day.</para>
51         <para>For a RAID 5 stripe that is 10 disks wide, during 1 day of rebuilding, the chance that a second disk in the same array will fail is about 9/1000 or about 1% per day. After 50 days, you have a 50% chance of a double failure in a RAID 5 array leading to data loss.</para>
52         <para>Therefore, RAID 6 or another double parity algorithm is needed to provide sufficient redundancy for OST storage.</para>
53       </blockquote>
54       <para>For better performance, we recommend that you create RAID sets with 4 or 8 data disks plus one or two parity disks. Using larger RAID sets will negatively impact performance compared to having multiple independent RAID sets.</para>
55       <para>To maximize performance for small I/O request sizes, storage configured as RAID 1+0 can yield much better results but will increase cost or reduce capacity.</para>
56     </section>
57   </section>
58   <section xml:id="dbdoclet.50438208_23285">
59     <title><indexterm><primary>storage</primary><secondary>configuring</secondary><tertiary>for best practice</tertiary></indexterm>Reliability Best Practices</title>
60     <para>RAID monitoring software is recommended to quickly detect faulty disks and allow them to be replaced to avoid double failures and data loss. Hot spare disks are recommended so that rebuilds happen without delays.</para>
61     <para>Backups of the metadata file systems are recommended. For details, see <xref linkend="backupandrestore"/>.</para>
62   </section>
63   <section xml:id="dbdoclet.50438208_40705">
64     <title><indexterm><primary>storage</primary><secondary>performance tradeoffs</secondary></indexterm>Performance Tradeoffs</title>
65     <para>A writeback cache can dramatically increase write performance on many types of RAID arrays if the writes are not done at full stripe width. Unfortunately, unless the RAID array has battery-backed cache (a feature only found in some higher-priced hardware RAID arrays), interrupting the power to the array may result in out-of-sequence writes or corruption of RAID parity and future data loss.</para>
66     <para>If writeback cache is enabled, a file system check is required after the array loses power. Data may also be lost because of this.</para>
67     <para>Therefore, we recommend against the use of writeback cache when data integrity is critical. You should carefully consider whether the benefits of using writeback cache outweigh the risks.</para>
68   </section>
69   <section xml:id="dbdoclet.ldiskfs_raid_opts">
70     <title>
71       <indexterm>
72         <primary>storage</primary>
73         <secondary>configuring</secondary>
74         <tertiary>RAID options</tertiary>
75       </indexterm>Formatting Options for ldiskfs RAID Devices</title>
76     <para>When formatting an ldiskfs file system on a RAID device, it can be
77     beneficial to ensure that I/O requests are aligned with the underlying
78     RAID geometry. This ensures that Lustre RPCs do not generate unnecessary
79     disk operations which may reduce performance dramatically. Use the
80     <literal>--mkfsoptions</literal> parameter to specify additional parameters
81     when formatting the OST or MDT.</para>
82     <para>For RAID 5, RAID 6, or RAID 1+0 storage, specifying the following
83     option to the <literal>--mkfsoptions</literal> parameter option improves
84     the layout of the file system metadata, ensuring that no single disk
85     contains all of the allocation bitmaps:</para>
86     <screen>-E stride = <replaceable>chunk_blocks</replaceable> </screen>
87     <para>The <literal><replaceable>chunk_blocks</replaceable></literal>
88     variable is in units of 4096-byte blocks and represents the amount of
89     contiguous data written to a single disk before moving to the next disk.
90     This is alternately referred to as the RAID stripe size. This is
91     applicable to both MDT and OST file systems.</para>
92     <para>For more information on how to override the defaults while formatting
93     MDT or OST file systems, see <xref linkend="dbdoclet.ldiskfs_mkfs_opts"/>.</para>
94     <section remap="h3">
95       <title><indexterm><primary>storage</primary><secondary>configuring</secondary><tertiary>for mkfs</tertiary></indexterm>Computing file system parameters for mkfs</title>
96       <para>For best results, use RAID 5 with 5 or 9 disks or RAID 6 with 6 or 10 disks, each on a different controller. The stripe width is the optimal minimum I/O size. Ideally, the RAID configuration should allow 1 MB Lustre RPCs to fit evenly on a single RAID stripe without an expensive read-modify-write cycle. Use this formula to determine the
97           <literal><replaceable>stripe_width</replaceable></literal>, where
98           <literal><replaceable>number_of_data_disks</replaceable></literal>
99         does <emphasis>not</emphasis> include the RAID parity disks (1 for RAID 5 and 2 for RAID 6):</para>
100       <screen><replaceable>stripe_width_blocks = chunk_blocks * number_of_data_disks</replaceable> = 1 MB </screen>
101       <para>If the RAID configuration does not allow
102           <literal><replaceable>chunk_blocks</replaceable></literal>
103         to fit evenly into 1 MB, select
104           <literal><replaceable>stripe_width_blocks</replaceable></literal>,
105         such that is close to 1 MB, but not larger.</para>
106       <para>The 
107           <literal><replaceable>stripe_width_blocks</replaceable></literal>
108         value must equal
109           <literal><replaceable>chunk_blocks</replaceable> * <replaceable>number_of_data_disks</replaceable></literal>.
110         Specifying the
111           <literal><replaceable>stripe_width_blocks</replaceable></literal>
112         parameter is only relevant for RAID 5 or RAID 6, and is not needed for RAID 1 plus 0.</para>
113       <para>Run <literal>--reformat</literal> on the file system device (<literal>/dev/sdc</literal>), specifying the RAID geometry to the underlying ldiskfs file system, where:</para>
114       <screen>--mkfsoptions &quot;<replaceable>other_options</replaceable> -E stride=<replaceable>chunk_blocks</replaceable>, stripe_width=<replaceable>stripe_width_blocks</replaceable>&quot;</screen>
115       <informalexample>
116         <para>A RAID 6 configuration with 6 disks has 4 data and 2 parity disks. The
117             <literal><replaceable>chunk_blocks</replaceable></literal>
118           &lt;= 1024KB/4 = 256KB.</para>
119       </informalexample>
120       <para>Because the number of data disks is equal to the power of 2, the stripe width is equal to 1 MB.</para>
121       <screen>--mkfsoptions &quot;<replaceable>other_options</replaceable> -E stride=<replaceable>chunk_blocks</replaceable>, stripe_width=<replaceable>stripe_width_blocks</replaceable>&quot;...</screen>
122     </section>
123     <section remap="h3">
124       <title><indexterm><primary>storage</primary><secondary>configuring</secondary><tertiary>external journal</tertiary></indexterm>Choosing Parameters for an External Journal</title>
125       <para>If you have configured a RAID array and use it directly as an OST, it contains both data and metadata. For better performance, we recommend putting the OST journal on a separate device, by creating a small RAID 1 array and using it as an external journal for the OST.</para>
126       <para>In a Lustre file system, the default journal size is 400 MB. A journal size of up to 1
127         GB has shown increased performance but diminishing returns are seen for larger journals.
128         Additionally, a copy of the journal is kept in RAM. Therefore, make sure you have enough
129         memory available to hold copies of all the journals.</para>
130       <para>The file system journal options are specified to <literal>mkfs.lustre</literal> using
131         the <literal>--mkfsoptions</literal> parameter. For example:</para>
132       <screen>--mkfsoptions &quot;<replaceable>other_options</replaceable> -j -J device=/dev/mdJ&quot; </screen>
133       <para>To create an external journal, perform these steps for each OST on the OSS:</para>
134       <orderedlist>
135         <listitem>
136           <para>Create a 400 MB (or larger) journal partition (RAID 1 is recommended).</para>
137           <para>In this example, <literal>/dev/sdb</literal> is a RAID 1 device.</para>
138         </listitem>
139         <listitem>
140           <para>Create a journal device on the partition. Run:</para>
141           <screen>oss# mke2fs -b 4096 -O journal_dev /dev/sdb <replaceable>journal_size</replaceable></screen>
142           <para>The value of
143               <literal><replaceable>journal_size</replaceable></literal>
144             is specified in units of 4096-byte blocks. For example, 262144 for a 1 GB journal size.</para>
145         </listitem>
146         <listitem>
147           <para>Create the OST.</para>
148           <para>In this example, <literal>/dev/sdc</literal> is the RAID 6 device to be used as the OST, run:</para>
149           <screen>[oss#] mkfs.lustre --ost ... \
150 --mkfsoptions=&quot;-J device=/dev/sdb1&quot; /dev/sdc</screen>
151         </listitem>
152         <listitem>
153           <para>Mount the OST as usual.</para>
154         </listitem>
155       </orderedlist>
156     </section>
157   </section>
158   <section xml:id="dbdoclet.50438208_88516">
159     <title><indexterm><primary>storage</primary><secondary>configuring</secondary><tertiary>SAN</tertiary></indexterm>Connecting a SAN to a Lustre File System</title>
160     <para>Depending on your cluster size and workload, you may want to connect a SAN to a Lustre file system. Before making this connection, consider the following:</para>
161     <itemizedlist>
162       <listitem>
163         <para>In many SAN file systems, clients allocate and lock blocks or inodes individually as
164           they are updated. The design of the Lustre file system avoids the high contention that
165           some of these blocks and inodes may have.</para>
166       </listitem>
167       <listitem>
168         <para>The Lustre file system is highly scalable and can have a very large number of clients.
169           SAN switches do not scale to a large number of nodes, and the cost per port of a SAN is
170           generally higher than other networking.</para>
171       </listitem>
172       <listitem>
173         <para>File systems that allow direct-to-SAN access from the clients have a security risk because clients can potentially read any data on the SAN disks, and misbehaving clients can corrupt the file system for many reasons like improper file system, network, or other kernel software, bad cabling, bad memory, and so on. The risk increases with increase in the number of clients directly accessing the storage.</para>
174       </listitem>
175     </itemizedlist>
176   </section>
177 </chapter>