Whamcloud - gitweb
New tag 2.15.63
[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|\fIFILENAME\fR
6 .br
7 .B lfs setstripe -E \fICOMP_END\fR [\fISTRIPE_OPTIONS\fR] ... \
8 \fIDIRECTORY\fR|\fIFILENAME\fR
9 .br
10 .B lfs setstripe --comp-add -E \fICOMP_END\fR [\fISTRIPE_OPTIONS\fR] ... \
11 \fIFILENAME\fR
12 .br
13 .B lfs setstripe --comp-del \fR[\fB-I \fICOMP_ID\fR|\
14 \fB--comp-flags=\fICOMP_FLAGS\fR] \fIFILENAME\fR
15 .br
16 .B lfs setstripe --comp-set \fR[\fB-I \fICOMP_ID\fR|\
17 \fB--comp-flags=\fICOMP_FLAGS\fR] \fIFILENAME\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 \fIFILENAME\fR
24 .br
25 .B lfs setstripe --copy=\fR\fISOURCE_TEMPLATE_FILE\fR \fIFILENAME\fR
26 .br
27 .B lfs setstripe --foreign\fR[\fB=\fR\fIFOREIGN_TYPE\fR] \
28 \fR[\fB--flags=\fR\fIHEX\fR] \fB--xattr=\fR\fILAYOUT_STRING\fR \fIFILENAME\fR
29 .SH DESCRIPTION
30 .nh
31 .ad l
32 The
33 .B lfs setstripe
34 command is used to create a new
35 .I FILENAME
36 in a Lustre filesystem with the specified layout, or to specify the default
37 layout for new files created in
38 .IR DIRECTORY ,
39 or anywhere in the filesystem if
40 .I DIRECTORY
41 is the filesystem root and no other layout takes precedence.
42 .PP
43 Files with composite layouts allow different
44 .I STRIPE_OPTIONS
45 to be specified for non-overlapping extents of the file. Files will
46 inherit options not explicitly specified on the command line either from
47 the default layout on the parent directory, or from the filesystem-wide
48 default. New subdirectories created under root directory will not explicitly
49 copy the default layout at creation time, but will implicitly inherit the
50 default layout at runtime. The default layout set on a non-root directory
51 will be copied to any new subdirectories created within that directory
52 at the time they are created.
53 .TP
54 .B lfs setstripe \fR[\fISTRIPE_OPTIONS\fR ...] \fIDIRECTORY\fR|\fIFILENAME\fR
55 Create a new
56 .I FILENAME
57 with specified plain layout using the specified
58 .IR STRIPE_OPTIONS ,
59 or replace the default file layout on an existing
60 .IR DIRECTORY .
61 .TP
62 .B lfs setstripe -E \fIEND_OFFSET\fR [\fISTRIPE_OPTIONS\fR] ... \
63 \fIDIRECTORY\fR|\fIFILENAME\fR
64 .br
65 Create a new composite
66 .I FILENAME
67 with one or more component layouts (where \fIEND_OFFSET\fR marks the end of the
68 current component), or set or replace the default file layout on an existing
69 .IR DIRECTORY.
70 .TP
71 .B lfs setstripe --component-add -E \fIEND_OFFSET\fR [\fISTRIPE_OPTIONS\fR] \
72 ... \fIFILENAME\fR
73 .br
74 Add one or more components after the last component of an existing composite
75 file that does not yet have a component at
76 .BR eof .
77 .TP
78 .B lfs setstripe --comp-del \fR[\fB-I \fICOMP_ID\fR | \
79 \fB--comp-flags \fICOMP_FLAGS\fR] \fIFILENAME\fR
80 Remove the component(s) specified by component ID or flags from
81 .IR FILENAME .
82 .TP
83 .B lfs setstripe --comp-set \fR[\fB-I \fICOMP_ID\fR | \
84 \fB--comp-flags \fICOMP_FLAGS\fR] \fIFILENAME\fR
85 Set or clear
86 .I COMP_FLAGS
87 on the specified component. This command can be only
88 be applied to mirrored files.
89 .TP
90 .B lfs setstripe -N \fR[\fIMIRROR_COUNT\fR] \fR[\fICOMPONENT_OPTIONS\fR] \fIDIRECTORY\fR|\fIFILENAME\fR
91 Create a new
92 .I FILENAME
93 with the specified number of mirrors and other specified layout options, or
94 set or replace the default file layout on an existing
95 .IR DIRECTORY .
96 .TP
97 .B lfs setstripe -d \fR\fIDIRECTORY\fR
98 .br
99 Delete the default layout on the specified directory.  It is not necessary
100 to delete the default layout on a directory before replacing it, only if
101 the directory should revert from a directory-specific default layout
102 to using the global filesystem default layout stored on the root directory.
103 .TP
104 .B lfs setstripe --yaml=\fR\fIYAML_TEMPLATE_FILE.LYL\fR \fIFILENAME\fR
105 .br
106 Create a new
107 .I FILENAME
108 using the Lustre YAML Layout template
109 .IR YAML_TEMPLATE_FILE.LYL ,
110 created from
111 .I EXISTING_FILE
112 via:
113 .br
114 .B lfs getstripe --yaml \fR\fIEXISTING_FILE\fR > \fIYAML_TEMPLATE_FILE.LYL\fR
115 .br
116 .I YAML_TEMPLATE_FILE.LYL
117 is a plain-text file that may be saved and/or modified after creation.
118 This allows complex file layouts to be created once and re-used later.
119 .TP
120 .B lfs setstripe --copy=\fR\fISOURCE_TEMPLATE_FILE\fR \fIFILENAME\fR
121 .br
122 Create a new
123 .I file
124 using the same layout as an existing
125 .IR SOURCE_TEMPLATE_FILE .
126 This is similar to the
127 .B --yaml
128 option but avoids the need for the intermediate
129 .B .lyl
130 file.
131 .TP
132 .B lfs setstripe --foreign[=\fR\fIFOREIGN_TYPE\fR\fB] \
133 [--flags=\fR\fIHEX\fR\fB] --xattr=\fR\fILAYOUT_STRING\fR \fIFILENAME\fR
134 .br
135 Create a new
136 .I FILENAME
137 with a foreign/non-lustre layout of type
138 .I FOREIGN_TYPE \fR(\fBnone\fR, \fBdaos\fR, ...)
139 with flags
140 .I HEX
141 and a free-format layout value of
142 .I LAYOUT_STRING.
143 .SH STRIPE_OPTIONS
144 The various OST stripe related options are listed and explained below:
145 .TP
146 .B -c\fR, \fB--stripe-count \fR\fISTRIPE_COUNT\fR
147 The number of OSTs to stripe a file over. \fB0 \fRmeans to use the
148 filesystem-wide default stripe count (default 1), and \fB-1 \fRmeans to stripe
149 over all available OSTs.
150 .TP
151 .B -C\fR, \fB--overstripe-count \fR\fISTRIPE_COUNT\fR
152 The number of stripes to create, creating > 1 stripe per OST if count exceeds
153 the number of OSTs in the file system. \fB0 \fRmeans to use the filesystem-wide
154 default stripe count (default 1), and \fB-1 \fRmeans to stripe over all
155 available OSTs.
156 .TP
157 .B -S\fR, \fB--stripe-size \fR\fISTRIPE_SIZE\fR
158 The number of bytes to store on each OST before moving to the next OST. A
159 stripe size of
160 .B 0
161 means the file should use the filesystem-wide default stripe size
162 (default 4MiB).  An optional suffix can be used to specify the units in
163 .BR K ibi-,
164 .BR M "ebi-, or"
165 .BR G ibibytes.
166 The
167 .I STRIPE_SIZE
168 must be a multiple of 64KiB.  Values below 4096 are assumed to be in KiB units.
169 .TP
170 .B -i\fR, \fB--stripe-index \fR\fISTART_OST_IDX\fR
171 The OST index (starting at 0) on which to start striping for this file.  A
172 .I START_OST_IDX
173 of
174 .B -1
175 allows the MDS to choose the starting index and it is strongly recommended, as
176 this allows space and load balancing to be done by the MDS as needed.
177 .TP
178
179 The type of layout for that component, which can be one of:
180 .RS
181 .B raid0\fR - stripe the file data across
182 \fISTRIPE_COUNT\fR OST objects in units of
183 \fISTRIPE_SIZE\fR 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_IDX\fR
206 Used to specify the exact stripe layout on the file system. \fIOST_IDX\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_IDX .
222 If the
223 .B -i
224 option is combined with
225 .B -o
226 the
227 .I START_OST_IDX
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_IDX .
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_IDX
240 can be used to select a subset of the OSTs within the pool; the
241 .I START_OST_IDX
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_OFFSET\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_OFFSET
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_OFFSET\fR specified by \fB-E\fR option and gets
345 the flag \fBextension\fR.
346 This component covers the space reserved for the extendable component but
347 not used immediately, the later extension of the extendable component is done
348 by \fIEXT_SIZE\fR each time until the extension component is used up. This is
349 used to control the space on OSTs the stripe is located on, in case one of
350 them is low on space, the remaining extension component region is added to the
351 next component.
352 .RE
353 .TP
354 .B --component-add
355 Add components to the end an existing composite file.  It is not possible
356 to add components incrementally to the default directory layout, since the
357 entire default layout can be replaced with a single
358 .B lfs setstripe
359 command.  Adding components to mirrored files is not currently allowed.
360 .TP
361 .B --component-del
362 Delete specified the components from an existing file using either the
363 .BR --component-id | -I
364 or
365 .BR --component-flags .
366 Deletion must start with the last component.  The ID specified by the
367 .B -I
368 option is the numerical unique ID of the component, it can be obtained using
369 the
370 .B lfs getstripe -I
371 command.  It is not possible to delete components from a default directory
372 layout, since the entire default layout can be replaced with a single
373 .B lfs setstripe
374 call.
375 The \fB--component-flags\fR option is used to specify certain type of
376 components. The only allowed component flag for deleting a component is
377 .B ^init
378 to indicate an uninstantiated component.  Deleting a single component from
379 mirrored files is not currently allowed, see the
380 .BR lfs-mirror-split (1)
381 command.
382 .TP
383 .B --component-flags \fR\fICOMP_FLAGS\fR
384 Find, set, or clear
385 .B flags
386 on a specific component. Allowed
387 .I flags
388 are:
389 .RS
390 .B * init\fR - component is initialized (has allocated objects).  Used with
391 .B --component-del --component-flags ^init
392 to find uninitialized components.
393 .RE
394 .RS
395 .B * prefer\fR - component preferred for read/write in a mirrored file
396 .RE
397 .RS
398 .B * prefrd\fR - component preferred for read in a mirrored file
399 .RE
400 .RS
401 .B * prefwr\fR - component preferred for write in a mirrored file
402 .RE
403 .RS
404 .B * stale\fR - component has outdated data in a mirrored file. This flag is
405 not allowed to be set on a component of the last non-stale mirror.
406 Once a component is marked
407 .BR stale ,
408 it isn't permitted to clear this flag directly. \fBlfs-mirror-resync\fR(1)
409 is required to clear the flag.
410 .RE
411 .RS
412 .B * nosync\fR - mirror components will not be resynched by default when the
413 .BR lfs-mirror-resync (1)
414 command is run. This option is useful to freeze a file mirror as an old
415 version or snapshot of the file.
416 .RE
417 .RS
418 A leading '^' before \fIflags\fR clears the flags, or finds components not
419 matching the flags.  Multiple flags can be separated by comma(s).
420 .RE
421 .TP
422 .B -I\fR, \fB--component-id \fR\fICOMP_ID\fR
423 The numerical unique component ID to identify a component to be modified.
424 .TP
425 .BR -N, \fB--mirror-count  \fR[\fIMIRROR_COUNT\fR]
426 Create a file with
427 .I MIRROR_COUNT
428 identical replicas on the file or directory.  The
429 .I MIRROR_COUNT
430 argument is optional and defaults to 1 if it's not specified; if specified,
431 it must follow the
432 .B -N
433 option without a space. The maximum possible value for the mirror count is 16.
434 .br
435 The \fISTRIPE_OPTIONS\fR specify the specific layout for the mirror. It
436 can be a plain layout with specific striping pattern or a composite layout.
437 If not specified, the stripe options are inherited from the previous
438 component. If there is no previous component, the
439 .I STRIPE_COUNT
440 and
441 .I STRIPE_SIZE
442 options are inherited from filesystem-wide default values, and OST
443 .I POOL_NAME
444 will be inherited from the parent directory.
445 .br
446 Multiple
447 .B -N
448 options may be specified, each with its own
449 .I STRIPE_OPTIONS
450 if there is a reason to have different layouts for the replicas, such as
451 flash pools and archive pools (see
452 .BR lfs-mirror-create (1)
453 for full details).
454 .br
455 .B NOTE
456 that in the current client implementation, only
457 .B one
458 replica will be written by client nodes, and the other replicas need to
459 be resynched using the
460 .B lfs mirror resync
461 command, or an external resync agent.
462 .SH EXAMPLES
463 .TP
464 .B lfs setstripe -S 128K -c 2 /mnt/lustre/file1
465 This creates a file striped on two OSTs with 128KiB on each stripe.
466 .TP
467 .B lfs setstripe -d /mnt/lustre/dir
468 This deletes a default stripe pattern on dir. New files created in that
469 directory will use the filesystem global default instead.
470 .TP
471 .B lfs setstripe -N2 -E 1M -E eof -c -1 /mnt/lustre/dir1
472 This sets a default mirror layout on a directory with 2 PFL mirrors. Each mirror
473 has the same specified PFL layout.
474 .TP
475 .B lfs setstripe -N -E 1M -L mdt -E eof --component-flags=prefer -p flash \
476     -N -E 1G -c 1 -p disk -E eof -c -1 /mnt/lustre/file1
477 This creates a mirrored file with 2 replicas. The first replica is using the
478 MDT for files smaller than 1MB, and the remainder of the file is on the
479 .B flash
480 OST pool with filesystem-wide default values.  The second replica is on the
481 .B disk
482 OST pool, with 1 stripe for the first 1GB of the file, and striped across
483 all OSTs in the
484 .B disk pool for the remainder of the file.  Clients will
485 .B prefer
486 the first (flash) replica for both reads and writes.
487 .TP
488 .B lfs setstripe -E 4M -c 1 -E 64M -c 4 -E -1 -c -1 /mnt/lustre/file1
489 This creates a file with composite layout, the component has 1 stripe and
490 covers [0, 4MiB), the second component has 4 stripes and covers [4MiB, 64MiB),
491 the last component stripes over all available OSTs and covers [64MiB, EOF).
492 .TP
493 .B lfs setstripe -E -1 -z 64M /mnt/lustre/file1
494 This creates a file with a composite layout, the component one covers [0, 64MiB)
495 and the second component the rest [64MiB, EOF) originally. Once written beyond
496 64MiB the component one is extended to [0, 128MiB), once written beyond 128MiB
497 it is extended to [0, 192MiB), etc; the second component is shortened
498 appropriately.
499 .PP
500 .RS
501 When one of the OSTs of the first component layout is low on space, e.g. while
502 writing beyond 192MiB, the first component is left as [0, 192MiB), and a new
503 component is allocated between them, its layout repeats the first component
504 layout but initialized on different OSTs so that the full OSTs are avoided.
505 It is allocated and immediately extended to [192MiB, 256MiB), the following
506 extension component is shortened again.
507 .RE
508 .TP
509 .B lfs setstripe -E 1G -z 64M -E 100G -z 256M -E -1 -z 1G /mnt/lustre/file1
510 This creates a file with a composite layout, the component one covers [0,
511 64MiB), the third component covers [1G, 1G), the fifth component covers
512 [100GiB, 100GiB) originally. The second, fourth and sixth extension components
513 cover the left space accordingly. The process of writing is similar to above,
514 but when one of the OSTs of the first component layout is low on space, e.g.
515 while writing beyond 192MiB in the example above, the first component is left
516 as [0, 192MiB), the second (extension) component is removed, and its range
517 spills over to the third and the fourth components - they are moved left to
518 start at 192MiB instead of 100GiB; the third component is immediately extended
519 and becomes [192MiB, 448MiB), the fourth (the extension one) component becomes
520 [448MiB, 100GiB).
521 .TP
522 .B lfs setstripe --component-add -E eof -c 4  /mnt/lustre/file1
523 This add a component which starts at the end of last existing component to
524 the end of file.
525 .TP
526 .B lfs setstripe --component-del -I 1 /mnt/lustre/file1
527 This deletes the component with ID equal to 1 from an existing file.
528 .TP
529 .B lfs setstripe --comp-set -I 1 --comp-flags=^prefer,stale /mnt/lustre/file1
530 This command will clear the \fBprefer\fR flag and set the \fBstale\fR flag on
531 .B file1
532 component ID 1.
533 .TP
534 .B lfs setstripe -E 1M -L mdt -E -1 /mnt/lustre/file1
535 Create
536 .B file1
537 with Data-on-MDT layout. The first 1MiB of the file data is placed on the
538 MDT and rest of file is placed on OST(s) with default striping.
539 .TP
540 .B lfs setstripe --yaml=/tmp/layout_yaml /mnt/lustre/file2
541 This creates
542 .B file2
543 with layout stored in the layout template
544 file
545 .B layout_yaml
546 which can be created with the
547 .B lfs getstripe --yaml
548 command.
549 .TP
550 .B lfs setstripe --foreign=symlink --flags=0xda08 \
551         --xattr=PUUID:CUUID /mnt/lustre/file1
552 This creates foreign
553 .BR file1
554 of type
555 .BR symlink
556 with non-lustre/free-format
557 .BR PUUID:CUUID
558 layout/LOV EA and flags
559 .BR 0xda08
560 .
561 .SH SEE ALSO
562 .BR lctl (1),
563 .BR lfs (1),
564 .BR lfs-migrate (1),
565 .BR lfs-mirror-create (1),
566 .BR lfs-mirror-split (1),
567 .BR lustre (7)