Whamcloud - gitweb
LU-15707 lod: force creation of a component without a pool
[fs/lustre-release.git] / lustre / doc / lfs-setstripe.1
1 .TH LFS-SETSTRIPE 1 2017-08-23 "Lustre" "Lustre Utilities"
2 .SH NAME
3 lfs setstripe \- set striping pattern of a file or directory default
4 .SH SYNOPSIS
5 .B lfs setstripe \fR[\fISTRIPE_OPTIONS\fR] <\fIdirectory\fR|\fIfile\fR>
6 .br
7 .B lfs setstripe -E \fIend1\fR [\fISTRIPE_OPTIONS\fR] ... \
8 <\fIdirectory\fR|\fIfile\fR>
9 .br
10 .B lfs setstripe --comp-add -E \fIend1\fR [\fISTRIPE_OPTIONS\fR] ... \
11 <\fIfile\fR>
12 .br
13 .B lfs setstripe --comp-del \fR{\fB-I \fIcomp_id\fR|\
14 \fB--comp-flags=\fIcomp_flags\fR} <\fIfile\fR>
15 .br
16 .B lfs setstripe --comp-set \fR{-I \fIcomp_id\fR|\
17 \fB--comp-flags=\fIcomp_flags\fR} <\fIfile\fR>
18 .br
19 .B lfs setstripe -N\fR[\fImirror_count\fR] \fR[\fISTRIPE_OPTIONS\fR] <\fIdirectory\fR|\fIfilename\fR>
20 .br
21 .B lfs setstripe -d \fR<\fIdirectory\fR>
22 .br
23 .B lfs setstripe --yaml=\fR<\fIyaml_template_file.lyl\fR> <\fIfile\fR>
24 .br
25 .B lfs setstripe --copy=\fR<\fIsource_template_file\fR> <\fIfile\fR>
26 .br
27 .B lfs setstripe --foreign[=\fR<\fIforeign_type\fR>\fB] \
28 [--flags=\fR<\fIhex\fR>\fB] --xattr=\fR<\fIlayout_string\fR> <\fIfile\fR>
29 .SH DESCRIPTION
30 The
31 .B lfs setstripe
32 command is used to create a new
33 .I file
34 in a Lustre filesystem with the specified layout, or to specify the default
35 layout for new files created in
36 .IR directory ,
37 or anywhere in the filesystem if
38 .I directory
39 is the filesystem root and no other layout takes precedence.
40 .PP
41 Files with composite layouts allow different
42 .I STRIPE_OPTIONS
43 to be specified for non-overlapping extents of the file. Files will
44 inherit options not explicitly specified on the command line either from
45 the default layout on the parent directory, or from the filesystem-wide
46 default. New subdirectories created under root directory will not explicitly
47 copy the default layout at creation time, but will implicitly inherit the
48 default layout at runtime. The default layout set on a non-root directory
49 will be copied to any new subdirectories created within that directory
50 at the time they are created.
51 .TP
52 .B lfs setstripe \fR[\fISTRIPE_OPTIONS\fR ...] <\fIdirectory\fR|\fIfile\fR>
53 Create a new
54 .I file
55 with specified plain layout using the specified
56 .IR STRIPE_OPTIONS ,
57 or replace the default file layout on an existing
58 .IR directory .
59 .TP
60 .B lfs setstripe -E \fIend\fR [\fISTRIPE_OPTIONS\fR] ... \
61 <\fIdirectory\fR|\fIfile\fR>
62 .br
63 Create a new composite
64 .I file
65 with one or more component layouts (where \fIend\fR marks the end of the
66 current component), or set or replace the default file layout on an existing
67 .IR directory.
68 .TP
69 .B lfs setstripe --component-add -E \fIend1\fR [\fISTRIPE_OPTIONS\fR] \
70 ... <\fIfile\fR>
71 .br
72 Add one or more components after the last component of an existing composite
73 file that does not yet have a component at
74 .BR eof .
75 .TP
76 .B lfs setstripe --comp-del \fR{\fB-I \fIcomp_id\fR | \
77 \fB--comp-flags \fIcomp_flags\fR} <\fIfile\fR>
78 Remove the component(s) specified by component ID or flags from
79 .IR file .
80 .TP
81 .B lfs setstripe --comp-set \fR{\fB-I \fIcomp_id\fR | \
82 \fB--comp-flags \fIcomp_flags\fR} <\fIfile\fR>
83 Set or clear
84 .I flags
85 on the specified component. This command can be only
86 be applied to mirrored files.
87 .TP
88 .B lfs setstripe -N \fR[\fImirror_count\fR] \fR[\fICOMPONENT_OPTIONS\fR] <\fIdirectory\fR|\fIfile\fR>
89 Create a new
90 .I file
91 with the specified number of mirrors and other specified layout options, or
92 set or replace the default file layout on an existing
93 .IR directory .
94 .TP
95 .B lfs setstripe -d \fR<\fIdirectory\fR>
96 .br
97 Delete the default layout on the specified directory.  It is not necessary
98 to delete the default layout on a directory before replacing it, only if
99 the directory should revert from a directory-specific default layout
100 to using the global filesystem default layout stored on the root directory.
101 .TP
102 .B lfs setstripe --yaml=\fR<\fIyaml_template_file.lyl\fR> <\fIfile\fR>
103 .br
104 Create a new
105 .I file
106 using the Lustre YAML Layout template
107 .IR yaml_template_file.lyl ,
108 created from
109 .I existing_file
110 via:
111 .br
112 .B lfs getstripe --yaml \fR<\fIexisting_file\fR> > <\fIyaml_template_file.lyl\fR>
113 .br
114 .I yaml_template_file.lyl
115 is a plain-text file that may be saved and/or modified after creation.
116 This allows complex file layouts to be created once and re-used later.
117 .TP
118 .B lfs setstripe --copy=\fR<\fIsource_template_file\fR> <\fIfile\fR>
119 .br
120 Create a new
121 .I file
122 using the same layout as an existing
123 .IR source_template_file .
124 This is similar to the
125 .B --yaml
126 option but avoids the need for the intermediate
127 .B .lyl
128 file.
129 .TP
130 .B lfs setstripe --foreign[=\fR<\fIforeign_type\fR>\fB] \
131 [--flags=\fR<\fIhex\fR>\fB] --xattr=\fR<\fIlayout_string\fR> <\fIfile\fR>
132 .br
133 Create a new
134 .I file
135 with a foreign/non-lustre layout of type
136 .I foreign_type \fR(\fBnone\fR, \fBsymlink\fR, ...)
137 with flags
138 .I hex
139 and a free-format layout value of
140 .I layout_string.
141 .SH STRIPE_OPTIONS
142 The various OST stripe related options are listed and explained below:
143 .TP
144 .B -c\fR, \fB--stripe-count \fR<\fIstripe_count\fR>
145 The number of OSTs to stripe a file over. \fB0 \fRmeans to use the
146 filesystem-wide default stripe count (default 1), and \fB-1 \fRmeans to stripe
147 over all available OSTs.
148 .TP
149 .B -C\fR, \fB--overstripe-count \fR<\fIstripe_count\fR>
150 The number of stripes to create, creating > 1 stripe per OST if count exceeds
151 the number of OSTs in the file system. \fB0 \fRmeans to use the filesystem-wide
152 default stripe count (default 1), and \fB-1 \fRmeans to stripe over all
153 available OSTs.
154 .TP
155 .B -S\fR, \fB--stripe-size \fR<\fIstripe_size\fR>
156 The number of bytes to store on each OST before moving to the next OST. A
157 stripe size of
158 .B 0
159 means the file should use the filesystem-wide default stripe_size
160 (default 1MiB).  An optional suffix can be used to specify the units in
161 .BR K ibi-,
162 .BR M "ebi-, or"
163 .BR G ibibytes.
164 The
165 .I stripe_size
166 must be a multiple of 64KiB.  Values below 4096 are assumed to be in KiB units.
167 .TP
168 .B -i\fR, \fB--stripe-index \fR<\fIstart_ost_index\fR>
169 The OST index (starting at 0) on which to start striping for this file.  A
170 .I start_ost_index
171 of
172 .B -1
173 allows the MDS to choose the starting index and it is strongly recommended, as
174 this allows space and load balancing to be done by the MDS as needed.
175 .TP
176 .B -L\fR, \fB--layout \fR<\fIlayout_type\fR>
177 The type of layout for that component, which can be one of:
178 .RS
179 .B raid0\fR - stripe the file data across
180 .B stripe_count
181 OST objects in units of
182 .B stripe_size
183 chunks.  This is the default layout if not specified.
184 .RE
185 .RS
186 .B mdt\fR - place the first component of the file data on the MDT for faster
187 access where the inode is located. This can be used for small files, and with
188 composite file layouts.  The
189 .B mdt
190 type may only be used for first component of a file. The
191 .IR stripe_size
192 of the MDT component is always equal to the component size. There is also a
193 per-MDT tunable parameter
194 .IR lod.dom_stripesize
195 that limits the maximum size of a DoM stripe.  It can be changed on the MDS via
196 .B lctl set_param lod.*.dom_stripesize=\fR<\fIstripe_size\fR> ,
197 where
198 .I stripe_size
199 must be a multiple of 64KiB in size,
200 see also
201 .BR lctl (8)
202 for details.
203 .RE
204 .TP
205 .B -o\fR, \fB--ost \fR<\fIost_indices\fR>
206 Used to specify the exact stripe layout on the file system. \fIost_indices\fR
207 is a list of OSTs referenced by their indices, which are specified in decimal
208 or hex form and can be obtained using the
209 .B lfs osts
210 command. The list format consists of individual OST indices and index ranges
211 separated by commas, e.g. 1,2-4,7. The
212 .B -o
213 option may be specified multiple times to stripe across the union of all listed
214 OSTs. If the
215 .B -c
216 option is combined with
217 .B -o
218 the
219 .I stripe_count
220 must agree with the number of OSTs in
221 .IR ost_indices .
222 If the
223 .B -i
224 option is combined with
225 .B -o
226 the
227 .I start_ost_index
228 must be in the OST list, and it will be used as the index on which to start
229 striping the file. Otherwise the striping will occur in the order specified in
230 .IR ost_indices .
231 .TP
232 .B -p\fR, \fB--pool \fR<\fIpool_name\fR>
233 Allocate objects from the predefined OST pool
234 .I pool_name
235 for the layout of this file or component. The
236 .IR stripe_count ,
237 .IR stripe_size ,
238 and
239 .I start_ost_index
240 can be used to select a subset of the OSTs within the pool; the
241 .I start_ost_index
242 must be part of the pool or an error will be returned.
243 It is possible to specify a different pool for each component of a file.  If
244 no pool is specified, it will be inherited from the previous component (for
245 later components of a composite layout) or the parent or root directory (for
246 plain
247 .B raid0
248 layouts, or the first component of a composite file).
249 Use
250 .BR pool_name=ignore
251 to force a component without a pool set (no inheritance from last component,
252 root or parent).
253 Use
254 .BR pool_name=''
255 or
256 .BR pool_name=inherit
257 (since Lustre 2.15) to force a component to inherit the pool from the parent
258 or root directory instead of the previous component.
259 .TP
260 .B --foreign \fR[<\fIforeign_type\fR>]
261 file layout is non-lustre/free-format and of type <
262 .IR foreign_type
263 >, if specified (see also
264 .IR --xattr
265 and
266 .IR --flags
267 options).
268 Current known types are
269 .BR none
270 and
271 .BR symlink
272 , default is
273 .BR none
274 .
275 .B -x\fR, \fB--xattr \fR<\fIlayout_string\fR>
276 Mandatory non-lustre/free-format layout/LOV EA content for
277 .I foreign
278 file.
279 .TP
280 .B -F\fR, \fB--flags \fR<\fIhex\fR>
281 Optional bitmap of flags for foreign type.
282 .SH COMPONENT_OPTIONS
283 The various component related options are listed and explained below.  The
284 .B --component-*
285 options can be shortened to
286 .B --comp-*
287 if desired.
288 .TP
289 .B -E\fR, \fB--component-end \fR<\fIend\fR>
290 Add a new component to a file using the
291 .I STRIPE_OPTIONS
292 following the
293 .B -E
294 argument.  These options apply to the component ending at offset
295 .I end
296 in bytes, or by using a suffix (KMGTP) to specify base-two units,
297 such as 256M for 2^28 bytes. An offset of
298 .B -1
299 or
300 .B eof
301 means the following options extend to the end of the file.  The first
302 component starts at offset 0, and each subsequent component starts at
303 the end of the previous component, so they must be specified in increasing
304 file offset order, and must be a multiple of 64KiB to align with the
305 minimum
306 .I stripe_size
307 value.  Values below 4096 are assumed to be in KiB units.
308 .PP
309 .RS
310 The first component specified will inherit default parameters from the
311 parent directory or the root directory like a plain layout, as specified
312 above.  Later components will inherit the default layout parameters from
313 the previous component.  Multiple
314 .B -E
315 options are used to separate the
316 .I STRIPE_OPTIONS
317 parameters for different regions of the file.
318 .RE
319 .PP
320 .RS
321 If a file does not have a component extending to
322 .B eof
323 it will generate an error when trying to write beyond the last component
324 .IR end .
325 This can be useful to limit the size of a file to the end of the last
326 specified component, or use
327 .B --component-add
328 to add more components to the end of the file.
329 .RE
330 .TP
331 .B -z, --extension-size, ext-size\fR <\fIext_size\fR>
332 This option modifies the \fB-E\fR option, components which have this
333 option specified are created as pairs of components, extendable and
334 extension ones.
335 .PP
336 .RS
337 The extendable component starts at offset 0 if this is the first
338 component of the file. In this case it ends at offset \fIext_size\fR and
339 it gets the flag \fBinit\fR (initialized). The extendable component starts
340 at the end of the previous component if this is not the first component of
341 the file. In this case it ends at the same offset (0-length component).
342 .PP
343 The extension component covers the rest of the specified region up to
344 the \fIend\fR specified by \fB-E\fR option and gets the flag \fBextension\fR.
345 This component covers the space reserved for the extendable component but
346 not used immediately, the later extension of the extendable component is done
347 by \fIext_size\fR each time until the extension component is used up. This is
348 used to control the space on OSTs the stripe is located on, in case one of
349 them is low on space, the remaining extension component region is added to the
350 next component.
351 .RE
352 .TP
353 .B --component-add
354 Add components to the end an existing composite file.  It is not possible
355 to add components incrementally to the default directory layout, since the
356 entire default layout can be replaced with a single
357 .B lfs setstripe
358 command.  Adding components to mirrored files is not currently allowed.
359 .TP
360 .B --component-del
361 Delete specified the components from an existing file using either the
362 .BR --component-id | -I
363 or
364 .BR --component-flags .
365 Deletion must start with the last component.  The ID specified by the
366 .B -I
367 option is the numerical unique ID of the component, it can be obtained using
368 the
369 .B lfs getstripe -I
370 command.  It is not possible to delete components from a default directory
371 layout, since the entire default layout can be replaced with a single
372 .B lfs setstripe
373 call.
374 The \fB--component-flags\fR option is used to specify certain type of
375 components. The only allowed component flag for deleting a component is
376 .B ^init
377 to indicate an uninstantiated component.  Deleting a single component from
378 mirrored files is not currently allowed, see the
379 .BR lfs-mirror-split (1)
380 command.
381 .TP
382 .B --component-flags \fR<\fIflags\fR>
383 Find, set, or clear
384 .B flags
385 on a specific component. Allowed
386 .I flags
387 are:
388 .RS
389 .B * init\fR - component is initialized (has allocated objects).  Used with
390 .B --component-del --component-flags ^init
391 to find uninitialized components.
392 .RE
393 .RS
394 .B * prefer\fR - component preferred for read/write in a mirrored file
395 .RE
396 .RS
397 .B * stale\fR - component has outdated data in a mirrored file. This flag is
398 not allowed to be set on a component of the last non-stale mirror.
399 Once a component is marked
400 .BR stale ,
401 it isn't permitted to clear this flag directly. \fBlfs-mirror-resync\fR(1)
402 is required to clear the flag.
403 .RE
404 .RS
405 .B * nosync\fR - mirror components will not be resynched by default when the
406 .BR lfs-mirror-resync (1)
407 command is run. This option is useful to freeze a file mirror as an old
408 version or snapshot of the file.
409 .RE
410 .RS
411 A leading '^' before \fIflags\fR clears the flags, or finds components not
412 matching the flags.  Multiple flags can be separated by comma(s).
413 .RE
414 .TP
415 .B -I\fR, \fB--component-id \fR<\fIcomp_id\fR>
416 The numerical unique component ID to identify a component to be modified.
417 .TP
418 .BR -N "[\fImirror_count\fR], " --mirror-count=" [\fImirror_count\fR]
419 Create a file with
420 .I mirror_count
421 identical replicas on the file or directory.  The
422 .I mirror_count
423 argument is optional and defaults to 1 if it's not specified; if specified,
424 it must follow the
425 .B -N
426 option without a space.
427 .br
428 The \fISTRIPE_OPTIONS\fR specify the specific layout for the mirror. It
429 can be a plain layout with specific striping pattern or a composite layout.
430 If not specified, the stripe options are inherited from the previous
431 component. If there is no previous component, the
432 .I stripe_count
433 and
434 .I stripe_size
435 options are inherited from filesystem-wide default values, and OST
436 .I pool_name
437 will be inherited from the parent directory.
438 .br
439 Multiple
440 .B -N
441 options may be specified, each with its own
442 .I STRIPE_OPTIONS
443 if there is a reason to have different layouts for the replicas, such as
444 flash pools and archive pools (see
445 .BR lfs-mirror-create (1)
446 for full details).
447 .br
448 .B NOTE
449 that in the current client implementation, only
450 .B one
451 replica will be written by client nodes, and the other replicas need to
452 be resynched using the
453 .B lfs mirror resync
454 command, or an external resync agent.
455 .SH EXAMPLES
456 .TP
457 .B lfs setstripe -S 128K -c 2 /mnt/lustre/file1
458 This creates a file striped on two OSTs with 128KiB on each stripe.
459 .TP
460 .B lfs setstripe -d /mnt/lustre/dir
461 This deletes a default stripe pattern on dir. New files created in that
462 directory will use the filesystem global default instead.
463 .TP
464 .B lfs setstripe -N2 -E 1M -E eof -c -1 /mnt/lustre/dir1
465 This sets a default mirror layout on a directory with 2 PFL mirrors. Each mirror
466 has the same specified PFL layout.
467 .TP
468 .B lfs setstripe -N -E 1M -L mdt -E eof --component-flags=prefer -p flash \
469     -N -E 1G -c 1 -p disk -E eof -c -1 /mnt/lustre/file1
470 This creates a mirrored file with 2 replicas. The first replica is using the
471 MDT for files smaller than 1MB, and the remainder of the file is on the
472 .B flash
473 OST pool with filesystem-wide default values.  The second replica is on the
474 .B disk
475 OST pool, with 1 stripe for the first 1GB of the file, and striped across
476 all OSTs in the
477 .B disk pool for the remainder of the file.  Clients will
478 .B prefer
479 the first (flash) replica for both reads and writes.
480 .TP
481 .B lfs setstripe -E 4M -c 1 -E 64M -c 4 -E -1 -c -1 /mnt/lustre/file1
482 This creates a file with composite layout, the component has 1 stripe and
483 covers [0, 4MiB), the second component has 4 stripes and covers [4MiB, 64MiB),
484 the last component stripes over all available OSTs and covers [64MiB, EOF).
485 .TP
486 .B lfs setstripe -E -1 -z 64M /mnt/lustre/file1
487 This creates a file with a composite layout, the component one covers [0, 64MiB)
488 and the second component the rest [64MiB, EOF) originally. Once written beyond
489 64MiB the component one is extended to [0, 128MiB), once written beyond 128MiB
490 it is extended to [0, 192MiB), etc; the second component is shortened
491 appropriately.
492 .PP
493 .RS
494 When one of the OSTs of the first component layout is low on space, e.g. while
495 writing beyond 192MiB, the first component is left as [0, 192MiB), and a new
496 component is allocated between them, its layout repeats the first component
497 layout but initialized on different OSTs so that the full OSTs are avoided.
498 It is allocated and immediately extended to [192MiB, 256MiB), the following
499 extension component is shortened again.
500 .RE
501 .TP
502 .B lfs setstripe -E 1G -z 64M -E 100G -z 256M -E -1 -z 1G /mnt/lustre/file1
503 This creates a file with a composite layout, the component one covers [0,
504 64MiB), the third component covers [1G, 1G), the fifth component covers
505 [100GiB, 100GiB) originally. The second, fourth and sixth extension components
506 cover the left space accordingly. The process of writing is similar to above,
507 but when one of the OSTs of the first component layout is low on space, e.g.
508 while writing beyond 192MiB in the example above, the first component is left
509 as [0, 192MiB), the second (extension) component is removed, and its range
510 spills over to the third and the fourth components - they are moved left to
511 start at 192MiB instead of 100GiB; the third component is immediately extended
512 and becomes [192MiB, 448MiB), the fourth (the extension one) component becomes
513 [448MiB, 100GiB).
514 .TP
515 .B lfs setstripe --component-add -E eof -c 4  /mnt/lustre/file1
516 This add a component which starts at the end of last existing component to
517 the end of file.
518 .TP
519 .B lfs setstripe --component-del -I 1 /mnt/lustre/file1
520 This deletes the component with ID equal to 1 from an existing file.
521 .TP
522 .B lfs setstripe --comp-set -I 1 --comp-flags=^prefer,stale /mnt/lustre/file1
523 This command will clear the \fBprefer\fR flag and set the \fBstale\fR flag on
524 .B file1
525 component ID 1.
526 .TP
527 .B lfs setstripe -E 1M -L mdt -E -1 /mnt/lustre/file1
528 Create
529 .B file1
530 with Data-on-MDT layout. The first 1MiB of the file data is placed on the
531 MDT and rest of file is placed on OST(s) with default striping.
532 .TP
533 .B lfs setstripe --yaml=/tmp/layout_yaml /mnt/lustre/file2
534 This creates
535 .B file2
536 with layout stored in the layout template
537 file
538 .B layout_yaml
539 which can be created with the
540 .B lfs getstripe --yaml
541 command.
542 .TP
543 .B lfs setstripe --foreign=symlink --flags=0xda08 \
544         --xattr=PUUID:CUUID /mnt/lustre/file1
545 This creates foreign
546 .BR file1
547 of type
548 .BR symlink
549 with non-lustre/free-format
550 .BR PUUID:CUUID
551 layout/LOV EA and flags
552 .BR 0xda08
553 .
554 .SH SEE ALSO
555 .BR lctl (1),
556 .BR lfs (1),
557 .BR lfs-migrate (1),
558 .BR lfs-mirror-create (1),
559 .BR lfs-mirror-split (1),
560 .BR lustre (7)