Whamcloud - gitweb
LUDOC-25: typo fix
[doc/manual.git] / LustreOperations.xml
1 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- This document was created with Syntext Serna Free. --><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="lustreoperations">
3   <title xml:id="lustreoperations.title">Lustre Operations</title>
4   <para>Once you have the Lustre file system up and running, you can use the procedures in this section to perform these basic Lustre administration tasks:</para>
5   <itemizedlist>
6     <listitem>
7       <para><xref linkend="dbdoclet.50438194_42877"/></para>
8     </listitem>
9     <listitem>
10       <para><xref linkend="dbdoclet.50438194_24122"/></para>
11     </listitem>
12     <listitem>
13       <para><xref linkend="dbdoclet.50438194_84876"/></para>
14     </listitem>
15     <listitem>
16       <para><xref linkend="dbdoclet.50438194_69255"/></para>
17     </listitem>
18     <listitem>
19       <para><xref linkend="dbdoclet.50438194_57420"/></para>
20     </listitem>
21     <listitem>
22       <para><xref linkend="dbdoclet.50438194_54138"/></para>
23     </listitem>
24     <listitem>
25       <para><xref linkend="dbdoclet.50438194_88063"/></para>
26     </listitem>
27     <listitem>
28       <para><xref linkend="dbdoclet.50438194_88980"/></para>
29     </listitem>
30     <listitem>
31       <para><xref linkend="dbdoclet.50438194_41817"/></para>
32     </listitem>
33     <listitem>
34       <para><xref linkend="dbdoclet.50438194_70905"/></para>
35     </listitem>
36     <listitem>
37       <para><xref linkend="dbdoclet.50438194_16954"/></para>
38     </listitem>
39     <listitem>
40       <para><xref linkend="dbdoclet.50438194_69998"/></para>
41     </listitem>
42     <listitem>
43       <para><xref linkend="dbdoclet.50438194_30872"/></para>
44     </listitem>
45   </itemizedlist>
46   <section xml:id="dbdoclet.50438194_42877">
47     <title><indexterm><primary>operations</primary></indexterm>
48 <indexterm><primary>operations</primary><secondary>mounting by label</secondary></indexterm>
49 Mounting by Label</title>
50     <para>The file system name is limited to 8 characters. We have encoded the file system and target information in the disk label, so you can mount by label. This allows system administrators to move disks around without worrying about issues such as SCSI disk reordering or getting the <literal>/dev/device</literal> wrong for a shared target. Soon, file system naming will be made as fail-safe as possible. Currently, Linux disk labels are limited to 16 characters. To identify the target within the file system, 8 characters are reserved, leaving 8 characters for the file system name:</para>
51     <screen>&lt;fsname&gt;-MDT0000 or &lt;fsname&gt;-OST0a19</screen>
52     <para>To mount by label, use this command:</para>
53     <screen>$ mount -t lustre -L &lt;file system label&gt; &lt;mount point&gt;</screen>
54     <para>This is an example of mount-by-label:</para>
55     <screen>$ mount -t lustre -L testfs-MDT0000 /mnt/mdt</screen>
56     <caution>
57       <para>Mount-by-label should NOT be used in a multi-path environment.</para>
58     </caution>
59     <para>Although the file system name is internally limited to 8 characters, you can mount the clients at any mount point, so file system users are not subjected to short names. Here is an example:</para>
60     <screen>mount -t lustre mds0@tcp0:/shortfs /mnt/&lt;long-file_system-name&gt;</screen>
61   </section>
62   <section xml:id="dbdoclet.50438194_24122">
63     <title><indexterm><primary>operations</primary><secondary>starting</secondary></indexterm>Starting Lustre</title>
64     <para>The startup order of Lustre components depends on whether you have a combined MGS/MDT or these components are separate.</para>
65     <itemizedlist>
66       <listitem>
67         <para>If you have a combined MGS/MDT, the recommended startup order is OSTs, then the MGS/MDT, and then clients.</para>
68       </listitem>
69       <listitem>
70         <para> If the MGS and MDT are separate, the recommended startup order is: MGS, then OSTs, then the MDT, and then clients.</para>
71       </listitem>
72     </itemizedlist>
73     <note>
74       <para>If an OST is added to a Lustre file system with a combined MGS/MDT, then the startup order changes slightly; the MGS must be started first because the OST needs to write its configuration data to it. In this scenario, the startup order is MGS/MDT, then OSTs, then the clients.</para>
75     </note>
76   </section>
77   <section xml:id="dbdoclet.50438194_84876">
78     <title><indexterm><primary>operations</primary><secondary>mounting</secondary></indexterm>Mounting a Server</title>
79     <para>Starting a Lustre server is straightforward and only involves the mount command. Lustre servers can be added to <literal>/etc/fstab</literal>:</para>
80     <screen>mount -t lustre</screen>
81     <para>The mount command generates output similar to this:</para>
82     <screen>/dev/sda1 on /mnt/test/mdt type lustre (rw)
83 /dev/sda2 on /mnt/test/ost0 type lustre (rw)
84 192.168.0.21@tcp:/testfs on /mnt/testfs type lustre (rw)</screen>
85     <para>In this example, the MDT, an OST (ost0) and file system (testfs) are mounted.</para>
86     <screen>LABEL=testfs-MDT0000 /mnt/test/mdt lustre defaults,_netdev,noauto 0 0
87 LABEL=testfs-OST0000 /mnt/test/ost0 lustre defaults,_netdev,noauto 0 0</screen>
88     <para>In general, it is wise to specify noauto and let your high-availability (HA) package manage when to mount the device. If you are not using failover, make sure that networking has been started before mounting a Lustre server. RedHat, SuSE, Debian (and perhaps others) use the <literal>_netdev</literal> flag to ensure that these disks are mounted after the network is up.</para>
89     <para>We are mounting by disk label here. The label of a device can be read with <literal>e2label</literal>. The label of a newly-formatted Lustre server may end in <literal>FFFF</literal> if the <literal>--index</literal> option is not specified to <literal>mkfs.lustre</literal>, meaning that it has yet to be assigned. The assignment takes place when the server is first started, and the disk label is updated.  It is recommended that the <literal>--index</literal> option always be used, which will also ensure that the label is set at format time.</para>
90     <caution>
91       <para>Do not do this when the client and OSS are on the same node, as memory pressure between the client and OSS can lead to deadlocks.</para>
92     </caution>
93     <caution>
94       <para>Mount-by-label should NOT be used in a multi-path environment.</para>
95     </caution>
96   </section>
97   <section xml:id="dbdoclet.50438194_69255">
98     <title><indexterm><primary>operations</primary><secondary>unmounting</secondary></indexterm>Unmounting a Server</title>
99     <para>To stop a Lustre server, use the <literal>umount &lt;mount point&gt;</literal> command.</para>
100     <para>For example, to stop <literal>ost0</literal> on mount point <literal>/mnt/test</literal>, run:</para>
101     <screen>$ umount /mnt/test</screen>
102     <para>Gracefully stopping a server with the <literal>umount</literal> command preserves the state of the connected clients. The next time the server is started, it waits for clients to reconnect, and then goes through the recovery procedure.</para>
103     <para>If the force (<literal>-f</literal>) flag is used, then the server evicts all clients and stops WITHOUT recovery. Upon restart, the server does not wait for recovery. Any currently connected clients receive I/O errors until they reconnect.</para>
104     <note>
105       <para>If you are using loopback devices, use the <literal>-d</literal> flag. This flag cleans up loop devices and can always be safely specified.</para>
106     </note>
107   </section>
108   <section xml:id="dbdoclet.50438194_57420">
109     <title><indexterm><primary>operations</primary><secondary>failover</secondary></indexterm>Specifying Failout/Failover Mode for OSTs</title>
110     <para>Lustre uses two modes, failout and failover, to handle an OST that has become unreachable because it fails, is taken off the network, is unmounted, etc.</para>
111     <itemizedlist>
112       <listitem>
113         <para> In <emphasis>failout</emphasis> mode, Lustre clients immediately receive errors (EIOs) after a timeout, instead of waiting for the OST to recover.</para>
114       </listitem>
115       <listitem>
116         <para> In <emphasis>failover</emphasis> mode, Lustre clients wait for the OST to recover.</para>
117       </listitem>
118     </itemizedlist>
119     <para>By default, the Lustre file system uses failover mode for OSTs. To specify failout mode instead, use the <literal>--param=&quot;failover.mode=failout&quot;</literal> option:</para>
120     <screen>$ mkfs.lustre --fsname=&lt;fsname&gt; --mgsnode=&lt;MGS node NID&gt; --param=&quot;failover.mode=failout&quot; --ost --index=&quot;OST index&quot; &lt;block device name&gt;</screen>
121     <para>In this example, failout mode is specified for the OSTs on MGS <literal>mds0</literal>, file system <literal>testfs</literal>.</para>
122     <screen>$ mkfs.lustre --fsname=testfs --mgsnode=mds0 --param=&quot;failover.mode=failout&quot; --ost --index=3 /dev/sdb </screen>
123     <caution>
124       <para>Before running this command, unmount all OSTs that will be affected by the change in the failover/failout mode.</para>
125     </caution>
126     <note>
127       <para>After initial file system configuration, use the tunefs.lustre utility to change the failover/failout mode. For example, to set the failout mode, run:</para>
128       <para><screen>$ tunefs.lustre --param failover.mode=failout &lt;OST partition&gt;</screen></para>
129     </note>
130   </section>
131   <section xml:id="dbdoclet.50438194_54138">
132     <title><indexterm><primary>operations</primary><secondary>degraded OST RAID</secondary></indexterm>Handling Degraded OST RAID Arrays</title>
133     <para>Lustre includes functionality that notifies Lustre if an external RAID array has degraded performance (resulting in reduced overall file system performance), either because a disk has failed and not been replaced, or because a disk was replaced and is undergoing a rebuild. To avoid a global performance slowdown due to a degraded OST, the MDS can avoid the OST for new object allocation if it is notified of the degraded state.</para>
134     <para>A parameter for each OST, called <literal>degraded</literal>, specifies whether the OST is running in degraded mode or not.</para>
135     <para>To mark the OST as degraded, use:</para>
136     <screen>lctl set_param obdfilter.{OST_name}.degraded=1</screen>
137     <para>To mark that the OST is back in normal operation, use:</para>
138     <screen>lctl set_param obdfilter.{OST_name}.degraded=0
139 </screen>
140     <para>To determine if OSTs are currently in degraded mode, use:</para>
141     <screen>lctl get_param obdfilter.*.degraded
142 </screen>
143     <para>If the OST is remounted due to a reboot or other condition, the flag resets to <literal>0</literal>.</para>
144     <para>It is recommended that this be implemented by an automated script that monitors the status of individual RAID devices.</para>
145   </section>
146   <section xml:id="dbdoclet.50438194_88063">
147     <title><indexterm><primary>operations</primary><secondary>multiple file systems</secondary></indexterm>Running Multiple Lustre File Systems</title>
148     <para>There may be situations in which you want to run multiple file systems. This is doable, as long as you follow specific naming conventions.</para>
149     <para>By default, the <literal>mkfs.lustre</literal> command creates a file system named <literal>lustre</literal>. To specify a different file system name (limited to 8 characters) at format time, use the <literal>--fsname</literal> option:</para>
150     <para><screen>mkfs.lustre --fsname=&lt;file system name&gt;</screen></para>
151     <note>
152       <para>The MDT, OSTs and clients in the new file system must use the same filesystem name (prepended to the device name). For example, for a new file system named <literal>foo</literal>, the MDT and two OSTs would be named <literal>foo-MDT0000</literal>, <literal>foo-OST0000</literal>, and <literal>foo-OST0001</literal>.</para>
153     </note>
154     <para>To mount a client on the file system, run:</para>
155     <screen>mount -t lustre mgsnode:/&lt;new fsname&gt; &lt;mountpoint&gt;</screen>
156     <para>For example, to mount a client on file system foo at mount point /mnt/foo, run:</para>
157     <screen>mount -t lustre mgsnode:/foo /mnt/foo</screen>
158     <note>
159       <para>If a client(s) will be mounted on several file systems, add the following line to <literal>/etc/xattr.conf</literal> file to avoid problems when files are moved between the file systems: <literal>lustre.* skip</literal></para>
160     </note>
161     <note>
162       <para>The MGS is universal; there is only one MGS per Lustre installation, not per file system.</para>
163     </note>
164     <note>
165       <para>There is only one file system per MDT. Therefore, specify <literal>--mdt --mgs</literal> on one file system and <literal>--mdt --mgsnode=&lt;MGS node NID&gt;</literal> on the other file systems.</para>
166     </note>
167     <para>A Lustre installation with two file systems (<literal>foo</literal> and <literal>bar</literal>) could look like this, where the MGS node is <literal>mgsnode@tcp0</literal> and the mount points are <literal>/mnt/foo</literal> and <literal>/mnt/bar</literal>.</para>
168     <screen>mgsnode# mkfs.lustre --mgs /dev/sda
169 mdtfoonode# mkfs.lustre --fsname=foo --mgsnode=mgsnode@tcp0 --mdt --index=0 /dev/sdb
170 ossfoonode# mkfs.lustre --fsname=foo --mgsnode=mgsnode@tcp0 --ost --index=0 /dev/sda
171 ossfoonode# mkfs.lustre --fsname=foo --mgsnode=mgsnode@tcp0 --ost --index=1 /dev/sdb
172 mdtbarnode# mkfs.lustre --fsname=bar --mgsnode=mgsnode@tcp0 --mdt --index=0 /dev/sda
173 ossbarnode# mkfs.lustre --fsname=bar --mgsnode=mgsnode@tcp0 --ost --index=0 /dev/sdc
174 ossbarnode# mkfs.lustre --fsname=bar --mgsnode=mgsnode@tcp0 --ost --index=1 /dev/sdd</screen>
175     <para>To mount a client on file system foo at mount point <literal>/mnt/foo</literal>, run:</para>
176     <screen>mount -t lustre mgsnode@tcp0:/foo /mnt/foo</screen>
177     <para>To mount a client on file system bar at mount point <literal>/mnt/bar</literal>, run:</para>
178     <screen>mount -t lustre mgsnode@tcp0:/bar /mnt/bar</screen>
179   </section>
180   <section xml:id="dbdoclet.50438194_88980">
181     <title><indexterm><primary>operations</primary><secondary>parameters</secondary></indexterm>Setting and Retrieving Lustre Parameters</title>
182     <para>Several options are available for setting parameters in Lustre:</para>
183     <itemizedlist>
184       <listitem>
185         <para> When creating a file system, use mkfs.lustre. See <xref linkend="dbdoclet.50438194_17237"/> below.</para>
186       </listitem>
187       <listitem>
188         <para> When a server is stopped, use tunefs.lustre. See <xref linkend="dbdoclet.50438194_55253"/> below.</para>
189       </listitem>
190       <listitem>
191         <para> When the file system is running, use lctl to set or retrieve Lustre parameters. See <xref linkend="dbdoclet.50438194_51490"/> and <xref linkend="dbdoclet.50438194_63247"/> below.</para>
192       </listitem>
193     </itemizedlist>
194     <section xml:id="dbdoclet.50438194_17237">
195       <title>Setting Tunable Parameters with <literal>mkfs.lustre</literal></title>
196       <para>When the file system is first formatted, parameters can simply be added as a <literal>--param</literal> option to the <literal>mkfs.lustre</literal> command. For example:</para>
197       <screen>$ mkfs.lustre --mdt --param=&quot;sys.timeout=50&quot; /dev/sda</screen>
198       <para>For more details about creating a file system,see <xref linkend="configuringlustre"/>. For more details about <literal>mkfs.lustre</literal>, see <xref linkend="systemconfigurationutilities"/>.</para>
199     </section>
200     <section xml:id="dbdoclet.50438194_55253">
201       <title>Setting Parameters with <literal>tunefs.lustre</literal></title>
202       <para>If a server (OSS or MDS) is stopped, parameters can be added to an existing filesystem using the <literal>--param</literal> option to the <literal>tunefs.lustre</literal> command. For example:</para>
203       <screen>$ tunefs.lustre --param=&quot;failover.node=192.168.0.13@tcp0&quot; /dev/sda</screen>
204       <para>With <literal>tunefs.lustre</literal>, parameters are &quot;additive&quot; -- new parameters are specified in addition to old parameters, they do not replace them. To erase all old <literal>tunefs.lustre</literal> parameters and just use newly-specified parameters, run:</para>
205       <screen>$ tunefs.lustre --erase-params --param=&lt;new parameters&gt; </screen>
206       <para>The tunefs.lustre command can be used to set any parameter settable in a /proc/fs/lustre file and that has its own OBD device, so it can be specified as <literal>&lt;obd|fsname&gt;.&lt;obdtype&gt;.&lt;proc_file_name&gt;=&lt;value&gt;</literal>. For example:</para>
207       <screen>$ tunefs.lustre --param mdt.group_upcall=NONE /dev/sda1</screen>
208       <para>For more details about <literal>tunefs.lustre</literal>, see <xref linkend="systemconfigurationutilities"/>.</para>
209     </section>
210     <section xml:id="dbdoclet.50438194_51490">
211       <title>Setting Parameters with <literal>lctl</literal></title>
212       <para>When the file system is running, the <literal>lctl</literal> command can be used to set parameters (temporary or permanent) and report current parameter values. Temporary parameters are active as long as the server or client is not shut down. Permanent parameters live through server and client reboots.</para>
213       <note>
214         <para>The lctl list_param command enables users to list all parameters that can be set. See <xref linkend="dbdoclet.50438194_88217"/>.</para>
215       </note>
216       <para>For more details about the <literal>lctl</literal> command, see the examples in the sections below and <xref linkend="systemconfigurationutilities"/>.</para>
217       <section remap="h4">
218         <title>Setting Temporary Parameters</title>
219         <para>Use <literal>lctl set_param</literal> to set temporary parameters on the node where it is run. These parameters map to items in <literal>/proc/{fs,sys}/{lnet,lustre}</literal>. The <literal>lctl set_param</literal> command uses this syntax:</para>
220         <screen>lctl set_param [-n] &lt;obdtype&gt;.&lt;obdname&gt;.&lt;proc_file_name&gt;=&lt;value&gt;</screen>
221         <para>For example:</para>
222         <screen># lctl set_param osc.*.max_dirty_mb=1024
223 osc.myth-OST0000-osc.max_dirty_mb=32 
224 osc.myth-OST0001-osc.max_dirty_mb=32 
225 osc.myth-OST0002-osc.max_dirty_mb=32 
226 osc.myth-OST0003-osc.max_dirty_mb=32 
227 osc.myth-OST0004-osc.max_dirty_mb=32</screen>
228       </section>
229       <section xml:id="dbdoclet.50438194_64195">
230         <title>Setting Permanent Parameters</title>
231         <para>Use the <literal>lctl conf_param</literal> command to set permanent parameters. In general, the <literal>lctl conf_param</literal> command can be used to specify any parameter settable in a <literal>/proc/fs/lustre</literal> file, with its own OBD device. The <literal>lctl conf_param</literal> command uses this syntax (same as the <literal>mkfs.lustre</literal> and <literal>tunefs.lustre</literal> commands):</para>
232         <screen>&lt;obd|fsname&gt;.&lt;obdtype&gt;.&lt;proc_file_name&gt;=&lt;value&gt;) </screen>
233         <para>Here are a few examples of <literal>lctl conf_param</literal> commands:</para>
234         <screen>$ mgs&gt; lctl conf_param testfs-MDT0000.sys.timeout=40
235 $ lctl conf_param testfs-MDT0000.mdt.group_upcall=NONE 
236 $ lctl conf_param testfs.llite.max_read_ahead_mb=16 
237 $ lctl conf_param testfs-MDT0000.lov.stripesize=2M 
238 $ lctl conf_param testfs-OST0000.osc.max_dirty_mb=29.15 
239 $ lctl conf_param testfs-OST0000.ost.client_cache_seconds=15 
240 $ lctl conf_param testfs.sys.timeout=40 </screen>
241         <caution>
242           <para>Parameters specified with the <literal>lctl conf_param</literal> command are set permanently in the file system&apos;s configuration file on the MGS.</para>
243         </caution>
244       </section>
245       <section xml:id="dbdoclet.50438194_88217">
246         <title>Listing Parameters</title>
247         <para>To list Lustre or LNET parameters that are available to set, use the <literal>lctl list_param</literal> command. For example:</para>
248         <screen>lctl list_param [-FR] &lt;obdtype&gt;.&lt;obdname&gt;</screen>
249         <para>The following arguments are available for the <literal>lctl list_param</literal> command.</para>
250         <para><literal>-F</literal> Add &apos;<literal>/</literal>&apos;, &apos;<literal>@</literal>&apos; or &apos;<literal>=</literal>&apos; for directories, symlinks and writeable files, respectively</para>
251         <para><literal>-R</literal> Recursively lists all parameters under the specified path</para>
252         <para>For example:</para>
253         <screen>$ lctl list_param obdfilter.lustre-OST0000 </screen>
254       </section>
255       <section xml:id="dbdoclet.50438194_63247">
256         <title>Reporting Current Parameter Values</title>
257         <para>To report current Lustre parameter values, use the <literal>lctl get_param</literal> command with this syntax:</para>
258         <screen>lctl get_param [-n] &lt;obdtype&gt;.&lt;obdname&gt;.&lt;proc_file_name&gt;</screen>
259         <para>This example reports data on RPC service times.</para>
260         <screen>$ lctl get_param -n ost.*.ost_io.timeouts 
261 service : cur 1 worst 30 (at 1257150393, 85d23h58m54s ago) 1 1 1 1 </screen>
262         <para>This example reports the amount of space this client has reserved for writeback cache with each OST:</para>
263         <screen># lctl get_param osc.*.cur_grant_bytes
264 osc.myth-OST0000-osc-ffff8800376bdc00.cur_grant_bytes=2097152
265 osc.myth-OST0001-osc-ffff8800376bdc00.cur_grant_bytes=33890304
266 osc.myth-OST0002-osc-ffff8800376bdc00.cur_grant_bytes=35418112
267 osc.myth-OST0003-osc-ffff8800376bdc00.cur_grant_bytes=2097152
268 osc.myth-OST0004-osc-ffff8800376bdc00.cur_grant_bytes=33808384</screen>
269       </section>
270     </section>
271   </section>
272   <section xml:id="dbdoclet.50438194_41817">
273     <title><indexterm><primary>operations</primary><secondary>failover</secondary></indexterm>Specifying NIDs and Failover</title>
274     <para>If a node has multiple network interfaces, it may have multiple NIDs. When a node is specified, all of its NIDs must be listed, delimited by commas (<literal>,</literal>) so other nodes can choose the NID that is appropriate for their network interfaces. When failover nodes are specified, they are delimited by a colon (<literal>:</literal>) or by repeating a keyword (<literal>--mgsnode=</literal> or <literal>--failnode=</literal> or <literal>--servicenode=</literal>). To obtain all NIDs from a node (while LNET is running), run:</para>
275     <screen>lctl list_nids</screen>
276     <para>This displays the server&apos;s NIDs (networks configured to work with Lustre).</para>
277     <para>This example has a combined MGS/MDT failover pair on mds0 and mds1, and a OST failover pair on oss0 and oss1. There are corresponding Elan addresses on mds0 and mds1.</para>
278     <screen>mds0&gt; mkfs.lustre --fsname=testfs --mdt --mgs --failnode=mds1,2@elan /dev/sda1
279 mds0&gt; mount -t lustre /dev/sda1 /mnt/test/mdt
280 oss0&gt; mkfs.lustre --fsname=testfs --failnode=oss1 --ost --index=0 \
281     --mgsnode=mds0,1@elan --mgsnode=mds1,2@elan /dev/sdb
282 oss0&gt; mount -t lustre /dev/sdb /mnt/test/ost0
283 client&gt; mount -t lustre mds0,1@elan:mds1,2@elan:/testfs /mnt/testfs
284 mds0&gt; umount /mnt/mdt
285 mds1&gt; mount -t lustre /dev/sda1 /mnt/test/mdt
286 mds1&gt; cat /proc/fs/lustre/mds/testfs-MDT0000/recovery_status</screen>
287     <para>Where multiple NIDs are specified, comma-separation (for example, <literal>mds1,2@elan</literal>) means that the two NIDs refer to the same host, and that Lustre needs to choose the &quot;best&quot; one for communication. Colon-separation (for example, <literal>mds0:mds1</literal>) means that the two NIDs refer to two different hosts, and should be treated as failover locations (Lustre tries the first one, and if that fails, it tries the second one.)</para>
288     <para>Two options exist to specify failover nodes. <literal>--failnode</literal> and <literal>--servicenode</literal>. <literal>--failnode</literal> specifies the NIDs of failover nodes. <literal>--servicenode</literal> specifies all service NIDs, including those of the primary node and of failover nodes.  Option <literal>--servicenode</literal> makes the MDT or OST treat all its service nodes equally. The first service node to load the target device becomes the primary service node. Other node NIDs will become failover locations for the target device.</para>
289     <note>
290       <para>If you have an MGS or MDT configured for failover, perform these steps:</para>
291       <orderedlist>
292         <listitem>
293           <para>On the oss0 node, list the NIDs of all MGS nodes at <literal>mkfs</literal> time.</para>
294           <screen>oss0# mkfs.lustre --fsname sunfs --mgsnode=10.0.0.1 \
295   --mgsnode=10.0.0.2 --ost --index=0 /dev/sdb</screen>
296         </listitem>
297         <listitem>
298           <para>On the client, mount the file system.</para>
299           <para><screen>client# mount -t lustre 10.0.0.1:10.0.0.2:/sunfs /cfs/client/</screen></para>
300         </listitem>
301       </orderedlist>
302     </note>
303   </section>
304   <section xml:id="dbdoclet.50438194_70905">
305     <title><indexterm><primary>operations</primary><secondary>erasing a file system</secondary></indexterm>Erasing a File System</title>
306     <para>If you want to erase a file system, run this command on your targets:</para>
307     <screen>$ &quot;mkfs.lustre --reformat&quot;</screen>
308     <para>If you are using a separate MGS and want to keep other file systems defined on that MGS, then set the <literal>writeconf</literal> flag on the MDT for that file system. The <literal>writeconf</literal> flag causes the configuration logs to be erased; they are regenerated the next time the servers start.</para>
309     <para>To set the <literal>writeconf</literal> flag on the MDT:</para>
310     <orderedlist>
311       <listitem>
312         <para>Unmount all clients/servers using this file system, run:</para>
313         <screen>$ umount /mnt/lustre</screen>
314       </listitem>
315       <listitem>
316         <para>Erase the file system and, presumably, replace it with another file system, run:</para>
317         <screen>$ mkfs.lustre --reformat --fsname spfs --mgs --mdt --index=0 /dev/sda</screen>
318       </listitem>
319       <listitem>
320         <para>If you have a separate MGS (that you do not want to reformat), then add the &quot;--writeconf&quot; flag to <literal>mkfs.lustre</literal> on the MDT, run:</para>
321         <screen>$ mkfs.lustre --reformat --writeconf --fsname spfs --mgs --mdt /dev/sda</screen>
322       </listitem>
323     </orderedlist>
324     <note>
325       <para>If you have a combined MGS/MDT, reformatting the MDT reformats the MGS as well, causing all configuration information to be lost; you can start building your new file system. Nothing needs to be done with old disks that will not be part of the new file system, just do not mount them.</para>
326     </note>
327   </section>
328   <section xml:id="dbdoclet.50438194_16954">
329     <title><indexterm><primary>operations</primary><secondary>reclaiming space</secondary></indexterm>Reclaiming Reserved Disk Space</title>
330     <para>All current Lustre installations run the ldiskfs file system internally on service nodes. By default, ldiskfs reserves 5% of the disk space for the root user. In order to reclaim this space, run the following command on your OSSs:</para>
331     <screen>tune2fs [-m reserved_blocks_percent] [device]</screen>
332     <para>You do not need to shut down Lustre before running this command or restart it afterwards.</para>
333   </section>
334   <section xml:id="dbdoclet.50438194_69998">
335     <title><indexterm><primary>operations</primary><secondary>replacing a OST or MDS</secondary></indexterm>Replacing an Existing OST or MDS</title>
336     <para>To copy the contents of an existing OST to a new OST (or an old MDS to a new MDS), use one of these methods:</para>
337     <itemizedlist>
338       <listitem>
339         <para>Connect the old OST disk and new OST disk to a single machine, mount both, and use rsync to copy all data between the OST file systems.</para>
340         <para>For example:</para>
341         <screen>mount -t ldiskfs /dev/old /mnt/ost_old
342 mount -t ldiskfs /dev/new /mnt/ost_new
343 rsync -aSv /mnt/ost_old/ /mnt/ost_new
344 # note trailing slash on ost_old/</screen>
345       </listitem>
346     </itemizedlist>
347     <itemizedlist>
348       <listitem>
349         <para>If you are unable to connect both sets of disk to the same computer, use <literal>rsync</literal> to copy over the network using <literal>rsh</literal> (or <literal>ssh</literal> with <literal>-e ssh</literal>):</para>
350         <screen>rsync -aSvz /mnt/ost_old/ new_ost_node:/mnt/ost_new</screen>
351       </listitem>
352     </itemizedlist>
353     <itemizedlist>
354       <listitem>
355         <para>Use the same procedure for the MDS, with one additional step:</para>
356         <screen>cd /mnt/mds_old; getfattr -R -e base64 -d . &gt; /tmp/mdsea; \&lt;copy all MDS file\
357 s as above&gt;; cd /mnt/mds_new; setfattr \--restore=/tmp/mdsea</screen>
358       </listitem>
359     </itemizedlist>
360   </section>
361   <section xml:id="dbdoclet.50438194_30872">
362     <title><indexterm><primary>operations</primary><secondary>identifying OSTs</secondary></indexterm>Identifying To Which Lustre File an OST Object Belongs</title>
363     <para>Use this procedure to identify the file containing a given object on a given OST.</para>
364     <orderedlist>
365       <listitem>
366         <para>On the OST (as root), run <literal>debugfs</literal> to display the file identifier (<literal>FID</literal>) of the file associated with the object.</para>
367         <para>For example, if the object is <literal>34976</literal> on <literal>/dev/lustre/ost_test2</literal>, the debug command is:</para>
368         <screen># debugfs -c -R &quot;stat /O/0/d$((34976 %32))/34976&quot; /dev/lustre/ost_test2 </screen>
369         <para>The command output is:</para>
370         <screen>debugfs 1.41.5.sun2 (23-Apr-2009)
371 /dev/lustre/ost_test2: catastrophic mode - not reading inode or group bitma\
372 ps 
373 Inode: 352365   Type: regular    Mode:  0666   Flags: 0x80000
374 Generation: 1574463214    Version: 0xea020000:00000000
375 User:   500   Group:   500   Size: 260096
376 File ACL: 0    Directory ACL: 0
377 Links: 1   Blockcount: 512
378 Fragment:  Address: 0    Number: 0    Size: 0
379 ctime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009
380 atime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009
381 mtime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009
382 crtime: 0x4a216b3c:975870dc -- Sat May 30 13:22:04 2009
383 Size of extra inode fields: 24
384 Extended attributes stored in inode body: 
385 fid = &quot;e2 00 11 00 00 00 00 00 25 43 c1 87 00 00 00 00 a0 88 00 00 00 00 00 \
386 00 00 00 00 00 00 00 00 00 &quot; (32)
387 BLOCKS:
388 (0-63):47968-48031
389 TOTAL: 64</screen>
390       </listitem>
391       <listitem>
392         <para>Note the FID&apos;s EA and apply it to the <literal>osd_inode_id</literal> mapping.</para>
393         <para>In this example, the FID&apos;s EA is:</para>
394         <screen>e2001100000000002543c18700000000a0880000000000000000000000000000
395 struct osd_inode_id { 
396 __u64 oii_ino; /* inode number */ 
397 __u32 oii_gen; /* inode generation */ 
398 __u32 oii_pad; /* alignment padding */ 
399 };</screen>
400         <para>After swapping, you get an inode number of <literal>0x001100e2</literal> and generation of <literal>0</literal>.</para>
401       </listitem>
402       <listitem>
403         <para>On the MDT (as root), use <literal>debugfs</literal> to find the file associated with the inode.</para>
404         <screen># debugfs -c -R &quot;ncheck 0x001100e2&quot; /dev/lustre/mdt_test </screen>
405         <para>Here is the command output:</para>
406         <screen>debugfs 1.41.5.sun2 (23-Apr-2009)
407 /dev/lustre/mdt_test: catastrophic mode - not reading inode or group bitmap\
408 s
409 Inode      Pathname
410 1114338    /ROOT/brian-laptop-guest/clients/client11/~dmtmp/PWRPNT/ZD16.BMP</screen>
411       </listitem>
412     </orderedlist>
413     <para>The command lists the inode and pathname associated with the object.</para>
414     <note>
415       <para><literal>Debugfs</literal>&apos; &apos;&apos;ncheck&apos;&apos; is a brute-force search that may take a long time to complete.</para>
416     </note>
417     <note>
418       <para>To find the Lustre file from a disk LBA, follow the steps listed in the document at this URL: <emphasis><link xl:href="http://smartmontools.sourceforge.net/badblockhowto.html">http://smartmontools.sourceforge.net/badblockhowto.html</link>. </emphasis> Then, follow the steps above to resolve the Lustre filename.</para>
419     </note>
420   </section>
421 </chapter>