Whamcloud - gitweb
LUDOC-371 config: Add lctl 'clear_conf' documentation.
[doc/manual.git] / LustreMaintenance.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="lustremaintenance">
2   <title xml:id="lustremaintenance.title">Lustre Maintenance</title>
3   <para>Once you have the Lustre file system up and running, you can use the procedures in this section to perform these basic Lustre maintenance tasks:</para>
4   <itemizedlist>
5     <listitem>
6       <para><xref linkend="dbdoclet.50438199_42877"/></para>
7     </listitem>
8     <listitem>
9       <para><xref linkend="dbdoclet.50438199_15240"/></para>
10     </listitem>
11     <listitem>
12       <para><xref linkend="dbdoclet.50438199_26070"/></para>
13     </listitem>
14     <listitem>
15       <para><xref linkend="dbdoclet.50438199_54623"/></para>
16     </listitem>
17     <listitem>
18       <para><xref linkend="dbdoclet.changingservernid"/></para>
19     </listitem>
20     <listitem>
21       <para><xref linkend="dbdoclet.adding_new_mdt"/></para>
22     </listitem>
23     <listitem>
24       <para><xref linkend="dbdoclet.adding_new_ost"/></para>
25     </listitem>
26     <listitem>
27       <para><xref linkend="dbdoclet.deactivating_mdt_ost"/></para>
28     </listitem>
29     <listitem>
30       <para><xref linkend="dbdoclet.rmremotedir"/></para>
31     </listitem>
32     <listitem>
33       <para><xref linkend="dbdoclet.inactivemdt"/></para>
34     </listitem>
35     <listitem>
36       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_remove_ost"/></para>
37     </listitem>
38     <listitem>
39       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_ydg_pgt_tl"/></para>
40     </listitem>
41     <listitem>
42       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_restore_ost"/></para>
43     </listitem>
44     <listitem>
45       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_ucf_qgt_tl"/></para>
46     </listitem>
47     <listitem>
48       <para><xref linkend="dbdoclet.50438199_77819"/></para>
49     </listitem>
50     <listitem>
51       <para><xref linkend="dbdoclet.50438199_12607"/></para>
52     </listitem>
53     <listitem>
54       <para><xref linkend="dbdoclet.50438199_62333"/></para>
55     </listitem>
56     <listitem>
57       <para><xref linkend="dbdoclet.50438199_62545"/></para>
58     </listitem>
59   </itemizedlist>
60   <section xml:id="dbdoclet.50438199_42877">
61       <title>
62           <indexterm><primary>maintenance</primary></indexterm>
63           <indexterm><primary>maintenance</primary><secondary>inactive OSTs</secondary></indexterm>
64           Working with Inactive OSTs</title>
65     <para>To mount a client or an MDT with one or more inactive OSTs, run commands similar to this:</para>
66     <screen>client# mount -o exclude=testfs-OST0000 -t lustre \
67            uml1:/testfs /mnt/testfs
68             client# lctl get_param lov.testfs-clilov-*.target_obd</screen>
69     <para>To activate an inactive OST on a live client or MDT, use the
70     <literal>lctl activate</literal> command on the OSC device. For example:</para>
71     <screen>lctl --device 7 activate</screen>
72     <note>
73       <para>A colon-separated list can also be specified. For example,
74       <literal>exclude=testfs-OST0000:testfs-OST0001</literal>.</para>
75     </note>
76     </section>
77     <section xml:id="dbdoclet.50438199_15240">
78       <title><indexterm><primary>maintenance</primary><secondary>finding nodes</secondary></indexterm>
79 Finding Nodes in the Lustre File System</title>
80       <para>There may be situations in which you need to find all nodes in
81       your Lustre file system or get the names of all OSTs.</para>
82       <para>To get a list of all Lustre nodes, run this command on the MGS:</para>
83       <screen># lctl get_param mgs.MGS.live.*</screen>
84       <note>
85         <para>This command must be run on the MGS.</para>
86       </note>
87       <para>In this example, file system <literal>testfs</literal> has three
88       nodes, <literal>testfs-MDT0000</literal>,
89       <literal>testfs-OST0000</literal>, and
90       <literal>testfs-OST0001</literal>.</para>
91       <screen>mgs:/root# lctl get_param mgs.MGS.live.* 
92                 fsname: testfs 
93                 flags: 0x0     gen: 26 
94                 testfs-MDT0000 
95                 testfs-OST0000 
96                 testfs-OST0001 </screen>
97       <para>To get the names of all OSTs, run this command on the MDS:</para>
98       <screen>mds:/root# lctl get_param lov.*-mdtlov.target_obd </screen>
99       <note>
100         <para>This command must be run on the MDS.</para>
101       </note>
102       <para>In this example, there are two OSTs, testfs-OST0000 and
103       testfs-OST0001, which are both active.</para>
104       <screen>mgs:/root# lctl get_param lov.testfs-mdtlov.target_obd 
105 0: testfs-OST0000_UUID ACTIVE 
106 1: testfs-OST0001_UUID ACTIVE </screen>
107     </section>
108     <section xml:id="dbdoclet.50438199_26070">
109       <title><indexterm><primary>maintenance</primary><secondary>mounting a server</secondary></indexterm>
110 Mounting a Server Without Lustre Service</title>
111       <para>If you are using a combined MGS/MDT, but you only want to start the MGS and not the MDT, run this command:</para>
112       <screen>mount -t lustre <replaceable>/dev/mdt_partition</replaceable> -o nosvc <replaceable>/mount_point</replaceable></screen>
113       <para>The <literal><replaceable>mdt_partition</replaceable></literal> variable is the combined MGS/MDT block device.</para>
114       <para>In this example, the combined MGS/MDT is <literal>testfs-MDT0000</literal> and the mount point is <literal>/mnt/test/mdt</literal>.</para>
115       <screen>$ mount -t lustre -L testfs-MDT0000 -o nosvc /mnt/test/mdt</screen>
116     </section>
117     <section xml:id="dbdoclet.50438199_54623">
118       <title><indexterm><primary>maintenance</primary><secondary>regenerating config logs</secondary></indexterm>
119 Regenerating Lustre Configuration Logs</title>
120       <para>If the Lustre file system configuration logs are in a state where the file system cannot
121       be started, use the <literal>writeconf</literal> command to erase them. After the
122         <literal>writeconf</literal> command is run and the servers restart, the configuration logs
123       are re-generated and stored on the MGS (as in a new file system).</para>
124       <para>You should only use the <literal>writeconf</literal> command if:</para>
125       <itemizedlist>
126         <listitem>
127           <para>The configuration logs are in a state where the file system cannot start</para>
128         </listitem>
129         <listitem>
130           <para>A server NID is being changed</para>
131         </listitem>
132       </itemizedlist>
133       <para>The <literal>writeconf</literal> command is destructive to some configuration items (i.e., OST pools information and items set via <literal>conf_param</literal>), and should be used with caution. To avoid problems:</para>
134       <itemizedlist>
135         <listitem>
136           <para>Shut down the file system before running the <literal>writeconf</literal> command</para>
137         </listitem>
138         <listitem>
139           <para>Run the <literal>writeconf</literal> command on all servers (MDT first, then OSTs)</para>
140         </listitem>
141         <listitem>
142           <para>Start the file system in this order:</para>
143           <itemizedlist>
144             <listitem>
145               <para>MGS (or the combined MGS/MDT)</para>
146             </listitem>
147             <listitem>
148               <para>MDT</para>
149             </listitem>
150             <listitem>
151               <para>OSTs</para>
152             </listitem>
153             <listitem>
154               <para>Lustre clients</para>
155             </listitem>
156           </itemizedlist>
157         </listitem>
158       </itemizedlist>
159       <caution>
160         <para>The OST pools feature enables a group of OSTs to be named for file striping purposes. If you use OST pools, be aware that running the <literal>writeconf</literal> command erases <emphasis role="bold">all</emphasis> pools information (as well as any other parameters set via <literal>lctl conf_param</literal>). We recommend that the pools definitions (and <literal>conf_param</literal> settings) be executed via a script, so they can be reproduced easily after a <literal>writeconf</literal> is performed.</para>
161       </caution>
162       <para>To regenerate Lustre file system configuration logs:</para>
163       <orderedlist>
164         <listitem>
165           <para>Shut down the file system in this order.</para>
166           <orderedlist>
167             <listitem>
168               <para>Unmount the clients.</para>
169             </listitem>
170             <listitem>
171               <para>Unmount the MDT.</para>
172             </listitem>
173             <listitem>
174               <para>Unmount all OSTs.</para>
175             </listitem>
176           </orderedlist>
177         </listitem>
178         <listitem>
179           <para>Make sure the the MDT and OST devices are available.</para>
180         </listitem>
181         <listitem>
182           <para>Run the <literal>writeconf</literal> command on all servers.</para>
183           <para>Run writeconf on the MDT first, and then the OSTs.</para>
184           <orderedlist>
185             <listitem>
186               <para>On the MDT, run:</para>
187               <screen>mdt# tunefs.lustre --writeconf <replaceable>/dev/mdt_device</replaceable></screen>
188             </listitem>
189             <listitem>
190               <para>
191               On each OST, run:
192               
193           <screen>ost# tunefs.lustre --writeconf <replaceable>/dev/ost_device</replaceable></screen>
194           </para>
195             </listitem>
196           </orderedlist>
197         </listitem>
198         <listitem>
199           <para>Restart the file system in this order.</para>
200           <orderedlist>
201             <listitem>
202               <para>Mount the MGS (or the combined MGS/MDT).</para>
203             </listitem>
204             <listitem>
205               <para>Mount the MDT.</para>
206             </listitem>
207             <listitem>
208               <para>Mount the OSTs.</para>
209             </listitem>
210             <listitem>
211               <para>Mount the clients.</para>
212             </listitem>
213           </orderedlist>
214         </listitem>
215       </orderedlist>
216       <para>After the <literal>writeconf</literal> command is run, the configuration logs are re-generated as servers restart.</para>
217     </section>
218     <section xml:id="dbdoclet.changingservernid">
219       <title><indexterm><primary>maintenance</primary><secondary>changing a NID</secondary></indexterm>
220 Changing a Server NID</title>
221       <para>In Lustre software release 2.3 or earlier, the <literal>tunefs.lustre
222         --writeconf</literal> command is used to rewrite all of the configuration files.</para>
223       <para condition="l24">If you need to change the NID on the MDT or OST, a new
224         <literal>replace_nids</literal> command was added in Lustre software release 2.4 to simplify
225       this process. The <literal>replace_nids</literal> command differs from <literal>tunefs.lustre
226         --writeconf</literal> in that it does not erase the entire configuration log, precluding the
227       need the need to execute the <literal>writeconf</literal> command on all servers and
228       re-specify all permanent parameter settings. However, the <literal>writeconf</literal> command
229       can still be used if desired.</para>
230       <para>Change a server NID in these situations:</para>
231       <itemizedlist>
232         <listitem>
233           <para>New server hardware is added to the file system, and the MDS or an OSS is being moved to the new machine.</para>
234         </listitem>
235         <listitem>
236           <para>New network card is installed in the server.</para>
237         </listitem>
238         <listitem>
239           <para>You want to reassign IP addresses.</para>
240         </listitem>
241       </itemizedlist>
242       <para>To change a server NID:</para>
243       <orderedlist>
244         <listitem>
245                 <para>Update the LNet configuration in the <literal>/etc/modprobe.conf</literal> file so the list of server NIDs is correct. Use <literal>lctl list_nids</literal> to view the list of server NIDS.</para>
246           <para>The <literal>lctl list_nids</literal> command indicates which network(s) are
247           configured to work with the Lustre file system.</para>
248         </listitem>
249         <listitem>
250           <para>Shut down the file system in this order:</para>
251           <orderedlist>
252             <listitem>
253               <para>Unmount the clients.</para>
254             </listitem>
255             <listitem>
256               <para>Unmount the MDT.</para>
257             </listitem>
258             <listitem>
259               <para>Unmount all OSTs.</para>
260             </listitem>
261           </orderedlist>
262         </listitem>
263         <listitem>
264           <para>If the MGS and MDS share a partition, start the MGS only:</para>
265           <screen>mount -t lustre <replaceable>MDT partition</replaceable> -o nosvc <replaceable>mount_point</replaceable></screen>
266         </listitem>
267         <listitem>
268           <para>Run the <literal>replace_nids</literal> command on the MGS:</para>
269           <screen>lctl replace_nids <replaceable>devicename</replaceable> <replaceable>nid1</replaceable>[,nid2,nid3 ...]</screen>
270           <para>where <replaceable>devicename</replaceable> is the Lustre target name, e.g.
271             <literal>testfs-OST0013</literal></para>
272         </listitem>
273         <listitem>
274           <para>If the MGS and MDS share a partition, stop the MGS:</para>
275           <screen>umount <replaceable>mount_point</replaceable></screen>
276         </listitem>
277       </orderedlist>
278       <note><para>The <literal>replace_nids</literal> command also cleans
279       all old, invalidated records out of the configuration log, while
280       preserving all other current settings.</para></note> 
281       <note><para>The previous configuration log is backed up on the MGS
282       disk with the suffix <literal>'.bak'</literal>.</para></note>
283     </section>
284     <section xml:id="dbdoclet.clear_conf" condition="l2B">
285       <title><indexterm>
286             <primary>maintenance</primary>
287                 <secondary>Clearing a config</secondary>
288           </indexterm> Clearing configuration</title>
289       <para>
290           This command runs on MGS node having the MGS device mounted with
291           <literal>-o nosvc.</literal> It cleans up configuration files
292           stored in the CONFIGS/ directory of any records marked SKIP.
293           If the device name is given, then the specific logs for that
294           filesystem (e.g. testfs-MDT0000) are processed.  Otherwise, if a
295           filesystem name is given then all configuration files are cleared.
296           The previous configuration log is backed up on the MGS disk with
297           the suffix 'config.timestamp.bak'. Eg: Lustre-MDT0000-1476454535.bak.
298           </para>
299           <para> To clear a configuration:</para>
300           <orderedlist>
301              <listitem>
302                    <para>Shut down the file system in this order:</para>
303              <orderedlist>
304                <listitem>
305                  <para>Unmount the clients.</para>
306                </listitem>
307                <listitem>
308                  <para>Unmount the MDT.</para>
309                </listitem>
310                <listitem>
311                  <para>Unmount all OSTs.</para>
312                </listitem>
313              </orderedlist>
314              </listitem>
315              <listitem>
316                <para>
317                  If the MGS and MDS share a partition, start the MGS only
318                  using "nosvc" option.
319                </para>
320            <screen>mount -t lustre <replaceable>MDT partition</replaceable> -o nosvc <replaceable>mount_point</replaceable></screen>
321              </listitem>
322              <listitem>
323                  <para>Run the <literal>clear_conf</literal> command on the MGS:
324                  </para>
325            <screen>lctl clear_conf <replaceable>config</replaceable></screen>
326              <para>
327                         Example: To clear the configuration for
328                         <literal>MDT0000</literal> on a filesystem named
329                         <literal>testfs</literal>
330              </para>
331            <screen>mgs# lctl clear_conf testfs-MDT0000</screen>
332              </listitem>
333            </orderedlist>
334         </section>
335     <section xml:id="dbdoclet.adding_new_mdt" condition='l24'>
336       <title><indexterm>
337         <primary>maintenance</primary>
338         <secondary>adding an MDT</secondary>
339       </indexterm>Adding a New MDT to a Lustre File System</title>
340         <para>Additional MDTs can be added using the DNE feature to serve one
341         or more remote sub-directories within a filesystem, in order to
342         increase the total number of files that can be created in the
343         filesystem, to increase aggregate metadata performance, or to isolate
344         user or application workloads from other users of the filesystem. It
345         is possible to have multiple remote sub-directories reference the
346         same MDT.  However, the root directory will always be located on
347         MDT0. To add a new MDT into the file system:</para>
348       <orderedlist>
349         <listitem>
350           <para>Discover the maximum MDT index. Each MDT must have unique index.</para>
351 <screen>
352 client$ lctl dl | grep mdc
353 36 UP mdc testfs-MDT0000-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
354 37 UP mdc testfs-MDT0001-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
355 38 UP mdc testfs-MDT0002-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
356 39 UP mdc testfs-MDT0003-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
357 </screen>
358         </listitem>
359         <listitem>
360           <para>Add the new block device as a new MDT at the next available
361           index. In this example, the next available index is 4.</para>
362 <screen>
363 mds# mkfs.lustre --reformat --fsname=<replaceable>testfs</replaceable> --mdt --mgsnode=<replaceable>mgsnode</replaceable> --index 4 <replaceable>/dev/mdt4_device</replaceable>
364 </screen>
365         </listitem>
366         <listitem>
367           <para>Mount the MDTs.</para>
368 <screen>
369 mds# mount –t lustre <replaceable>/dev/mdt4_blockdevice</replaceable> /mnt/mdt4
370 </screen>
371         </listitem>
372         <listitem>
373            <para>In order to start creating new files and directories on the
374            new MDT(s) they need to be attached into the namespace at one or
375            more subdirectories using the <literal>lfs mkdir</literal> command.
376            All files and directories below those created with
377            <literal>lfs mkdir</literal> will also be created on the same MDT
378            unless otherwise specified.
379            </para>
380 <screen>
381 client# lfs mkdir -i 3 /mnt/testfs/new_dir_on_mdt3
382 client# lfs mkdir -i 4 /mnt/testfs/new_dir_on_mdt4
383 client# lfs mkdir -c 4 /mnt/testfs/new_directory_striped_across_4_mdts
384 </screen>
385         </listitem>
386       </orderedlist>
387     </section>
388     <section xml:id="dbdoclet.adding_new_ost">
389       <title><indexterm><primary>maintenance</primary><secondary>adding a OST</secondary></indexterm>
390 Adding a New OST to a Lustre File System</title>
391       <para>A new OST can be added to existing Lustre file system on either
392       an existing OSS node or on a new OSS node.  In order to keep client IO
393       load balanced across OSS nodes for maximum aggregate performance, it is
394       not recommended to configure different numbers of OSTs to each OSS node.
395       </para>
396       <orderedlist>
397         <listitem>
398           <para> Add a new OST by using <literal>mkfs.lustre</literal> as when
399           the filesystem was first formatted, see
400           <xref linkend="dbdoclet.format_ost" /> for details.  Each new OST
401           must have a unique index number, use <literal>lctl dl</literal> to
402           see a list of all OSTs. For example, to add a new OST at index 12
403           to the <literal>testfs</literal> filesystem run following commands
404           should be run on the OSS:</para>
405           <screen>oss# mkfs.lustre --fsname=testfs --mgsnode=mds16@tcp0 --ost --index=12 /dev/sda
406 oss# mkdir -p /mnt/testfs/ost12
407 oss# mount -t lustre /dev/sda /mnt/testfs/ost12</screen>
408         </listitem>
409         <listitem>
410           <para>Balance OST space usage (possibly).</para>
411           <para>The file system can be quite unbalanced when new empty OSTs
412           are added to a relatively full filesystem. New file creations are
413           automatically balanced to favour the new OSTs. If this is a scratch
414           file system or files are pruned at regular intervals, then no further
415           work may be needed to balance the OST space usage as new files being
416           created will preferentially be placed on the less full OST(s). As old
417           files are deleted, they will release space on the old OST(s).</para>
418           <para>Files existing prior to the expansion can optionally be
419           rebalanced using the <literal>lfs_migrate</literal> utility.
420           This redistributes file data over the entire set of OSTs.</para>
421           <para>For example, to rebalance all files within the directory
422           <literal>/mnt/lustre/dir</literal>, enter:</para>
423           <screen>client# lfs_migrate /mnt/lustre/file</screen>
424           <para>To migrate files within the <literal>/test</literal> file
425           system on <literal>OST0004</literal> that are larger than 4GB in
426           size to other OSTs, enter:</para>
427           <screen>client# lfs find /test --ost test-OST0004 -size +4G | lfs_migrate -y</screen>
428           <para>See <xref linkend="dbdoclet.lfs_migrate"/> for details.</para>
429         </listitem>
430       </orderedlist>
431     </section>
432     <section xml:id="dbdoclet.deactivating_mdt_ost">
433       <title><indexterm><primary>maintenance</primary><secondary>restoring an OST</secondary></indexterm>
434       <indexterm><primary>maintenance</primary><secondary>removing an OST</secondary></indexterm>
435 Removing and Restoring MDTs and OSTs</title>
436       <para>OSTs and DNE MDTs can be removed from and restored to a Lustre
437       filesystem.  Deactivating an OST means that it is temporarily or
438       permanently marked unavailable.  Deactivating an OST on the MDS means
439       it will not try to allocate new objects there or perform OST recovery,
440       while deactivating an OST the client means it will not wait for OST
441       recovery if it cannot contact the OST and will instead return an IO
442       error to the application immediately if files on the OST are accessed.
443       An OST may be permanently deactivated from the file system,
444       depending on the situation and commands used.</para>
445       <note><para>A permanently deactivated MDT or OST still appears in the
446         filesystem configuration until the configuration is regenerated with
447         <literal>writeconf</literal> or it is replaced with a new MDT or OST
448         at the same index and permanently reactivated.  A deactivated OST
449         will not be listed by <literal>lfs df</literal>.
450       </para></note>
451       <para>You may want to temporarily deactivate an OST on the MDS to
452       prevent new files from being written to it in several situations:</para>
453       <itemizedlist>
454         <listitem>
455           <para>A hard drive has failed and a RAID resync/rebuild is underway,
456           though the OST can also be marked <emphasis>degraded</emphasis> by
457           the RAID system to avoid allocating new files on the slow OST which
458           can reduce performance, see <xref linkend='dbdoclet.degraded_ost' />
459           for more details.
460           </para>
461         </listitem>
462         <listitem>
463           <para>OST is nearing its space capacity, though the MDS will already
464           try to avoid allocating new files on overly-full OSTs if possible,
465           see <xref linkend='dbdoclet.balancing_free_space' /> for details.
466           </para>
467         </listitem>
468         <listitem>
469           <para>MDT/OST storage or MDS/OSS node has failed, and will not
470           be available for some time (or forever), but there is still a
471           desire to continue using the filesystem before it is repaired.</para>
472         </listitem>
473       </itemizedlist>
474       <section condition="l24" xml:id="dbdoclet.rmremotedir">
475       <title><indexterm><primary>maintenance</primary><secondary>removing an MDT</secondary></indexterm>Removing an MDT from the File System</title>
476         <para>If the MDT is permanently inaccessible,
477     <literal>lfs rm_entry {directory}</literal> can be used to delete the
478     directory entry for the unavailable MDT. Using <literal>rmdir</literal>
479     would otherwise report an IO error due to the remote MDT being inactive.
480     Please note that if the MDT <emphasis>is</emphasis> available, standard
481     <literal>rm -r</literal> should be used to delete the remote directory.
482     After the remote directory has been removed, the administrator should
483     mark the MDT as permanently inactive with:</para>
484 <screen>lctl conf_param {MDT name}.mdc.active=0</screen>
485 <para>A user can identify which MDT holds a remote sub-directory using
486 the <literal>lfs</literal> utility. For example:</para>
487 <screen>client$ lfs getstripe --mdt-index /mnt/lustre/remote_dir1
488 1
489 client$ mkdir /mnt/lustre/local_dir0
490 client$ lfs getstripe --mdt-index /mnt/lustre/local_dir0
491 0
492 </screen>
493         <para>The <literal>lfs getstripe --mdt-index</literal> command
494         returns the index of the MDT that is serving the given directory.</para>
495           </section>
496           <section xml:id="dbdoclet.inactivemdt" condition='l24'>
497       <title>
498           <indexterm><primary>maintenance</primary></indexterm>
499           <indexterm><primary>maintenance</primary><secondary>inactive MDTs</secondary></indexterm>Working with Inactive MDTs</title>
500     <para>Files located on or below an inactive MDT are inaccessible until
501     the MDT is activated again. Clients accessing an inactive MDT will receive
502     an EIO error.</para>
503       </section>
504       <section remap="h3" xml:id="section_remove_ost">
505       <title><indexterm>
506           <primary>maintenance</primary>
507           <secondary>removing an OST</secondary>
508         </indexterm>Removing an OST from the File System</title>
509       <para>When deactivating an OST, note that the client and MDS each have
510       an OSC device that handles communication with the corresponding OST.
511       To remove an OST from the file system:</para>
512       <orderedlist>
513         <listitem>
514           <para>If the OST is functional, and there are files located on
515           the OST that need to be migrated off of the OST, the file creation
516           for that OST should be temporarily deactivated on the MDS (each MDS
517           if running with multiple MDS nodes in DNE mode).
518           </para>
519           <orderedlist>
520             <listitem>
521               <para condition="l29">With Lustre 2.9 and later, the MDS should be
522               set to only disable file creation on that OST by setting
523               <literal>max_create_count</literal> to zero:
524               <screen>mds# lctl set_param osp.<replaceable>osc_name</replaceable>.max_create_count=0</screen>
525               This ensures that files deleted or migrated off of the OST
526               will have their corresponding OST objects destroyed, and the space
527               will be freed.  For example, to disable <literal>OST0000</literal>
528               in the filesystem <literal>testfs</literal>, run:
529               <screen>mds# lctl set_param osp.testfs-OST0000-osc-MDT*.max_create_count=0</screen>
530               on each MDS in the <literal>testfs</literal> filesystem.</para>
531             </listitem>
532             <listitem>
533               <para>With older versions of Lustre, to deactivate the OSC on the
534               MDS node(s) use:
535               <screen>mds# lctl set_param osp.<replaceable>osc_name</replaceable>.active=0</screen>
536               This will prevent the MDS from attempting any communication with
537               that OST, including destroying objects located thereon.  This is
538               fine if the OST will be removed permanently, if the OST is not
539               stable in operation, or if it is in a read-only state.  Otherwise,
540               the free space and objects on the OST will not decrease when
541               files are deleted, and object destruction will be deferred until
542               the MDS reconnects to the OST.</para>
543               <para>For example, to deactivate <literal>OST0000</literal> in
544               the filesystem <literal>testfs</literal>, run:
545               <screen>mds# lctl set_param osp.testfs-OST0000-osc-MDT*.active=0</screen>
546               Deactivating the OST on the <emphasis>MDS</emphasis> does not
547               prevent use of existing objects for read/write by a client.</para>
548               <note>
549                 <para>If migrating files from a working OST, do not deactivate
550                 the OST on clients. This causes IO errors when accessing files
551                 located there, and migrating files on the OST would fail.</para>
552               </note>
553               <caution>
554                 <para>Do not use <literal>lctl conf_param</literal> to
555                 deactivate the OST if it is still working, as this immediately
556                 and permanently deactivates it in the file system configuration
557                 on both the MDS and all clients.</para>
558               </caution>
559             </listitem>
560           </orderedlist>
561         </listitem>
562         <listitem>
563           <para>Discover all files that have objects residing on the
564           deactivated OST. Depending on whether the deactivated OST is
565           available or not, the data from that OST may be migrated to
566           other OSTs, or may need to be restored from backup.</para>
567           <orderedlist>
568             <listitem>
569               <para>If the OST is still online and available, find all
570               files with objects on the deactivated OST, and copy them
571               to other OSTs in the file system to: </para>
572               <screen>client# lfs find --ost <replaceable>ost_name</replaceable> <replaceable>/mount/point</replaceable> | lfs_migrate -y</screen>
573             </listitem>
574             <listitem>
575               <para>If the OST is no longer available, delete the files
576                 on that OST and restore them from backup:
577                 <screen>client# lfs find --ost <replaceable>ost_uuid</replaceable> -print0 <replaceable>/mount/point</replaceable> |
578         tee /tmp/files_to_restore | xargs -0 -n 1 unlink</screen>
579                 The list of files that need to be restored from backup is
580                 stored in <literal>/tmp/files_to_restore</literal>. Restoring
581                 these files is beyond the scope of this document.</para>
582             </listitem>
583           </orderedlist>
584         </listitem>
585         <listitem>
586           <para>Deactivate the OST.</para>
587           <orderedlist>
588             <listitem>
589               <para>
590                 If there is expected to be a replacement OST in some short
591                 time (a few days), the OST can temporarily be deactivated on
592                 the clients using:
593                 <screen>client# lctl set_param osc.<replaceable>fsname</replaceable>-OST<replaceable>number</replaceable>-*.active=0</screen>
594                 <note><para>This setting is only temporary and will be reset
595                 if the clients are remounted or rebooted. It needs to be run
596                 on all clients.</para>
597                 </note>
598               </para>
599             </listitem>
600             <listitem>
601               <para>If there is not expected to be a replacement for this OST in
602               the near future, permanently deactivate it on all clients and
603               the MDS by running the following command on the MGS:
604               <screen>mgs# lctl conf_param <replaceable>ost_name</replaceable>.osc.active=0</screen></para>
605               <note><para>A deactivated OST still appears in the file system
606                 configuration, though a replacement OST can be created using the
607                 <literal>mkfs.lustre --replace</literal> option, see
608                 <xref linkend="section_restore_ost"/>.
609               </para></note>
610             </listitem>
611           </orderedlist>
612         </listitem>
613       </orderedlist>
614     </section>
615       <section remap="h3" xml:id="section_ydg_pgt_tl">
616       <title><indexterm>
617           <primary>maintenance</primary>
618           <secondary>backing up OST config</secondary>
619         </indexterm>
620         <indexterm>
621           <primary>backup</primary>
622           <secondary>OST config</secondary>
623         </indexterm> Backing Up OST Configuration Files</title>
624       <para>If the OST device is still accessible, then the Lustre
625       configuration files on the OST should be backed up and saved for
626       future use in order to avoid difficulties when a replacement OST is
627       returned to service. These files rarely change, so they can and
628       should be backed up while the OST is functional and accessible. If
629       the deactivated OST is still available to mount (i.e. has not
630       permanently failed or is unmountable due to severe corruption), an
631       effort should be made to preserve these files. </para>
632       <orderedlist>
633         <listitem>
634           <para>Mount the OST file system.
635             <screen>oss# mkdir -p /mnt/ost
636 oss# mount -t ldiskfs <replaceable>/dev/ost_device</replaceable> /mnt/ost</screen>
637           </para>
638         </listitem>
639         <listitem>
640           <para>Back up the OST configuration files.
641             <screen>oss# tar cvf <replaceable>ost_name</replaceable>.tar -C /mnt/ost last_rcvd \
642            CONFIGS/ O/0/LAST_ID</screen>
643           </para>
644         </listitem>
645         <listitem>
646           <para> Unmount the OST file system. <screen>oss# umount /mnt/ost</screen>
647           </para>
648         </listitem>
649       </orderedlist>
650     </section>
651       <section xml:id="section_restore_ost">
652       <title><indexterm>
653           <primary>maintenance</primary>
654           <secondary>restoring OST config</secondary>
655         </indexterm>
656         <indexterm>
657           <primary>backup</primary>
658           <secondary>restoring OST config</secondary>
659         </indexterm> Restoring OST Configuration Files</title>
660       <para>If the original OST is still available, it is best to follow the
661         OST backup and restore procedure given in either
662         <xref linkend="dbdoclet.backup_device"/>, or
663         <xref linkend="backup_fs_level"/> and
664         <xref linkend="backup_fs_level.restore"/>.</para>
665       <para>To replace an OST that was removed from service due to corruption
666       or hardware failure, the replacement OST needs to be formatted using
667       <literal>mkfs.lustre</literal>, and the Lustre file system configuration
668       should be restored, if available.  Any objects stored on the OST will
669       be permanently lost, and files using the OST should be deleted and/or
670       restored from backup.</para>
671       <para condition="l25">With Lustre 2.5 and later, it is possible to
672         replace an OST to the same index without restoring the configuration
673         files, using the <literal>--replace</literal> option at format time.
674         <screen>oss# mkfs.lustre --ost --reformat --replace --index=<replaceable>old_ost_index</replaceable> \
675         <replaceable>other_options</replaceable> <replaceable>/dev/new_ost_dev</replaceable></screen>
676         The MDS and OSS will negotiate the <literal>LAST_ID</literal> value
677         for the replacement OST.
678       </para>
679       <para>If the OST configuration files were not backed up, due to the
680       OST file system being completely inaccessible, it is still possible to
681       replace the failed OST with a new one at the same OST index. </para>
682       <orderedlist>
683         <listitem>
684          <para>For older versions, format the OST file system without the
685            <literal>--replace</literal> option and restore the saved
686            configuration:
687            <screen>oss# mkfs.lustre --ost --reformat --index=<replaceable>old_ost_index</replaceable> \
688            <replaceable>other_options</replaceable> <replaceable>/dev/new_ost_dev</replaceable></screen>
689          </para>
690         </listitem>
691         <listitem>
692           <para> Mount the OST file system.
693             <screen>oss# mkdir /mnt/ost
694 oss# mount -t ldiskfs <replaceable>/dev/new_ost_dev</replaceable> <replaceable>/mnt/ost</replaceable></screen>
695           </para>
696         </listitem>
697         <listitem>
698           <para>Restore the OST configuration files, if available.
699             <screen>oss# tar xvf <replaceable>ost_name</replaceable>.tar -C /mnt/ost</screen></para>
700         </listitem>
701         <listitem>
702           <para>Recreate the OST configuration files, if unavailable. </para>
703           <para>Follow the procedure in
704             <xref linkend="dbdoclet.repair_ost_lastid"/> to recreate the LAST_ID
705             file for this OST index. The <literal>last_rcvd</literal> file
706             will be recreated when the OST is first mounted using the default
707             parameters, which are normally correct for all file systems. The
708             <literal>CONFIGS/mountdata</literal> file is created by
709             <literal>mkfs.lustre</literal> at format time, but has flags set
710             that request it to register itself with the MGS. It is possible to
711             copy the flags from another working OST (which should be the same):
712             <screen>oss1# debugfs -c -R &quot;dump CONFIGS/mountdata /tmp&quot; <replaceable>/dev/other_osdev</replaceable>
713 oss1# scp /tmp/mountdata oss0:/tmp/mountdata
714 oss0# dd if=/tmp/mountdata of=/mnt/ost/CONFIGS/mountdata bs=4 count=1 seek=5 skip=5 conv=notrunc</screen></para>
715         </listitem>
716         <listitem>
717           <para> Unmount the OST file system.
718             <screen>oss# umount /mnt/ost</screen>
719           </para>
720         </listitem>
721       </orderedlist>
722     </section>
723       <section xml:id="section_ucf_qgt_tl">
724       <title><indexterm>
725           <primary>maintenance</primary>
726           <secondary>reintroducing an OSTs</secondary>
727         </indexterm>Returning a Deactivated OST to Service</title>
728       <para>If the OST was permanently deactivated, it needs to be
729       reactivated in the MGS configuration.
730         <screen>mgs# lctl conf_param <replaceable>ost_name</replaceable>.osc.active=1</screen>
731         If the OST was temporarily deactivated, it needs to be reactivated on
732         the MDS and clients.
733         <screen>mds# lctl set_param osp.<replaceable>fsname</replaceable>-OST<replaceable>number</replaceable>-*.active=1
734 client# lctl set_param osc.<replaceable>fsname</replaceable>-OST<replaceable>number</replaceable>-*.active=1</screen></para>
735     </section>
736     </section>
737     <section xml:id="dbdoclet.50438199_77819">
738       <title><indexterm><primary>maintenance</primary><secondary>aborting recovery</secondary></indexterm>
739       <indexterm><primary>backup</primary><secondary>aborting recovery</secondary></indexterm>
740 Aborting Recovery</title>
741       <para>You can abort recovery with either the <literal>lctl</literal> utility or by mounting the target with the <literal>abort_recov</literal> option (<literal>mount -o abort_recov</literal>). When starting a target, run: <screen>mds# mount -t lustre -L <replaceable>mdt_name</replaceable> -o abort_recov <replaceable>/mount_point</replaceable></screen></para>
742       <note>
743         <para>The recovery process is blocked until all OSTs are available. </para>
744       </note>
745     </section>
746     <section xml:id="dbdoclet.50438199_12607">
747       <title><indexterm><primary>maintenance</primary><secondary>identifying OST host</secondary></indexterm>
748 Determining Which Machine is Serving an OST </title>
749       <para>In the course of administering a Lustre file system, you may need to determine which
750       machine is serving a specific OST. It is not as simple as identifying the machine’s IP
751       address, as IP is only one of several networking protocols that the Lustre software uses and,
752       as such, LNet does not use IP addresses as node identifiers, but NIDs instead. To identify the
753       NID that is serving a specific OST, run one of the following commands on a client (you do not
754       need to be a root user):
755       <screen>client$ lctl get_param osc.<replaceable>fsname</replaceable>-OST<replaceable>number</replaceable>*.ost_conn_uuid</screen>
756       For example:
757       <screen>client$ lctl get_param osc.*-OST0000*.ost_conn_uuid 
758 osc.testfs-OST0000-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp</screen>-
759       OR -
760       <screen>client$ lctl get_param osc.*.ost_conn_uuid 
761 osc.testfs-OST0000-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
762 osc.testfs-OST0001-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
763 osc.testfs-OST0002-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
764 osc.testfs-OST0003-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
765 osc.testfs-OST0004-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp</screen></para>
766     </section>
767     <section xml:id="dbdoclet.50438199_62333">
768       <title><indexterm><primary>maintenance</primary><secondary>changing failover node address</secondary></indexterm>
769 Changing the Address of a Failover Node</title>
770       <para>To change the address of a failover node (e.g, to use node X instead of node Y), run
771       this command on the OSS/OST partition (depending on which option was used to originally
772       identify the NID):
773       <screen>oss# tunefs.lustre --erase-params --servicenode=<replaceable>NID</replaceable> <replaceable>/dev/ost_device</replaceable></screen>
774       or
775       <screen>oss# tunefs.lustre --erase-params --failnode=<replaceable>NID</replaceable> <replaceable>/dev/ost_device</replaceable></screen>
776       For more information about the <literal>--servicenode</literal> and
777         <literal>--failnode</literal> options, see <xref xmlns:xlink="http://www.w3.org/1999/xlink"
778         linkend="configuringfailover"/>.</para>
779     </section>
780     <section xml:id="dbdoclet.50438199_62545">
781       <title><indexterm><primary>maintenance</primary><secondary>separate a
782         combined MGS/MDT</secondary></indexterm>
783         Separate a combined MGS/MDT</title>
784       <para>These instructions assume the MGS node will be the same as the MDS
785         node. For instructions on how to move MGS to a different node, see
786         <xref linkend="dbdoclet.changingservernid"/>.</para>
787       <para>These instructions are for doing the split without shutting down
788         other servers and clients.</para>
789       <orderedlist>
790         <listitem>
791           <para>Stop the MDS.</para>
792           <para>Unmount the MDT</para>
793               <screen>umount -f <replaceable>/dev/mdt_device</replaceable> </screen>
794         </listitem>
795         <listitem>
796           <para>Create the MGS.</para>
797               <screen>mds# mkfs.lustre --mgs --device-size=<replaceable>size</replaceable> <replaceable>/dev/mgs_device</replaceable></screen>
798         </listitem>
799         <listitem>
800           <para>Copy the configuration data from MDT disk to the new MGS disk.</para>
801               <screen>mds# mount -t ldiskfs -o ro <replaceable>/dev/mdt_device</replaceable> <replaceable>/mdt_mount_point</replaceable></screen>
802               <screen>mds# mount -t ldiskfs -o rw <replaceable>/dev/mgs_device</replaceable> <replaceable>/mgs_mount_point</replaceable> </screen>
803               <screen>mds# cp -r <replaceable>/mdt_mount_point</replaceable>/CONFIGS/<replaceable>filesystem_name</replaceable>-* <replaceable>/mgs_mount_point</replaceable>/CONFIGS/. </screen>
804               <screen>mds# umount <replaceable>/mgs_mount_point</replaceable></screen>
805               <screen>mds# umount <replaceable>/mdt_mount_point</replaceable></screen>
806           <para>See <xref linkend="dbdoclet.50438199_54623"/> for alternative method.</para>
807         </listitem>
808         <listitem>
809           <para>Start the MGS.</para>
810               <screen>mgs# mount -t lustre <replaceable>/dev/mgs_device</replaceable> <replaceable>/mgs_mount_point</replaceable></screen>
811           <para>Check to make sure it knows about all your file system</para>
812               <screen>mgs:/root# lctl get_param mgs.MGS.filesystems</screen>
813         </listitem>
814         <listitem>
815           <para>Remove the MGS option from the MDT, and set the new MGS nid.</para>
816               <screen>mds# tunefs.lustre --nomgs --mgsnode=<replaceable>new_mgs_nid</replaceable> <replaceable>/dev/mdt-device</replaceable></screen>
817         </listitem>
818         <listitem>
819           <para>Start the MDT.</para>
820               <screen>mds# mount -t lustre <replaceable>/dev/mdt_device /mdt_mount_point</replaceable></screen>
821           <para>Check to make sure the MGS configuration looks right:</para>
822               <screen>mgs# lctl get_param mgs.MGS.live.<replaceable>filesystem_name</replaceable></screen>
823         </listitem>
824       </orderedlist>
825     </section>
826 </chapter>