Whamcloud - gitweb
LUDOC-428 sec: doc for Lustre isolation
[doc/manual.git] / LustreOperations.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="lustreoperations">
5   <title xml:id="lustreoperations.title">Lustre Operations</title>
6   <para>Once you have the Lustre file system up and running, you can use the
7   procedures in this section to perform these basic Lustre administration
8   tasks.</para>
9   <section xml:id="dbdoclet.50438194_42877">
10     <title>
11     <indexterm>
12       <primary>operations</primary>
13     </indexterm>
14     <indexterm>
15       <primary>operations</primary>
16       <secondary>mounting by label</secondary>
17     </indexterm>Mounting by Label</title>
18     <para>The file system name is limited to 8 characters. We have encoded the
19     file system and target information in the disk label, so you can mount by
20     label. This allows system administrators to move disks around without
21     worrying about issues such as SCSI disk reordering or getting the 
22     <literal>/dev/device</literal> wrong for a shared target. Soon, file system
23     naming will be made as fail-safe as possible. Currently, Linux disk labels
24     are limited to 16 characters. To identify the target within the file
25     system, 8 characters are reserved, leaving 8 characters for the file system
26     name:</para>
27     <screen>
28 <replaceable>fsname</replaceable>-MDT0000 or 
29 <replaceable>fsname</replaceable>-OST0a19
30 </screen>
31     <para>To mount by label, use this command:</para>
32     <screen>
33 mount -t lustre -L 
34 <replaceable>file_system_label</replaceable> 
35 <replaceable>/mount_point</replaceable>
36 </screen>
37     <para>This is an example of mount-by-label:</para>
38     <screen>
39 mds# mount -t lustre -L testfs-MDT0000 /mnt/mdt
40 </screen>
41     <caution>
42       <para>Mount-by-label should NOT be used in a multi-path environment or
43       when snapshots are being created of the device, since multiple block
44       devices will have the same label.</para>
45     </caution>
46     <para>Although the file system name is internally limited to 8 characters,
47     you can mount the clients at any mount point, so file system users are not
48     subjected to short names. Here is an example:</para>
49     <screen>
50 client# mount -t lustre mds0@tcp0:/short 
51 <replaceable>/dev/long_mountpoint_name</replaceable>
52 </screen>
53   </section>
54   <section xml:id="dbdoclet.50438194_24122">
55     <title>
56     <indexterm>
57       <primary>operations</primary>
58       <secondary>starting</secondary>
59     </indexterm>Starting Lustre</title>
60     <para>On the first start of a Lustre file system, the components must be
61     started in the following order:</para>
62     <orderedlist>
63       <listitem>
64         <para>Mount the MGT.</para>
65         <note>
66           <para>If a combined MGT/MDT is present, Lustre will correctly mount
67           the MGT and MDT automatically.</para>
68         </note>
69       </listitem>
70       <listitem>
71         <para>Mount the MDT.</para>
72         <note>
73           <para condition='l24'>Mount all MDTs if multiple MDTs are
74           present.</para>
75         </note>
76       </listitem>
77       <listitem>
78         <para>Mount the OST(s).</para>
79       </listitem>
80       <listitem>
81         <para>Mount the client(s).</para>
82       </listitem>
83     </orderedlist>
84   </section>
85   <section xml:id="dbdoclet.50438194_84876">
86     <title>
87     <indexterm>
88       <primary>operations</primary>
89       <secondary>mounting</secondary>
90     </indexterm>Mounting a Server</title>
91     <para>Starting a Lustre server is straightforward and only involves the
92     mount command. Lustre servers can be added to 
93     <literal>/etc/fstab</literal>:</para>
94     <screen>
95 mount -t lustre
96 </screen>
97     <para>The mount command generates output similar to this:</para>
98     <screen>
99 /dev/sda1 on /mnt/test/mdt type lustre (rw)
100 /dev/sda2 on /mnt/test/ost0 type lustre (rw)
101 192.168.0.21@tcp:/testfs on /mnt/testfs type lustre (rw)
102 </screen>
103     <para>In this example, the MDT, an OST (ost0) and file system (testfs) are
104     mounted.</para>
105     <screen>
106 LABEL=testfs-MDT0000 /mnt/test/mdt lustre defaults,_netdev,noauto 0 0
107 LABEL=testfs-OST0000 /mnt/test/ost0 lustre defaults,_netdev,noauto 0 0
108 </screen>
109     <para>In general, it is wise to specify noauto and let your
110     high-availability (HA) package manage when to mount the device. If you are
111     not using failover, make sure that networking has been started before
112     mounting a Lustre server. If you are running Red Hat Enterprise Linux, SUSE
113     Linux Enterprise Server, Debian operating system (and perhaps others), use
114     the 
115     <literal>_netdev</literal> flag to ensure that these disks are mounted after
116     the network is up.</para>
117     <para>We are mounting by disk label here. The label of a device can be read
118     with 
119     <literal>e2label</literal>. The label of a newly-formatted Lustre server
120     may end in 
121     <literal>FFFF</literal> if the 
122     <literal>--index</literal> option is not specified to 
123     <literal>mkfs.lustre</literal>, meaning that it has yet to be assigned. The
124     assignment takes place when the server is first started, and the disk label
125     is updated. It is recommended that the 
126     <literal>--index</literal> option always be used, which will also ensure
127     that the label is set at format time.</para>
128     <caution>
129       <para>Do not do this when the client and OSS are on the same node, as
130       memory pressure between the client and OSS can lead to deadlocks.</para>
131     </caution>
132     <caution>
133       <para>Mount-by-label should NOT be used in a multi-path
134       environment.</para>
135     </caution>
136   </section>
137   <section xml:id="dbdoclet.shutdownLustre">
138       <title>
139           <indexterm>
140               <primary>operations</primary>
141               <secondary>shutdownLustre</secondary>
142           </indexterm>Stopping the Filesystem</title>
143       <para>A complete Lustre filesystem shutdown occurs by unmounting all
144       clients and servers in the order shown below.  Please note that unmounting
145       a block device causes the Lustre software to be shut down on that node.
146       </para>
147       <note><para>Please note that the <literal>-a -t lustre</literal> in the
148           commands below is not the name of a filesystem, but rather is
149           specifying to unmount all entries in /etc/mtab that are of type
150           <literal>lustre</literal></para></note>
151       <orderedlist>
152           <listitem><para>Unmount the clients</para>
153               <para>On each client node, unmount the filesystem on that client
154               using the <literal>umount</literal> command:</para>
155               <para><literal>umount -a -t lustre</literal></para>
156               <para>The example below shows the unmount of the
157               <literal>testfs</literal> filesystem on a client node:</para>
158               <para><screen>[root@client1 ~]# mount |grep testfs
159 XXX.XXX.0.11@tcp:/testfs on /mnt/testfs type lustre (rw,lazystatfs)
160
161 [root@client1 ~]# umount -a -t lustre
162 [154523.177714] Lustre: Unmounted testfs-client</screen></para>
163           </listitem>
164           <listitem><para>Unmount the MDT and MGT</para>
165               <para>On the MGS and MDS node(s), use the <literal>umount</literal>
166               command:</para>
167               <para><literal>umount -a -t lustre</literal></para>
168               <para>The example below shows the unmount of the MDT and MGT for
169               the <literal>testfs</literal> filesystem on a combined MGS/MDS:
170               </para>
171               <para><screen>[root@mds1 ~]# mount |grep lustre
172 /dev/sda on /mnt/mgt type lustre (ro)
173 /dev/sdb on /mnt/mdt type lustre (ro)
174
175 [root@mds1 ~]# umount -a -t lustre
176 [155263.566230] Lustre: Failing over testfs-MDT0000
177 [155263.775355] Lustre: server umount testfs-MDT0000 complete
178 [155269.843862] Lustre: server umount MGS complete</screen></para>
179           <para>For a seperate MGS and MDS, the same command is used, first on
180           the MDS and then followed by the MGS.</para>
181           </listitem>
182           <listitem><para>Unmount all the OSTs</para>
183               <para>On each OSS node, use the <literal>umount</literal> command:
184               </para>
185               <para><literal>umount -a -t lustre</literal></para>
186               <para>The example below shows the unmount of all OSTs for the
187               <literal>testfs</literal> filesystem on server
188               <literal>OSS1</literal>:
189               </para>
190               <para><screen>[root@oss1 ~]# mount |grep lustre
191 /dev/sda on /mnt/ost0 type lustre (ro)
192 /dev/sdb on /mnt/ost1 type lustre (ro)
193 /dev/sdc on /mnt/ost2 type lustre (ro)
194
195 [root@oss1 ~]# umount -a -t lustre
196 [155336.491445] Lustre: Failing over testfs-OST0002
197 [155336.556752] Lustre: server umount testfs-OST0002 complete</screen></para>
198           </listitem>
199       </orderedlist>
200       <para>For unmount command syntax for a single OST, MDT, or MGT target
201       please refer to <xref linkend="dbdoclet.umountTarget"/></para>
202   </section>
203   <section xml:id="dbdoclet.umountTarget">
204     <title>
205     <indexterm>
206       <primary>operations</primary>
207       <secondary>unmounting</secondary>
208     </indexterm>Unmounting a Specific Target on a Server</title>
209     <para>To stop a Lustre OST, MDT, or MGT , use the
210     <literal>umount 
211     <replaceable>/mount_point</replaceable></literal> command.</para>
212     <para>The example below stops an OST, <literal>ost0</literal>, on mount
213     point <literal>/mnt/ost0</literal> for the <literal>testfs</literal>
214     filesystem:</para>
215     <screen>[root@oss1 ~]# umount /mnt/ost0
216 [  385.142264] Lustre: Failing over testfs-OST0000
217 [  385.210810] Lustre: server umount testfs-OST0000 complete</screen>
218     <para>Gracefully stopping a server with the 
219     <literal>umount</literal> command preserves the state of the connected
220     clients. The next time the server is started, it waits for clients to
221     reconnect, and then goes through the recovery procedure.</para>
222     <para>If the force (
223     <literal>-f</literal>) flag is used, then the server evicts all clients and
224     stops WITHOUT recovery. Upon restart, the server does not wait for
225     recovery. Any currently connected clients receive I/O errors until they
226     reconnect.</para>
227     <note>
228       <para>If you are using loopback devices, use the 
229       <literal>-d</literal> flag. This flag cleans up loop devices and can
230       always be safely specified.</para>
231     </note>
232   </section>
233   <section xml:id="dbdoclet.50438194_57420">
234     <title>
235     <indexterm>
236       <primary>operations</primary>
237       <secondary>failover</secondary>
238     </indexterm>Specifying Failout/Failover Mode for OSTs</title>
239     <para>In a Lustre file system, an OST that has become unreachable because
240     it fails, is taken off the network, or is unmounted can be handled in one
241     of two ways:</para>
242     <itemizedlist>
243       <listitem>
244         <para>In 
245         <literal>failout</literal> mode, Lustre clients immediately receive
246         errors (EIOs) after a timeout, instead of waiting for the OST to
247         recover.</para>
248       </listitem>
249       <listitem>
250         <para>In 
251         <literal>failover</literal> mode, Lustre clients wait for the OST to
252         recover.</para>
253       </listitem>
254     </itemizedlist>
255     <para>By default, the Lustre file system uses 
256     <literal>failover</literal> mode for OSTs. To specify 
257     <literal>failout</literal> mode instead, use the 
258     <literal>--param="failover.mode=failout"</literal> option as shown below
259     (entered on one line):</para>
260     <screen>
261 oss# mkfs.lustre --fsname=
262 <replaceable>fsname</replaceable> --mgsnode=
263 <replaceable>mgs_NID</replaceable> --param=failover.mode=failout 
264       --ost --index=
265 <replaceable>ost_index</replaceable> 
266 <replaceable>/dev/ost_block_device</replaceable>
267 </screen>
268     <para>In the example below, 
269     <literal>failout</literal> mode is specified for the OSTs on the MGS 
270     <literal>mds0</literal> in the file system 
271     <literal>testfs</literal>(entered on one line).</para>
272     <screen>
273 oss# mkfs.lustre --fsname=testfs --mgsnode=mds0 --param=failover.mode=failout 
274       --ost --index=3 /dev/sdb 
275 </screen>
276     <caution>
277       <para>Before running this command, unmount all OSTs that will be affected
278       by a change in 
279       <literal>failover</literal>/ 
280       <literal>failout</literal> mode.</para>
281     </caution>
282     <note>
283       <para>After initial file system configuration, use the 
284       <literal>tunefs.lustre</literal> utility to change the mode. For example,
285       to set the 
286       <literal>failout</literal> mode, run:</para>
287       <para>
288         <screen>
289 $ tunefs.lustre --param failover.mode=failout 
290 <replaceable>/dev/ost_device</replaceable>
291 </screen>
292       </para>
293     </note>
294   </section>
295   <section xml:id="dbdoclet.degraded_ost">
296     <title>
297     <indexterm>
298       <primary>operations</primary>
299       <secondary>degraded OST RAID</secondary>
300     </indexterm>Handling Degraded OST RAID Arrays</title>
301     <para>Lustre includes functionality that notifies Lustre if an external
302     RAID array has degraded performance (resulting in reduced overall file
303     system performance), either because a disk has failed and not been
304     replaced, or because a disk was replaced and is undergoing a rebuild. To
305     avoid a global performance slowdown due to a degraded OST, the MDS can
306     avoid the OST for new object allocation if it is notified of the degraded
307     state.</para>
308     <para>A parameter for each OST, called 
309     <literal>degraded</literal>, specifies whether the OST is running in
310     degraded mode or not.</para>
311     <para>To mark the OST as degraded, use:</para>
312     <screen>
313 lctl set_param obdfilter.{OST_name}.degraded=1
314 </screen>
315     <para>To mark that the OST is back in normal operation, use:</para>
316     <screen>
317 lctl set_param obdfilter.{OST_name}.degraded=0
318 </screen>
319     <para>To determine if OSTs are currently in degraded mode, use:</para>
320     <screen>
321 lctl get_param obdfilter.*.degraded
322 </screen>
323     <para>If the OST is remounted due to a reboot or other condition, the flag
324     resets to 
325     <literal>0</literal>.</para>
326     <para>It is recommended that this be implemented by an automated script
327     that monitors the status of individual RAID devices, such as MD-RAID's
328     <literal>mdadm(8)</literal> command with the <literal>--monitor</literal>
329     option to mark an affected device degraded or restored.</para>
330   </section>
331   <section xml:id="dbdoclet.50438194_88063">
332     <title>
333     <indexterm>
334       <primary>operations</primary>
335       <secondary>multiple file systems</secondary>
336     </indexterm>Running Multiple Lustre File Systems</title>
337     <para>Lustre supports multiple file systems provided the combination of 
338     <literal>NID:fsname</literal> is unique. Each file system must be allocated
339     a unique name during creation with the 
340     <literal>--fsname</literal> parameter. Unique names for file systems are
341     enforced if a single MGS is present. If multiple MGSs are present (for
342     example if you have an MGS on every MDS) the administrator is responsible
343     for ensuring file system names are unique. A single MGS and unique file
344     system names provides a single point of administration and allows commands
345     to be issued against the file system even if it is not mounted.</para>
346     <para>Lustre supports multiple file systems on a single MGS. With a single
347     MGS fsnames are guaranteed to be unique. Lustre also allows multiple MGSs
348     to co-exist. For example, multiple MGSs will be necessary if multiple file
349     systems on different Lustre software versions are to be concurrently
350     available. With multiple MGSs additional care must be taken to ensure file
351     system names are unique. Each file system should have a unique fsname among
352     all systems that may interoperate in the future.</para>
353     <para>By default, the 
354     <literal>mkfs.lustre</literal> command creates a file system named 
355     <literal>lustre</literal>. To specify a different file system name (limited
356     to 8 characters) at format time, use the 
357     <literal>--fsname</literal> option:</para>
358     <para>
359       <screen>
360 mkfs.lustre --fsname=
361 <replaceable>file_system_name</replaceable>
362 </screen>
363     </para>
364     <note>
365       <para>The MDT, OSTs and clients in the new file system must use the same
366       file system name (prepended to the device name). For example, for a new
367       file system named 
368       <literal>foo</literal>, the MDT and two OSTs would be named 
369       <literal>foo-MDT0000</literal>, 
370       <literal>foo-OST0000</literal>, and 
371       <literal>foo-OST0001</literal>.</para>
372     </note>
373     <para>To mount a client on the file system, run:</para>
374     <screen>
375 client# mount -t lustre 
376 <replaceable>mgsnode</replaceable>:
377 <replaceable>/new_fsname</replaceable> 
378 <replaceable>/mount_point</replaceable>
379 </screen>
380     <para>For example, to mount a client on file system foo at mount point
381     /mnt/foo, run:</para>
382     <screen>
383 client# mount -t lustre mgsnode:/foo /mnt/foo
384 </screen>
385     <note>
386       <para>If a client(s) will be mounted on several file systems, add the
387       following line to 
388       <literal>/etc/xattr.conf</literal> file to avoid problems when files are
389       moved between the file systems: 
390       <literal>lustre.* skip</literal></para>
391     </note>
392     <note>
393       <para>To ensure that a new MDT is added to an existing MGS create the MDT
394       by specifying: 
395       <literal>--mdt --mgsnode=
396       <replaceable>mgs_NID</replaceable></literal>.</para>
397     </note>
398     <para>A Lustre installation with two file systems (
399     <literal>foo</literal> and 
400     <literal>bar</literal>) could look like this, where the MGS node is 
401     <literal>mgsnode@tcp0</literal> and the mount points are 
402     <literal>/mnt/foo</literal> and 
403     <literal>/mnt/bar</literal>.</para>
404     <screen>
405 mgsnode# mkfs.lustre --mgs /dev/sda
406 mdtfoonode# mkfs.lustre --fsname=foo --mgsnode=mgsnode@tcp0 --mdt --index=0
407 /dev/sdb
408 ossfoonode# mkfs.lustre --fsname=foo --mgsnode=mgsnode@tcp0 --ost --index=0
409 /dev/sda
410 ossfoonode# mkfs.lustre --fsname=foo --mgsnode=mgsnode@tcp0 --ost --index=1
411 /dev/sdb
412 mdtbarnode# mkfs.lustre --fsname=bar --mgsnode=mgsnode@tcp0 --mdt --index=0
413 /dev/sda
414 ossbarnode# mkfs.lustre --fsname=bar --mgsnode=mgsnode@tcp0 --ost --index=0
415 /dev/sdc
416 ossbarnode# mkfs.lustre --fsname=bar --mgsnode=mgsnode@tcp0 --ost --index=1
417 /dev/sdd
418 </screen>
419     <para>To mount a client on file system foo at mount point 
420     <literal>/mnt/foo</literal>, run:</para>
421     <screen>
422 client# mount -t lustre mgsnode@tcp0:/foo /mnt/foo
423 </screen>
424     <para>To mount a client on file system bar at mount point 
425     <literal>/mnt/bar</literal>, run:</para>
426     <screen>
427 client# mount -t lustre mgsnode@tcp0:/bar /mnt/bar
428 </screen>
429   </section>
430   <section xml:id="dbdoclet.lfsmkdir" condition='l24'>
431     <title>
432     <indexterm>
433       <primary>operations</primary>
434       <secondary>remote directory</secondary>
435     </indexterm>Creating a sub-directory on a given MDT</title>
436     <para>Lustre 2.4 enables individual sub-directories to be serviced by
437     unique MDTs. An administrator can allocate a sub-directory to a given MDT
438     using the command:</para>
439     <screen>
440 client# lfs mkdir â€“i
441 <replaceable>mdt_index</replaceable>
442 <replaceable>/mount_point/remote_dir</replaceable>
443 </screen>
444     <para>This command will allocate the sub-directory
445     <literal>remote_dir</literal> onto the MDT of index
446     <literal>mdt_index</literal>. For more information on adding additional MDTs
447     and 
448     <literal>mdt_index</literal> see
449     <xref linkend='dbdoclet.addmdtindex' />.</para>
450     <warning>
451       <para>An administrator can allocate remote sub-directories to separate
452       MDTs. Creating remote sub-directories in parent directories not hosted on
453       MDT0 is not recommended. This is because the failure of the parent MDT
454       will leave the namespace below it inaccessible. For this reason, by
455       default it is only possible to create remote sub-directories off MDT0. To
456       relax this restriction and enable remote sub-directories off any MDT, an
457       administrator must issue the following command on the MGS:
458       <screen>mgs# lctl conf_param <replaceable>fsname</replaceable>.mdt.enable_remote_dir=1</screen>
459       For Lustre filesystem 'scratch', the command executed is:
460       <screen>mgs# lctl conf_param scratch.mdt.enable_remote_dir=1</screen>
461       To verify the configuration setting execute the following command on any
462       MDS:
463           <screen>mds# lctl get_param mdt.*.enable_remote_dir</screen></para>
464     </warning>
465     <para condition='l28'>With Lustre software version 2.8, a new
466     tunable is available to allow users with a specific group ID to create
467     and delete remote and striped directories. This tunable is
468     <literal>enable_remote_dir_gid</literal>. For example, setting this
469     parameter to the 'wheel' or 'admin' group ID allows users with that GID
470     to create and delete remote and striped directories. Setting this
471     parameter to <literal>-1</literal> on MDT0 to permanently allow any
472     non-root users create and delete remote and striped directories.
473     On the MGS execute the following command:
474     <screen>mgs# lctl conf_param <replaceable>fsname</replaceable>.mdt.enable_remote_dir_gid=-1</screen>
475     For the Lustre filesystem 'scratch', the commands expands to:
476     <screen>mgs# lctl conf_param scratch.mdt.enable_remote_dir_gid=-1</screen>.
477     The change can be verified by executing the following command on every MDS:
478     <screen>mds# lctl get_param mdt.<replaceable>*</replaceable>.enable_remote_dir_gid</screen>
479     </para>
480   </section>
481   <section xml:id="dbdoclet.lfsmkdirdne2" condition='l28'>
482     <title>
483     <indexterm>
484       <primary>operations</primary>
485       <secondary>striped directory</secondary>
486     </indexterm>
487     <indexterm>
488       <primary>operations</primary>
489       <secondary>mkdir</secondary>
490     </indexterm>
491     <indexterm>
492       <primary>operations</primary>
493       <secondary>setdirstripe</secondary>
494     </indexterm>
495     <indexterm>
496       <primary>striping</primary>
497       <secondary>metadata</secondary>
498     </indexterm>Creating a directory striped across multiple MDTs</title>
499     <para>The Lustre 2.8 DNE feature enables individual files in a given
500     directory to store their metadata on separate MDTs (a <emphasis>striped
501     directory</emphasis>) once additional MDTs have been added to the
502     filesystem, see <xref linkend="dbdoclet.adding_new_mdt"/>.
503     The result of this is that metadata requests for
504     files in a striped directory are serviced by multiple MDTs and metadata
505     service load is distributed over all the MDTs that service a given
506     directory. By distributing metadata service load over multiple MDTs,
507     performance can be improved beyond the limit of single MDT
508     performance. Prior to the development of this feature all files in a
509     directory must record their metadata on a single MDT.</para>
510     <para>This command to stripe a directory over
511     <replaceable>mdt_count</replaceable> MDTs is:
512     </para>
513     <screen>
514 client# lfs mkdir -c
515 <replaceable>mdt_count</replaceable>
516 <replaceable>/mount_point/new_directory</replaceable>
517 </screen>
518     <para>The striped directory feature is most useful for distributing
519     single large directories (50k entries or more) across multiple MDTs,
520     since it incurs more overhead than non-striped directories.</para>
521   </section>
522   <section xml:id="dbdoclet.50438194_88980">
523     <title>
524     <indexterm>
525       <primary>operations</primary>
526       <secondary>parameters</secondary>
527     </indexterm>Setting and Retrieving Lustre Parameters</title>
528     <para>Several options are available for setting parameters in
529     Lustre:</para>
530     <itemizedlist>
531       <listitem>
532         <para>When creating a file system, use mkfs.lustre. See 
533         <xref linkend="dbdoclet.50438194_17237" />below.</para>
534       </listitem>
535       <listitem>
536         <para>When a server is stopped, use tunefs.lustre. See 
537         <xref linkend="dbdoclet.50438194_55253" />below.</para>
538       </listitem>
539       <listitem>
540         <para>When the file system is running, use lctl to set or retrieve
541         Lustre parameters. See 
542         <xref linkend="dbdoclet.50438194_51490" />and 
543         <xref linkend="dbdoclet.50438194_63247" />below.</para>
544       </listitem>
545     </itemizedlist>
546     <section xml:id="dbdoclet.50438194_17237">
547       <title>Setting Tunable Parameters with 
548       <literal>mkfs.lustre</literal></title>
549       <para>When the file system is first formatted, parameters can simply be
550       added as a 
551       <literal>--param</literal> option to the 
552       <literal>mkfs.lustre</literal> command. For example:</para>
553       <screen>
554 mds# mkfs.lustre --mdt --param="sys.timeout=50" /dev/sda
555 </screen>
556       <para>For more details about creating a file system,see 
557       <xref linkend="configuringlustre" />. For more details about 
558       <literal>mkfs.lustre</literal>, see 
559       <xref linkend="systemconfigurationutilities" />.</para>
560     </section>
561     <section xml:id="dbdoclet.50438194_55253">
562       <title>Setting Parameters with 
563       <literal>tunefs.lustre</literal></title>
564       <para>If a server (OSS or MDS) is stopped, parameters can be added to an
565       existing file system using the 
566       <literal>--param</literal> option to the 
567       <literal>tunefs.lustre</literal> command. For example:</para>
568       <screen>
569 oss# tunefs.lustre --param=failover.node=192.168.0.13@tcp0 /dev/sda
570 </screen>
571       <para>With 
572       <literal>tunefs.lustre</literal>, parameters are 
573       <emphasis>additive</emphasis>-- new parameters are specified in addition
574       to old parameters, they do not replace them. To erase all old 
575       <literal>tunefs.lustre</literal> parameters and just use newly-specified
576       parameters, run:</para>
577       <screen>
578 mds# tunefs.lustre --erase-params --param=
579 <replaceable>new_parameters</replaceable> 
580 </screen>
581       <para>The tunefs.lustre command can be used to set any parameter settable
582       via <literal>lctl conf_param</literal> and that has its own OBD device,
583       so it can be specified as 
584       <literal>
585       <replaceable>obdname|fsname</replaceable>.
586       <replaceable>obdtype</replaceable>.
587       <replaceable>proc_file_name</replaceable>=
588       <replaceable>value</replaceable></literal>. For example:</para>
589       <screen>
590 mds# tunefs.lustre --param mdt.identity_upcall=NONE /dev/sda1
591 </screen>
592       <para>For more details about 
593       <literal>tunefs.lustre</literal>, see 
594       <xref linkend="systemconfigurationutilities" />.</para>
595     </section>
596     <section xml:id="dbdoclet.50438194_51490">
597       <title>Setting Parameters with 
598       <literal>lctl</literal></title>
599       <para>When the file system is running, the 
600       <literal>lctl</literal> command can be used to set parameters (temporary
601       or permanent) and report current parameter values. Temporary parameters
602       are active as long as the server or client is not shut down. Permanent
603       parameters live through server and client reboots.</para>
604       <note>
605         <para>The <literal>lctl list_param</literal> command enables users to
606           list all parameters that can be set. See 
607         <xref linkend="dbdoclet.50438194_88217" />.</para>
608       </note>
609       <para>For more details about the 
610       <literal>lctl</literal> command, see the examples in the sections below
611       and 
612       <xref linkend="systemconfigurationutilities" />.</para>
613       <section remap="h4">
614         <title>Setting Temporary Parameters</title>
615         <para>Use 
616         <literal>lctl set_param</literal> to set temporary parameters on the
617         node where it is run. These parameters map to items in 
618         <literal>/proc/{fs,sys}/{lnet,lustre}</literal>. The 
619         <literal>lctl set_param</literal> command uses this syntax:</para>
620         <screen>
621 lctl set_param [-n] [-P]
622 <replaceable>obdtype</replaceable>.
623 <replaceable>obdname</replaceable>.
624 <replaceable>proc_file_name</replaceable>=
625 <replaceable>value</replaceable>
626 </screen>
627         <para>For example:</para>
628         <screen>
629 # lctl set_param osc.*.max_dirty_mb=1024
630 osc.myth-OST0000-osc.max_dirty_mb=32
631 osc.myth-OST0001-osc.max_dirty_mb=32
632 osc.myth-OST0002-osc.max_dirty_mb=32
633 osc.myth-OST0003-osc.max_dirty_mb=32
634 osc.myth-OST0004-osc.max_dirty_mb=32
635 </screen>
636       </section>
637       <section xml:id="dbdoclet.50438194_64195">
638         <title>Setting Permanent Parameters</title>
639         <para>Use <literal>lctl set_param -P</literal> or
640         <literal>lctl conf_param</literal> command to set permanent parameters.
641         In general, the 
642         <literal>lctl conf_param</literal> command can be used to specify any
643         parameter settable in a 
644         <literal>/proc/fs/lustre</literal> file, with its own OBD device. The 
645         <literal>lctl conf_param</literal> command uses this syntax (same as the
646         
647         <literal>mkfs.lustre</literal> and 
648         <literal>tunefs.lustre</literal> commands):</para>
649         <screen>
650 <replaceable>obdname|fsname</replaceable>.
651 <replaceable>obdtype</replaceable>.
652 <replaceable>proc_file_name</replaceable>=
653 <replaceable>value</replaceable>) 
654 </screen>
655         <para>Here are a few examples of 
656         <literal>lctl conf_param</literal> commands:</para>
657         <screen>
658 mgs# lctl conf_param testfs-MDT0000.sys.timeout=40
659 $ lctl conf_param testfs-MDT0000.mdt.identity_upcall=NONE
660 $ lctl conf_param testfs.llite.max_read_ahead_mb=16
661 $ lctl conf_param testfs-MDT0000.lov.stripesize=2M
662 $ lctl conf_param testfs-OST0000.osc.max_dirty_mb=29.15
663 $ lctl conf_param testfs-OST0000.ost.client_cache_seconds=15
664 $ lctl conf_param testfs.sys.timeout=40 
665 </screen>
666         <caution>
667           <para>Parameters specified with the 
668           <literal>lctl conf_param</literal> command are set permanently in the
669           file system's configuration file on the MGS.</para>
670         </caution>
671       </section>
672       <section xml:id="dbdoclet.setparamp" condition='l25'>
673         <title>Setting Permanent Parameters with lctl set_param -P</title>
674         <para>The <literal>lctl set_param -P</literal> command can also
675           set parameters permanently. This command must be issued on the MGS.
676           The given parameter is set on every host using 
677           <literal>lctl</literal> upcall. Parameters map to items in 
678           <literal>/proc/{fs,sys}/{lnet,lustre}</literal>. The 
679           <literal>lctl set_param</literal> command uses this syntax:</para>
680         <screen>
681 lctl set_param -P 
682 <replaceable>obdtype</replaceable>.
683 <replaceable>obdname</replaceable>.
684 <replaceable>proc_file_name</replaceable>=
685 <replaceable>value</replaceable>
686 </screen>
687         <para>For example:</para>
688         <screen>
689 # lctl set_param -P osc.*.max_dirty_mb=1024
690 osc.myth-OST0000-osc.max_dirty_mb=32
691 osc.myth-OST0001-osc.max_dirty_mb=32
692 osc.myth-OST0002-osc.max_dirty_mb=32
693 osc.myth-OST0003-osc.max_dirty_mb=32
694 osc.myth-OST0004-osc.max_dirty_mb=32 
695 </screen>
696         <para>Use 
697         <literal>-d</literal>(only with -P) option to delete permanent
698         parameter. Syntax:</para>
699         <screen>
700 lctl set_param -P -d
701 <replaceable>obdtype</replaceable>.
702 <replaceable>obdname</replaceable>.
703 <replaceable>proc_file_name</replaceable>
704 </screen>
705         <para>For example:</para>
706         <screen>
707 # lctl set_param -P -d osc.*.max_dirty_mb 
708 </screen>
709       </section>
710       <section xml:id="dbdoclet.50438194_88217">
711         <title>Listing Parameters</title>
712         <para>To list Lustre or LNet parameters that are available to set, use
713         the 
714         <literal>lctl list_param</literal> command. For example:</para>
715         <screen>
716 lctl list_param [-FR] 
717 <replaceable>obdtype</replaceable>.
718 <replaceable>obdname</replaceable>
719 </screen>
720         <para>The following arguments are available for the 
721         <literal>lctl list_param</literal> command.</para>
722         <para>
723         <literal>-F</literal> Add '
724         <literal>/</literal>', '
725         <literal>@</literal>' or '
726         <literal>=</literal>' for directories, symlinks and writeable files,
727         respectively</para>
728         <para>
729         <literal>-R</literal> Recursively lists all parameters under the
730         specified path</para>
731         <para>For example:</para>
732         <screen>
733 oss# lctl list_param obdfilter.lustre-OST0000 
734 </screen>
735       </section>
736       <section xml:id="dbdoclet.50438194_63247">
737         <title>Reporting Current Parameter Values</title>
738         <para>To report current Lustre parameter values, use the 
739         <literal>lctl get_param</literal> command with this syntax:</para>
740         <screen>
741 lctl get_param [-n] 
742 <replaceable>obdtype</replaceable>.
743 <replaceable>obdname</replaceable>.
744 <replaceable>proc_file_name</replaceable>
745 </screen>
746         <para>This example reports data on RPC service times.</para>
747         <screen>
748 oss# lctl get_param -n ost.*.ost_io.timeouts
749 service : cur 1 worst 30 (at 1257150393, 85d23h58m54s ago) 1 1 1 1 
750 </screen>
751         <para>This example reports the amount of space this client has reserved
752         for writeback cache with each OST:</para>
753         <screen>
754 client# lctl get_param osc.*.cur_grant_bytes
755 osc.myth-OST0000-osc-ffff8800376bdc00.cur_grant_bytes=2097152
756 osc.myth-OST0001-osc-ffff8800376bdc00.cur_grant_bytes=33890304
757 osc.myth-OST0002-osc-ffff8800376bdc00.cur_grant_bytes=35418112
758 osc.myth-OST0003-osc-ffff8800376bdc00.cur_grant_bytes=2097152
759 osc.myth-OST0004-osc-ffff8800376bdc00.cur_grant_bytes=33808384
760 </screen>
761       </section>
762     </section>
763   </section>
764   <section xml:id="dbdoclet.50438194_41817">
765     <title>
766     <indexterm>
767       <primary>operations</primary>
768       <secondary>failover</secondary>
769     </indexterm>Specifying NIDs and Failover</title>
770     <para>If a node has multiple network interfaces, it may have multiple NIDs,
771     which must all be identified so other nodes can choose the NID that is
772     appropriate for their network interfaces. Typically, NIDs are specified in
773     a list delimited by commas (
774     <literal>,</literal>). However, when failover nodes are specified, the NIDs
775     are delimited by a colon (
776     <literal>:</literal>) or by repeating a keyword such as 
777     <literal>--mgsnode=</literal> or 
778     <literal>--servicenode=</literal>).</para>
779     <para>To display the NIDs of all servers in networks configured to work
780     with the Lustre file system, run (while LNet is running):</para>
781     <screen>
782 lctl list_nids
783 </screen>
784     <para>In the example below, 
785     <literal>mds0</literal> and 
786     <literal>mds1</literal> are configured as a combined MGS/MDT failover pair
787     and 
788     <literal>oss0</literal> and 
789     <literal>oss1</literal> are configured as an OST failover pair. The Ethernet
790     address for 
791     <literal>mds0</literal> is 192.168.10.1, and for 
792     <literal>mds1</literal> is 192.168.10.2. The Ethernet addresses for 
793     <literal>oss0</literal> and 
794     <literal>oss1</literal> are 192.168.10.20 and 192.168.10.21
795     respectively.</para>
796     <screen>
797 mds0# mkfs.lustre --fsname=testfs --mdt --mgs \
798         --servicenode=192.168.10.2@tcp0 \
799         -–servicenode=192.168.10.1@tcp0 /dev/sda1
800 mds0# mount -t lustre /dev/sda1 /mnt/test/mdt
801 oss0# mkfs.lustre --fsname=testfs --servicenode=192.168.10.20@tcp0 \
802         --servicenode=192.168.10.21 --ost --index=0 \
803         --mgsnode=192.168.10.1@tcp0 --mgsnode=192.168.10.2@tcp0 \
804         /dev/sdb
805 oss0# mount -t lustre /dev/sdb /mnt/test/ost0
806 client# mount -t lustre 192.168.10.1@tcp0:192.168.10.2@tcp0:/testfs \
807         /mnt/testfs
808 mds0# umount /mnt/mdt
809 mds1# mount -t lustre /dev/sda1 /mnt/test/mdt
810 mds1# lctl get_param mdt.testfs-MDT0000.recovery_status
811 </screen>
812     <para>Where multiple NIDs are specified separated by commas (for example, 
813     <literal>10.67.73.200@tcp,192.168.10.1@tcp</literal>), the two NIDs refer
814     to the same host, and the Lustre software chooses the 
815     <emphasis>best</emphasis> one for communication. When a pair of NIDs is
816     separated by a colon (for example, 
817     <literal>10.67.73.200@tcp:10.67.73.201@tcp</literal>), the two NIDs refer
818     to two different hosts and are treated as a failover pair (the Lustre
819     software tries the first one, and if that fails, it tries the second
820     one.)</para>
821     <para>Two options to 
822     <literal>mkfs.lustre</literal> can be used to specify failover nodes.
823     Introduced in Lustre software release 2.0, the 
824     <literal>--servicenode</literal> option is used to specify all service NIDs,
825     including those for primary nodes and failover nodes. When the 
826     <literal>--servicenode</literal> option is used, the first service node to
827     load the target device becomes the primary service node, while nodes
828     corresponding to the other specified NIDs become failover locations for the
829     target device. An older option, 
830     <literal>--failnode</literal>, specifies just the NIDS of failover nodes.
831     For more information about the 
832     <literal>--servicenode</literal> and 
833     <literal>--failnode</literal> options, see 
834     <xref xmlns:xlink="http://www.w3.org/1999/xlink"
835     linkend="configuringfailover" />.</para>
836   </section>
837   <section xml:id="dbdoclet.50438194_70905">
838     <title>
839     <indexterm>
840       <primary>operations</primary>
841       <secondary>erasing a file system</secondary>
842     </indexterm>Erasing a File System</title>
843     <para>If you want to erase a file system and permanently delete all the
844     data in the file system, run this command on your targets:</para>
845     <screen>
846 $ "mkfs.lustre --reformat"
847 </screen>
848     <para>If you are using a separate MGS and want to keep other file systems
849     defined on that MGS, then set the 
850     <literal>writeconf</literal> flag on the MDT for that file system. The 
851     <literal>writeconf</literal> flag causes the configuration logs to be
852     erased; they are regenerated the next time the servers start.</para>
853     <para>To set the 
854     <literal>writeconf</literal> flag on the MDT:</para>
855     <orderedlist>
856       <listitem>
857         <para>Unmount all clients/servers using this file system, run:</para>
858         <screen>
859 $ umount /mnt/lustre
860 </screen>
861       </listitem>
862       <listitem>
863         <para>Permanently erase the file system and, presumably, replace it
864         with another file system, run:</para>
865         <screen>
866 $ mkfs.lustre --reformat --fsname spfs --mgs --mdt --index=0 /dev/
867 <emphasis>{mdsdev}</emphasis>
868 </screen>
869       </listitem>
870       <listitem>
871         <para>If you have a separate MGS (that you do not want to reformat),
872         then add the 
873         <literal>--writeconf</literal> flag to 
874         <literal>mkfs.lustre</literal> on the MDT, run:</para>
875         <screen>
876 $ mkfs.lustre --reformat --writeconf --fsname spfs --mgsnode=
877 <replaceable>mgs_nid</replaceable> --mdt --index=0 
878 <replaceable>/dev/mds_device</replaceable>
879 </screen>
880       </listitem>
881     </orderedlist>
882     <note>
883       <para>If you have a combined MGS/MDT, reformatting the MDT reformats the
884       MGS as well, causing all configuration information to be lost; you can
885       start building your new file system. Nothing needs to be done with old
886       disks that will not be part of the new file system, just do not mount
887       them.</para>
888     </note>
889   </section>
890   <section xml:id="dbdoclet.50438194_16954">
891     <title>
892     <indexterm>
893       <primary>operations</primary>
894       <secondary>reclaiming space</secondary>
895     </indexterm>Reclaiming Reserved Disk Space</title>
896     <para>All current Lustre installations run the ldiskfs file system
897     internally on service nodes. By default, ldiskfs reserves 5% of the disk
898     space to avoid file system fragmentation. In order to reclaim this space,
899     run the following command on your OSS for each OST in the file
900     system:</para>
901     <screen>
902 tune2fs [-m reserved_blocks_percent] /dev/
903 <emphasis>{ostdev}</emphasis>
904 </screen>
905     <para>You do not need to shut down Lustre before running this command or
906     restart it afterwards.</para>
907     <warning>
908       <para>Reducing the space reservation can cause severe performance
909       degradation as the OST file system becomes more than 95% full, due to
910       difficulty in locating large areas of contiguous free space. This
911       performance degradation may persist even if the space usage drops below
912       95% again. It is recommended NOT to reduce the reserved disk space below
913       5%.</para>
914     </warning>
915   </section>
916   <section xml:id="dbdoclet.50438194_69998">
917     <title>
918     <indexterm>
919       <primary>operations</primary>
920       <secondary>replacing an OST or MDS</secondary>
921     </indexterm>Replacing an Existing OST or MDT</title>
922     <para>To copy the contents of an existing OST to a new OST (or an old MDT
923     to a new MDT), follow the process for either OST/MDT backups in 
924     <xref linkend='dbdoclet.backup_device' />or 
925     <xref linkend='backup_fs_level' />.
926     For more information on removing a MDT, see 
927     <xref linkend='dbdoclet.rmremotedir' />.</para>
928   </section>
929   <section xml:id="dbdoclet.50438194_30872">
930     <title>
931     <indexterm>
932       <primary>operations</primary>
933       <secondary>identifying OSTs</secondary>
934     </indexterm>Identifying To Which Lustre File an OST Object Belongs</title>
935     <para>Use this procedure to identify the file containing a given object on
936     a given OST.</para>
937     <orderedlist>
938       <listitem>
939         <para>On the OST (as root), run 
940         <literal>debugfs</literal> to display the file identifier (
941         <literal>FID</literal>) of the file associated with the object.</para>
942         <para>For example, if the object is 
943         <literal>34976</literal> on 
944         <literal>/dev/lustre/ost_test2</literal>, the debug command is: 
945         <screen>
946 # debugfs -c -R "stat /O/0/d$((34976 % 32))/34976" /dev/lustre/ost_test2 
947 </screen></para>
948         <para>The command output is: 
949         <screen>
950 debugfs 1.42.3.wc3 (15-Aug-2012)
951 /dev/lustre/ost_test2: catastrophic mode - not reading inode or group bitmaps
952 Inode: 352365   Type: regular    Mode:  0666   Flags: 0x80000
953 Generation: 2393149953    Version: 0x0000002a:00005f81
954 User:  1000   Group:  1000   Size: 260096
955 File ACL: 0    Directory ACL: 0
956 Links: 1   Blockcount: 512
957 Fragment:  Address: 0    Number: 0    Size: 0
958 ctime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009
959 atime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009
960 mtime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009
961 crtime: 0x4a216b3c:975870dc -- Sat May 30 13:22:04 2009
962 Size of extra inode fields: 24
963 Extended attributes stored in inode body:
964   fid = "b9 da 24 00 00 00 00 00 6a fa 0d 3f 01 00 00 00 eb 5b 0b 00 00 00 0000
965 00 00 00 00 00 00 00 00 " (32)
966   fid: objid=34976 seq=0 parent=[0x24dab9:0x3f0dfa6a:0x0] stripe=1
967 EXTENTS:
968 (0-64):4620544-4620607
969 </screen></para>
970       </listitem>
971       <listitem>
972         <para>For Lustre software release 2.x file systems, the parent FID will
973         be of the form [0x200000400:0x122:0x0] and can be resolved directly
974         using the 
975         <literal>lfs fid2path [0x200000404:0x122:0x0]
976         /mnt/lustre</literal> command on any Lustre client, and the process is
977         complete.</para>
978       </listitem>
979       <listitem>
980         <para>In this example the parent inode FID is an upgraded 1.x inode
981         (due to the first part of the FID being below 0x200000400), the MDT
982         inode number is 
983         <literal>0x24dab9</literal> and generation 
984         <literal>0x3f0dfa6a</literal> and the pathname needs to be resolved
985         using 
986         <literal>debugfs</literal>.</para>
987       </listitem>
988       <listitem>
989         <para>On the MDS (as root), use 
990         <literal>debugfs</literal> to find the file associated with the
991         inode:</para>
992         <screen>
993 # debugfs -c -R "ncheck 0x24dab9" /dev/lustre/mdt_test 
994 </screen>
995         <para>Here is the command output:</para>
996         <screen>
997 debugfs 1.42.3.wc2 (15-Aug-2012)
998 /dev/lustre/mdt_test: catastrophic mode - not reading inode or group bitmap\
999 s
1000 Inode      Pathname
1001 2415289    /ROOT/brian-laptop-guest/clients/client11/~dmtmp/PWRPNT/ZD16.BMP
1002 </screen>
1003       </listitem>
1004     </orderedlist>
1005     <para>The command lists the inode and pathname associated with the
1006     object.</para>
1007     <note>
1008       <para>
1009       <literal>Debugfs</literal>' ''ncheck'' is a brute-force search that may
1010       take a long time to complete.</para>
1011     </note>
1012     <note>
1013       <para>To find the Lustre file from a disk LBA, follow the steps listed in
1014       the document at this URL: 
1015       <link xl:href="http://smartmontools.sourceforge.net/badblockhowto.html">
1016       http://smartmontools.sourceforge.net/badblockhowto.html</link>. Then,
1017       follow the steps above to resolve the Lustre filename.</para>
1018     </note>
1019   </section>
1020 </chapter>