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