Whamcloud - gitweb
LUDOC-98 mgs: Document new lctl replace_nids feature
[doc/manual.git] / LustreMaintenance.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="lustremaintenance">
3   <title xml:id="lustremaintenance.title">Lustre Maintenance</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 maintenance tasks:</para>
5   <itemizedlist>
6     <listitem>
7       <para><xref linkend="dbdoclet.50438199_42877"/></para>
8     </listitem>
9     <listitem>
10       <para><xref linkend="dbdoclet.50438199_15240"/></para>
11     </listitem>
12     <listitem>
13       <para><xref linkend="dbdoclet.50438199_26070"/></para>
14     </listitem>
15     <listitem>
16       <para><xref linkend="dbdoclet.50438199_54623"/></para>
17     </listitem>
18     <listitem>
19       <para><xref linkend="dbdoclet.50438199_31353"/></para>
20     </listitem>
21     <listitem>
22       <para><xref linkend="dbdoclet.addingamdt"/></para>
23     </listitem>
24     <listitem>
25       <para><xref linkend="dbdoclet.50438199_22527"/></para>
26     </listitem>
27     <listitem>
28       <para><xref linkend="dbdoclet.50438199_14978"/></para>
29     </listitem>
30     <listitem>
31       <para><xref linkend="dbdoclet.rmremotedir"/></para>
32     </listitem>
33     <listitem>
34       <para><xref linkend="dbdoclet.inactivemdt"/></para>
35     </listitem>
36     <listitem>
37       <para><xref linkend="dbdoclet.50438199_77819"/></para>
38     </listitem>
39     <listitem>
40       <para><xref linkend="dbdoclet.50438199_12607"/></para>
41     </listitem>
42     <listitem>
43       <para><xref linkend="dbdoclet.50438199_62333"/></para>
44     </listitem>
45     <listitem>
46       <para><xref linkend="dbdoclet.50438199_62545"/></para>
47     </listitem>
48   </itemizedlist>
49   <section xml:id="dbdoclet.50438199_42877">
50       <title>
51           <indexterm><primary>maintenance</primary></indexterm>
52           <indexterm><primary>maintenance</primary><secondary>inactive OSTs</secondary></indexterm>
53           Working with Inactive OSTs</title>
54     <para>To mount a client or an MDT with one or more inactive OSTs, run commands similar to this:</para>
55     <screen>client# mount -o exclude=testfs-OST0000 -t lustre \
56            uml1:/testfs /mnt/testfs
57             client# cat /proc/fs/lustre/lov/testfs-clilov-*/target_obd</screen>
58     <para>To activate an inactive OST on a live client or MDT, use the <literal>lctl activate</literal> command on the OSC device. For example:</para>
59     <screen>lctl --device 7 activate</screen>
60     <note>
61       <para>A colon-separated list can also be specified. For example, <literal>exclude=testfs-OST0000:testfs-OST0001</literal>.</para>
62     </note>
63     </section>
64     <section xml:id="dbdoclet.50438199_15240">
65       <title><indexterm><primary>maintenance</primary><secondary>finding nodes</secondary></indexterm>
66 Finding Nodes in the Lustre File System</title>
67       <para>There may be situations in which you need to find all nodes in your Lustre file system or get the names of all OSTs.</para>
68       <para>To get a list of all Lustre nodes, run this command on the MGS:</para>
69       <screen># cat /proc/fs/lustre/mgs/MGS/live/*</screen>
70       <note>
71         <para>This command must be run on the MGS.
72                 </para>
73       </note>
74       <para>In this example, file system lustre has three nodes, <literal>lustre-MDT0000</literal>, <literal>lustre-OST0000</literal>, and <literal>lustre-OST0001</literal>.</para>
75       <screen>cfs21:/tmp# cat /proc/fs/lustre/mgs/MGS/live/* 
76                 fsname: lustre 
77                 flags: 0x0     gen: 26 
78                 lustre-MDT0000 
79                 lustre-OST0000 
80                 lustre-OST0001 </screen>
81       <para>To get the names of all OSTs, run this command on the MDS:</para>
82       <screen># cat /proc/fs/lustre/lov/<replaceable>fsname</replaceable>-mdtlov/target_obd </screen>
83       <note>
84         <para>This command must be run on the MDS.
85                 </para>
86       </note>
87       <para>In this example, there are two OSTs, lustre-OST0000 and lustre-OST0001, which are both active.</para>
88       <screen>cfs21:/tmp# cat /proc/fs/lustre/lov/lustre-mdtlov/target_obd 
89 0: lustre-OST0000_UUID ACTIVE 
90 1: lustre-OST0001_UUID ACTIVE </screen>
91     </section>
92     <section xml:id="dbdoclet.50438199_26070">
93       <title><indexterm><primary>maintenance</primary><secondary>mounting a server</secondary></indexterm>
94 Mounting a Server Without Lustre Service</title>
95       <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>
96       <screen>mount -t lustre <replaceable>/dev/mdt_partition</replaceable> -o nosvc <replaceable>/mount_point</replaceable></screen>
97       <para>The <literal><replaceable>mdt_partition</replaceable></literal> variable is the combined MGS/MDT block device.</para>
98       <para>In this example, the combined MGS/MDT is <literal>testfs-MDT0000</literal> and the mount point is <literal>/mnt/test/mdt</literal>.</para>
99       <screen>$ mount -t lustre -L testfs-MDT0000 -o nosvc /mnt/test/mdt</screen>
100     </section>
101     <section xml:id="dbdoclet.50438199_54623">
102       <title><indexterm><primary>maintenance</primary><secondary>regenerating config logs</secondary></indexterm>
103 Regenerating Lustre Configuration Logs</title>
104       <para>If the Lustre system&apos;s configuration logs are in a state where the file system cannot be started, use the <literal>writeconf</literal> command to erase them. After the <literal>writeconf</literal> command is run and the servers restart, the configuration logs are re-generated and stored on the MGS (as in a new file system).</para>
105       <para>You should only use the <literal>writeconf</literal> command if:</para>
106       <itemizedlist>
107         <listitem>
108           <para>The configuration logs are in a state where the file system cannot start</para>
109         </listitem>
110         <listitem>
111           <para>A server NID is being changed</para>
112         </listitem>
113       </itemizedlist>
114       <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>
115       <itemizedlist>
116         <listitem>
117           <para>Shut down the file system before running the <literal>writeconf</literal> command</para>
118         </listitem>
119         <listitem>
120           <para>Run the <literal>writeconf</literal> command on all servers (MDT first, then OSTs)</para>
121         </listitem>
122         <listitem>
123           <para>Start the file system in this order:</para>
124           <itemizedlist>
125             <listitem>
126               <para>MGS (or the combined MGS/MDT)</para>
127             </listitem>
128             <listitem>
129               <para>MDT</para>
130             </listitem>
131             <listitem>
132               <para>OSTs</para>
133             </listitem>
134             <listitem>
135               <para>Lustre clients</para>
136             </listitem>
137           </itemizedlist>
138         </listitem>
139       </itemizedlist>
140       <caution>
141         <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>
142       </caution>
143       <para>To regenerate Lustre&apos;s system configuration logs:</para>
144       <orderedlist>
145         <listitem>
146           <para>Shut down the file system in this order.</para>
147           <orderedlist>
148             <listitem>
149               <para>Unmount the clients.</para>
150             </listitem>
151             <listitem>
152               <para>Unmount the MDT.</para>
153             </listitem>
154             <listitem>
155               <para>Unmount all OSTs.</para>
156             </listitem>
157           </orderedlist>
158         </listitem>
159         <listitem>
160           <para>Make sure the the MDT and OST devices are available.</para>
161         </listitem>
162         <listitem>
163           <para>Run the <literal>writeconf</literal> command on all servers.</para>
164           <para>Run writeconf on the MDT first, and then the OSTs.</para>
165           <orderedlist>
166             <listitem>
167               <para>On the MDT, run:</para>
168               <screen>mdt# tunefs.lustre --writeconf <replaceable>/dev/mdt_device</replaceable></screen>
169             </listitem>
170             <listitem>
171               <para>
172               On each OST, run:
173               
174           <screen>ost# tunefs.lustre --writeconf <replaceable>/dev/ost_device</replaceable></screen>
175           </para>
176             </listitem>
177           </orderedlist>
178         </listitem>
179         <listitem>
180           <para>Restart the file system in this order.</para>
181           <orderedlist>
182             <listitem>
183               <para>Mount the MGS (or the combined MGS/MDT).</para>
184             </listitem>
185             <listitem>
186               <para>Mount the MDT.</para>
187             </listitem>
188             <listitem>
189               <para>Mount the OSTs.</para>
190             </listitem>
191             <listitem>
192               <para>Mount the clients.</para>
193             </listitem>
194           </orderedlist>
195         </listitem>
196       </orderedlist>
197       <para>After the <literal>writeconf</literal> command is run, the configuration logs are re-generated as servers restart.</para>
198     </section>
199     <section xml:id="dbdoclet.50438199_31353">
200       <title><indexterm><primary>maintenance</primary><secondary>changing a NID</secondary></indexterm>
201 Changing a Server NID</title>
202       <para>In Lustre 2.3 or earlier, the <literal>tunefs.lustre --writeconf</literal> command is used to rewrite all of the configuration files.</para>
203       <para condition="l24">If you need to change the NID on the MDT or OST, a new <literal>replace_nids</literal> command was added in Lustre 2.4 to simplify this process.
204       The <literal>replace_nids</literal> command differs from <literal>tunefs.lustre --writeconf</literal> in that it does not erase the entire configuration log, precluding the need the need to execute the <literal>writeconf</literal> command on all servers and re-specify all permanent parameter settings. However, the <literal>writeconf</literal> command can still be used if desired.</para>
205       <para>Change a server NID in these situations:</para>
206       <itemizedlist>
207         <listitem>
208           <para>New server hardware is added to the file system, and the MDS or an OSS is being moved to the new machine.</para>
209         </listitem>
210         <listitem>
211           <para>New network card is installed in the server.</para>
212         </listitem>
213         <listitem>
214           <para>You want to reassign IP addresses.</para>
215         </listitem>
216       </itemizedlist>
217       <para>To change a server NID:</para>
218       <orderedlist>
219         <listitem>
220                 <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>
221           <para>The <literal>lctl list_nids</literal> command indicates which network(s) are configured to work with Lustre.</para>
222         </listitem>
223         <listitem>
224           <para>Shut down the file system in this order:</para>
225           <orderedlist>
226             <listitem>
227               <para>Unmount the clients.</para>
228             </listitem>
229             <listitem>
230               <para>Unmount the MDT.</para>
231             </listitem>
232             <listitem>
233               <para>Unmount all OSTs.</para>
234             </listitem>
235           </orderedlist>
236         </listitem>
237         <listitem>
238           <para>If the MGS and MDS share a partition, start the MGS only:</para>
239           <screen>mount -t lustre <replaceable>MDT partition</replaceable> -o nosvc <replaceable>mount_point</replaceable></screen>
240         </listitem>
241         <listitem>
242           <para>Run the <literal>replace_nids</literal> command on the MGS:</para>
243           <screen>lctl replace_nids <replaceable>devicename</replaceable> <replaceable>nid1</replaceable>[,nid2,nid3 ...]</screen>
244           <para>where <replaceable>devicename</replaceable> is the Lustre target name, e.g. <literal>myfs-OST0013</literal></para>
245         </listitem>
246         <listitem>
247           <para>If the MGS and MDS share a partition, stop the MGS:</para>
248           <screen>umount <replaceable>mount_point</replaceable></screen>
249         </listitem>
250       </orderedlist>
251       <note><para>The <literal>replace_nids</literal> command also cleans all old, invalidated records out of the configuration log, while preserving all other current settings.</para></note> 
252       <note><para>The previous configuration log is backed up on the MGS disk with the suffix <literal>'.bak'</literal>.</para></note>
253     </section>
254     <section xml:id="dbdoclet.addingamdt" condition='l24'>
255       <title><indexterm><primary>maintenance</primary><secondary>adding an MDT</secondary></indexterm>Adding a new MDT to a Lustre file system</title>
256         <para>Additional MDTs can be added to serve one or more remote sub-directories within the filesystem. It is possible to have multiple remote sub-directories reference the same MDT. However, the root directory will always be located on MDT0. To add a new MDT into the file system:</para>
257       <orderedlist>
258         <listitem>
259                         <para>Discover the maximum MDT index. Each MDTs must have unique index.</para>
260                 <screen>
261 client$ lctl dl | grep mdc
262 36 UP mdc lustre-MDT0000-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
263 37 UP mdc lustre-MDT0001-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
264 38 UP mdc lustre-MDT0002-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
265 39 UP mdc lustre-MDT0003-mdc-ffff88004edf3c00 4c8be054-144f-9359-b063-8477566eb84e 5
266                 </screen>
267         </listitem>
268         <listitem>
269                         <para>Add the new block device as a new MDT at the next available index. In this example, the next available index is 4.</para>
270                 <screen>
271 mds# mkfs.lustre --reformat --fsname=<replaceable>filesystem_name</replaceable> --mdt --mgsnode=<replaceable>mgsnode</replaceable> --index 4 <replaceable>/dev/mdt4_device</replaceable>
272                 </screen>
273         </listitem>
274         <listitem>
275                         <para>Mount the MDTs.</para>
276                 <screen>
277 mds# mount –t lustre <replaceable>/dev/mdt4_blockdevice</replaceable> /mnt/mdt4
278                 </screen>
279         </listitem>
280       </orderedlist>
281         </section>
282     <section xml:id="dbdoclet.50438199_22527">
283       <title><indexterm><primary>maintenance</primary><secondary>adding a OST</secondary></indexterm>
284 Adding a New OST to a Lustre File System</title>
285       <para>To add an OST to existing Lustre file system:</para>
286       <orderedlist>
287         <listitem>
288           <para> Add a new OST by passing on the following commands, run:</para>
289           <screen>oss# mkfs.lustre --fsname=spfs --mgsnode=mds16@tcp0 --ost --index=12 /dev/sda
290 oss# mkdir -p /mnt/test/ost12
291 oss# mount -t lustre /dev/sda /mnt/test/ost12</screen>
292         </listitem>
293         <listitem>
294           <para> Migrate the data (possibly).</para>
295           <para>The file system is quite unbalanced when new empty OSTs are added. New file creations are automatically balanced. If this is a scratch file system or files are pruned at a regular interval, then no further work may be needed.</para>
296           <para>New files being created will preferentially be placed on the empty OST. As old files are deleted, they will release space on the old OST.</para>
297           <para>Files existing prior to the expansion can optionally be rebalanced with an in-place copy, which can be done with a simple script. The basic method is to copy existing files to a temporary file, then move the temp file over the old one. This should not be attempted with files which are currently being written to by users or applications. This operation redistributes the stripes over the entire set of OSTs.</para>
298           <para>For example, to rebalance all files within <literal>/mnt/lustre/dir</literal>, enter:</para>
299           <screen>client# lfs_migrate /mnt/lustre/file</screen>
300           <para>To migrate files within the <literal>/test</literal> filesystem on <literal>OST0004</literal> that are larger than 4GB in size, enter:</para>
301           <screen>client# lfs find /test -obd test-OST0004 -size +4G | lfs_migrate -y</screen>
302           <para>See <xref linkend="dbdoclet.50438206_42260"/>  for more details.</para>
303         </listitem>
304       </orderedlist>
305     </section>
306     <section xml:id="dbdoclet.50438199_14978">
307       <title><indexterm><primary>maintenance</primary><secondary>restoring a OST</secondary></indexterm>
308       <indexterm><primary>maintenance</primary><secondary>removing a OST</secondary></indexterm>
309 Removing and Restoring OSTs</title>
310       <para>OSTs can be removed from and restored to a Lustre file system. Currently in Lustre, removing a OST means the OST is &apos;deactivated&apos; in the file system, not permanently removed.</para>
311                 <note><para>A removed OST still appears in the file system; do not create a new OST with the same name.</para></note>
312       <para>You may want to remove (deactivate) an OST and prevent new files from being written to it in several situations:</para>
313       <itemizedlist>
314         <listitem>
315           <para>Hard drive has failed and a RAID resync/rebuild is underway</para>
316         </listitem>
317         <listitem>
318           <para>OST is nearing its space capacity</para>
319         </listitem>
320         <listitem>
321                   <para>OST storage has failed permanently</para>
322             </listitem>
323       </itemizedlist>
324       <section condition="l24" xml:id="dbdoclet.rmremotedir">
325       <title><indexterm><primary>maintenance</primary><secondary>removing a MDT</secondary></indexterm>Removing a MDT from the File System</title>
326         <para>If the MDT is permanently inaccessible, <literal>lfs rmdir {directory}</literal> can be used to delete the directory entry. A normal <literal>rmdir</literal> will report an IO error due to the remote MDT being inactive. After the remote directory has been removed, the administrator should mark the MDT as permanently inactive with:</para>
327 <screen>lctl conf_param {MDT name}.mdc.active=0
328 </screen>
329 <para>A user can identify the location of a remote sub-directory using the <literal>lfs</literal> utility. For example:</para>
330 <screen>client$ lfs getstripe -M /mnt/lustre/remote_dir1
331 1
332 client$ mkdir /mnt/lustre/local_dir0
333 client$ lfs getstripe -M /mnt/lustre/local_dir0
334 0
335 </screen>
336         <para>The <literal>getstripe -M</literal> parameters return the index of the MDT that is serving the given directory.</para>
337           </section>
338           <section xml:id="dbdoclet.inactivemdt" condition='l24'>
339       <title>
340           <indexterm><primary>maintenance</primary></indexterm>
341           <indexterm><primary>maintenance</primary><secondary>inactive MDTs</secondary></indexterm>Working with Inactive MDTs</title>
342     <para>Files located on or below an inactive MDT are inaccessible until the MDT is activated again. Clients accessing an inactive MDT will receive an EIO error.</para></section>
343       <section remap="h3">
344       <title><indexterm><primary>maintenance</primary><secondary>removing a OST</secondary></indexterm>
345         Removing an OST from the File System</title>
346         <para>When removing an OST, remember that the MDT does not communicate directly with OSTs. Rather, each OST has a corresponding OSC which communicates with the MDT. It is necessary to determine the device number of the OSC that corresponds to the OST. Then, you use this device number to deactivate the OSC on the MDT.</para>
347         <para>To remove an OST from the file system:</para>
348         <orderedlist>
349           <listitem>
350             <para>For the OST to be removed, determine the device number of the corresponding OSC on the MDT.</para>
351             <orderedlist>
352               <listitem>
353                 <para>List all OSCs on the node, along with their device numbers. Run:</para>
354                 <screen>lctl dl | grep osc</screen>
355                 <para>For example: <literal>lctl dl | grep</literal></para>
356                 <screen>11 UP osc lustre-OST-0000-osc-cac94211 4ea5b30f-6a8e-55a0-7519-2f20318ebdb4 5
357 12 UP osc lustre-OST-0001-osc-cac94211 4ea5b30f-6a8e-55a0-7519-2f20318ebdb4 5
358 13 IN osc lustre-OST-0000-osc lustre-MDT0000-mdtlov_UUID 5
359 14 UP osc lustre-OST-0001-osc lustre-MDT0000-mdtlov_UUID 5</screen>
360               </listitem>
361               <listitem>
362                 <para>Determine the device number of the OSC that corresponds to the OST to be removed.</para>
363               </listitem>
364             </orderedlist>
365           </listitem>
366           <listitem>
367             <para>Temporarily deactivate the OSC on the MDT. On the MDT, run: </para>
368             <screen>mds# lctl --device <replaceable>lustre_devno</replaceable> deactivate</screen>
369             <para>For example, based on the command output in Step 1, to deactivate device 13 (the MDT’s OSC for <literal>OST-0000</literal>), the command would be: 
370 </para>
371             <screen>mds# lctl --device 13 deactivate</screen>
372             <para>This marks the OST as inactive on the MDS, so no new objects are assigned to the OST. This does not prevent use of existing objects for reads or writes. 
373 </para>
374             <note>
375               <para>Do not deactivate the OST on the clients. Do so causes errors (EIOs), and the copy out to fail. </para>
376             </note>
377             <caution>
378               <para>Do not use <literal>lctl conf_param</literal> to deactivate the OST. It permanently sets a parameter in the file system configuration.</para>
379             </caution>
380           </listitem>
381           <listitem>
382             <para>Discover all files that have objects residing on the deactivated OST. </para>
383             <para>Depending on whether the deactivated OST is available or not, the data from that OST may be migrated to other OSTs, or may need to be restored from backup.
384 </para>
385             <orderedlist>
386               <listitem>
387                 <para>If the OST is still online and available, find all files with objects on the deactivated OST, and copy them to other OSTs in the file system to:
388 </para>
389                 <screen>client# lfs find --obd <replaceable>ost_name</replaceable> <replaceable>/mount/point</replaceable> | lfs_migrate -y</screen>
390               </listitem>
391               <listitem>
392                 <para>If the OST is no longer available, delete the files on that OST and restore them from backup:
393                   <screen>client# lfs find --obd <replaceable>ost_uuid</replaceable> -print0 <replaceable>/mount/point</replaceable> | \
394            tee /tmp/files_to_restore | xargs -0 -n 1 unlink</screen>
395                   The list of files that need to be restored from backup is stored in <literal>/tmp/files_to_restore</literal>. Restoring these files is beyond the scope of this document.</para>
396               </listitem>
397             </orderedlist>
398           </listitem>
399           <listitem>
400             <para>Deactivate the OST.</para>
401             <orderedlist>
402               <listitem>
403                 <para>To temporarily disable the deactivated OST, enter: <screen>[client]# lctl set_param osc.<replaceable>fsname</replaceable>-<replaceable>OSTnumber</replaceable>-*.active=0</screen>If there is expected to be a replacement OST in some short time (a few days), the OST can temporarily be deactivated on the clients: <note>
404                     <para>This setting is only temporary and will be reset if the clients or MDS are rebooted. It needs to be run on all clients.</para>
405                   </note></para>
406               </listitem>
407             </orderedlist>
408             <para>If there is not expected to be a replacement for this OST in the near future, permanently deactivate the OST on all clients and the MDS: <screen>[mgs]# lctl conf_param <replaceable>ost_name</replaceable>.osc.active=0</screen></para>
409             <note>
410               <para>A removed OST still appears in the file system; do not create a new OST with the same name.</para>
411             </note>
412           </listitem>
413         </orderedlist>
414       </section>
415       <section remap="h3">
416         <title><indexterm><primary>maintenance</primary><secondary>backing up OST config</secondary></indexterm>
417 <indexterm><primary>backup</primary><secondary>OST config</secondary></indexterm>
418 Backing Up OST Configuration Files</title>
419         <para>If the OST device is still accessible, then the Lustre configuration files on the OST should be backed up and saved for future use in order to avoid difficulties when a replacement OST is returned to service. These files rarely change, so they can and should be backed up while the OST is functional and accessible. If the deactivated OST is still available to mount (i.e. has not permanently failed or is unmountable due to severe corruption), an effort should be made to preserve these files. </para>
420         <orderedlist>
421           <listitem>
422             <para>Mount the OST filesystem.
423              <screen>oss# mkdir -p /mnt/ost
424 [oss]# mount -t ldiskfs <replaceable>/dev/ost_device</replaceable> /mnt/ost</screen>
425           </para>
426           </listitem>
427           <listitem>
428             <para>Back up the OST configuration files.
429              <screen>oss# tar cvf <replaceable>ost_name</replaceable>.tar -C /mnt/ost last_rcvd \
430            CONFIGS/ O/0/LAST_ID</screen>
431               </para>
432           </listitem>
433           <listitem>
434             <para>
435              Unmount the OST filesystem.
436              <screen>oss# umount /mnt/ost</screen>
437               </para>
438           </listitem>
439         </orderedlist>
440       </section>
441       <section>
442         <title><indexterm><primary>maintenance</primary><secondary>restoring OST config</secondary></indexterm>
443 <indexterm><primary>backup</primary><secondary>restoring OST config</secondary></indexterm>
444 Restoring OST Configuration Files</title>
445         <para>If the original OST is still available, it is best to follow the OST backup and restore procedure given in either <xref linkend="dbdoclet.50438207_71633"/>, or <xref linkend="dbdoclet.50438207_21638"/> and <xref linkend="dbdoclet.50438207_22325"/>. 
446         </para>
447         <para>To replace an OST that was removed from service due to corruption or hardware failure, the file system needs to be formatted for Lustre, and the Lustre configuration should be restored, if available. 
448             
449             </para>
450         <para>If the OST configuration files were not backed up, due to the OST file system being completely inaccessible, it is still possible to replace the failed OST with a new one at the same OST index. </para>
451         <orderedlist>
452           <listitem>
453             <para>
454             Format the OST file system. 
455             <screen>oss# mkfs.lustre --ost --index=<replaceable>old_ost_index</replaceable> <replaceable>other_options</replaceable> \
456            <replaceable>/dev/new_ost_dev</replaceable></screen>
457             </para>
458           </listitem>
459           <listitem>
460             <para>
461              Mount the OST filesystem. 
462             <screen>oss# mkdir /mnt/ost
463 oss# mount -t ldiskfs <replaceable>/dev/new_ost_dev</replaceable> <replaceable>/mnt/ost</replaceable></screen>
464             </para>
465           </listitem>
466           <listitem>
467             <para>Restore the OST configuration files, if available. 
468             <screen>oss# tar xvf <replaceable>ost_name</replaceable>.tar -C /mnt/ost</screen></para>
469           </listitem>
470           <listitem>
471             <para>Recreate the OST configuration files, if unavailable.
472         </para>
473             <para>Follow the procedure in <xref linkend="dbdoclet.50438198_69657"/> to recreate the
474             LAST_ID file for this OST index. The <literal>last_rcvd</literal> file will be recreated
475             when the OST is first mounted using the default parameters, which are normally correct
476             for all file systems. The <literal>CONFIGS/mountdata</literal> file is created by
477               <literal>mkfs.lustre</literal> at format time, but has flags set that request it to
478             register itself with the MGS. It is possible to copy these flags from another working
479             OST (which should be the same):
480             <screen>oss1# debugfs -c -R &quot;dump CONFIGS/mountdata /tmp/ldd&quot; <replaceable>/dev/other_osdev</replaceable>
481 oss1# scp /tmp/ldd oss0:/tmp/ldd
482 oss0# dd if=/tmp/ldd of=/mnt/ost/CONFIGS/mountdata bs=4 count=1 seek=5 skip=5 conv=notrunc</screen></para>
483           </listitem>
484           <listitem>
485             <para>
486             Unmount the OST filesystem.
487              <screen>oss# umount /mnt/ost</screen>
488             </para>
489           </listitem>
490         </orderedlist>
491       </section>
492       <section>
493         <title><indexterm><primary>maintenance</primary><secondary>reintroducing an OSTs</secondary></indexterm>
494 Returning a Deactivated OST to Service</title>
495         <para> If the OST was permanently deactivated, it needs to be reactivated in the MGS configuration. <screen>mgs# lctl conf_param <replaceable>ost_name</replaceable>.osc.active=1</screen> If the OST was temporarily deactivated, it needs to be reactivated on the MDS and clients. <screen>mds# lctl --device <replaceable>lustre_devno</replaceable> activate
496                     client# lctl set_param osc.<replaceable>fsname</replaceable>-<replaceable>OSTnumber</replaceable>-*.active=0</screen></para>
497       </section>
498     </section>
499     <section xml:id="dbdoclet.50438199_77819">
500       <title><indexterm><primary>maintenance</primary><secondary>aborting recovery</secondary></indexterm>
501       <indexterm><primary>backup</primary><secondary>aborting recovery</secondary></indexterm>
502 Aborting Recovery</title>
503       <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>
504       <note>
505         <para>The recovery process is blocked until all OSTs are available. </para>
506       </note>
507     </section>
508     <section xml:id="dbdoclet.50438199_12607">
509       <title><indexterm><primary>maintenance</primary><secondary>identifying OST host</secondary></indexterm>
510 Determining Which Machine is Serving an OST </title>
511       <para>In the course of administering a Lustre file system, you may need to determine which machine is serving a specific OST. It is not as simple as identifying the machine’s IP address, as IP is only one of several networking protocols that Lustre uses and, as such, LNET does not use IP addresses as node identifiers, but NIDs instead. To identify the NID that is serving a specific OST, run one of the following commands on a client (you do not need to be a root user): <screen>client$ lctl get_param osc.<replaceable>fsname</replaceable>-<replaceable>OSTnumber</replaceable>*.ost_conn_uuid</screen>For example: <screen>client$ lctl get_param osc.*-OST0000*.ost_conn_uuid 
512 osc.lustre-OST0000-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp</screen>- OR - <screen>client$ lctl get_param osc.*.ost_conn_uuid 
513 osc.lustre-OST0000-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
514 osc.lustre-OST0001-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
515 osc.lustre-OST0002-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
516 osc.lustre-OST0003-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp
517 osc.lustre-OST0004-osc-f1579000.ost_conn_uuid=192.168.20.1@tcp</screen></para>
518     </section>
519     <section xml:id="dbdoclet.50438199_62333">
520       <title><indexterm><primary>maintenance</primary><secondary>changing failover node address</secondary></indexterm>
521 Changing the Address of a Failover Node</title>
522       <para>To change the address of a failover node (e.g, to use node X instead of node Y), run this command on the OSS/OST partition:
523               <screen>oss# tunefs.lustre --erase-params --failnode=<replaceable>NID</replaceable> <replaceable>/dev/ost_device</replaceable></screen>
524               or
525               <screen>oss# tunefs.lustre --erase-params --servicenode=<replaceable>NID</replaceable> <replaceable>/dev/ost_device</replaceable></screen>
526       </para>
527     </section>
528     <section xml:id="dbdoclet.50438199_62545">
529       <title><indexterm><primary>maintenance</primary><secondary>separate a combined MGS/MDT</secondary></indexterm>
530 Separate a combined MGS/MDT</title>
531       <para>These instructions assume the MGS node will be the same as the MDS node. For instructions on how to move MGS to a different node, see <xref linkend="dbdoclet.50438199_31353"/>.</para>
532       <para>These instructions are for doing the split without shutting down other servers and clients.</para>
533       <orderedlist>
534         <listitem>
535           <para>Stop the MDS.</para>
536           <para>Unmount the MDT</para>
537               <screen>umount -f <replaceable>/dev/mdt_device</replaceable> </screen>
538         </listitem>
539         <listitem>
540           <para>Create the MGS.</para>
541               <screen>mds# mkfs.lustre --mgs --device-size=<replaceable>size</replaceable> <replaceable>/dev/mgs_device</replaceable></screen>
542         </listitem>
543         <listitem>
544           <para>Copy the configuration data from MDT disk to the new MGS disk.</para>
545               <screen>mds# mount -t ldiskfs -o ro <replaceable>/dev/mdt_device</replaceable> <replaceable>/mdt_mount_point</replaceable></screen>
546               <screen>mds# mount -t ldiskfs -o rw <replaceable>/dev/mgs_device</replaceable> <replaceable>/mgs_mount_point</replaceable> </screen>
547               <screen>mds# cp -r <replaceable>/mdt_mount_point</replaceable>/CONFIGS/<replaceable>filesystem_name</replaceable>-* <replaceable>/mgs_mount_point</replaceable>/CONFIGS/. </screen>
548               <screen>mds# umount <replaceable>/mgs_mount_point</replaceable></screen>
549               <screen>mds# umount <replaceable>/mdt_mount_point</replaceable></screen>
550           <para>See <xref linkend="dbdoclet.50438199_54623"/> for alternative method.</para>
551         </listitem>
552         <listitem>
553           <para>Start the MGS.</para>
554               <screen>mgs# mount -t lustre <replaceable>/dev/mgs_device</replaceable> <replaceable>/mgs_mount_point</replaceable></screen>
555           <para>Check to make sure it knows about all your filesystem</para>
556               <screen>cat /proc/fs/lustre/mgs/MGS/filesystems</screen>
557         </listitem>
558         <listitem>
559           <para>Remove the MGS option from the MDT, and set the new MGS nid.</para>
560               <screen>mds# tunefs.lustre --nomgs --mgsnode=<replaceable>new_mgs_nid</replaceable> <replaceable>/dev/mdt-device</replaceable></screen>
561         </listitem>
562         <listitem>
563           <para>Start the MDT.</para>
564               <screen>mds# mount -t lustre <replaceable>/dev/mdt_device /mdt_mount_point</replaceable></screen>
565           <para>Check to make sure the MGS configuration look right</para>
566               <screen>mds# cat /proc/fs/lustre/mgs/MGS/live/<replaceable>filesystem_name</replaceable></screen>
567         </listitem>
568       </orderedlist>
569     </section>
570 </chapter>