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