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