Whamcloud - gitweb
c7a0accc0e8bc19a274d48341ab881192c9e6486
[fs/lustre-release.git] / lustre / doc / lfs-setdirstripe.1
1 .TH LFS-SETDIRSTRIPE 1 2017-11-07 "Lustre" "Lustre Utilities"
2 .SH NAME
3 lfs setdirstripe, mkdir \- set striping pattern of a directory.
4 .SH SYNOPSIS
5 .B lfs setdirstripe [\fR-cdDhHioTxX\fR] \fIDIR\fR...
6 .br
7 .SH DESCRIPTION
8 Create a striped directory with specified striping pattern. This
9 .B lfs
10 sub-command is similar to
11 .BR "lfs setstripe" ,
12 but is used to create a striped directory or set the default layout for
13 subdirectories.
14 Can also be used to create directory with a foreign (free format) striping pattern (see
15 .BR --foreign
16 and
17 .BR --xattr
18 options).
19 .B lfs mkdir
20 is an alias for this command.
21 .SH OPTIONS
22 .TP
23 .BR \-c ", " \-T ", " \-\-mdt\-count =\fICOUNT\fR
24 Stripe the new directory over
25 .I COUNT
26 MDTs.
27 .TP
28 .BR \-h ", " \-\-help
29 Print usage message.
30 .TP
31 .BR \-i ", " \-\-mdt\-index =\fISTART_MDT_INDEX\fR[,\fIMDT_INDEX ...]
32 Use the MDT whose index is
33 .I START_MDT_INDEX
34 as the master/starting MDT for the directory. If multiple
35 .I MDT_INDEX
36 values are given, then the stripes will be allocated on the specified
37 MDT indices.  If index -1 (default) is used, it will prefer to select
38 .B COUNT
39 MDTs proportional to the free space and inodes on each.
40 .TP
41 .BR \-H ", " \-\-mdt-hash =\fIHASH_TYPE\fR
42 Use
43 .I hash_type
44 for the striped directory.
45 .RS 1.2i
46 .TP
47 .B crush
48 CRUSH hash algorithm.  This is a consistent hash
49 algorithm, so minimum sub files need to relocate
50 during directory restripe.
51 .TP
52 .B fnv_1a_64
53 Fowler-Noll-Vo (FNV-1a) hash algorithm.  This provides
54 reasonably uniform, but not cryptographically strong,
55 hashing of the filename. (default)
56 .TP
57 .B all_char
58 Sum of ASCII characters modulo number of MDTs. This
59 provides weak hashing of the filename, and is suitable
60 for only testing or when the input is known to have
61 perfectly uniform distribution (e.g. sequential numbers).
62 .RE
63 .TP
64 .BR \-d ", " \-\-delete
65 Delete the default striping layout from the directory.  New subdirectories
66 created in this directory will inherit the global default directory layout
67 (by default they will not be striped).
68 .TP
69 .BR \-D ", " \-\-default
70 Set the default striping pattern of subdirectories. Newly created
71 sub-directories will use the new default striping pattern,
72 but existing sub-directories will not be affected.  The newly
73 created sub-directories will also inherit the specified default
74 striping pattern. Only default stripe count is supported for now.
75
76 Note that striping all directories across all MDTs by default is
77 .B not
78 recommended at this time, as the clients will have to do more RPCs to
79 create and access each directory, hurting performance rather than
80 improving it.  Default striped directories are preferred for parent
81 directories
82 where large subdirectories will be created (e.g. file-per-process
83 job output directories).
84 .TP
85 .BR \-o ", " \-\-mode =\fIMODE\fR
86 Set the file access permissions of the new directory to the specified
87 numeric
88 .I MODE
89 (typically octal), as with
90 .BR chmod (1).
91 It is not affected by the current
92 .BR umask (1p).
93 .TP
94 .BR \-\-foreign[=type]
95 Create a directory with a foreign (non-Lustre/free format, see
96 .BR \-\-xattr
97 option) striping. Where
98 .BR type
99 specifies a known foreign type (like
100 .BR none
101 ,
102 .BR symlink
103 , ...) or a 32-bit numeric type.
104 .TP
105 .BR \-\-flags =\fI<hex>\fR
106 Specify a numeric bitmask of type-specific layout flags for the foreign layout.
107 .TP
108 .BR \-x ", " \-\-xattr =\fISTRING\fR
109 Specify a string to be used as a foreign (free format) striping.
110 .TP
111 .BR \-X ", " \-\-max-inherit = \fIMAX_INHERIT
112 Set the inherit depth of default directory layout. If non-zero, then
113 .I MAX_INHERIT
114 is the number of subdirectory levels for which this default layout is inherited,
115 up to a maximum of 250 levels, and is decremented by one when copying the
116 default layout to each new subdirectory, until zero and the default layout is
117 no longer copied. A
118 .I MAX_INHERIT
119 of -1 means the default layout is inherited for all subdirectories.
120 .TP
121 .BR \-\-max-inherit-rr = \fIMAX_INHERIT_RR
122 Set the round-robin inherit depth of the default directory layout, only when
123 .I START_MDT_INDEX
124 is -1.  If
125 .I MAX_INHERIT_RR
126 is zero (unset), then new subdirectories are preferentially created on MDTs
127 with more free space and inodes if the MDTs are imbalanced.  If non-zero, then
128 .I MAX_INHERIT_RR
129 is the number of subdirectory levels, up to a maximum of 250 levels, for which
130 new subdirectories will be created in a round-robin manner across all available
131 MDTs, rather than using MDT space balancing for new subdirectories.  Otherwise,
132 .I MAX_INHERIT_RR
133 is decremented by one when copying the default layout to each new subdirectory,
134 until zero and round-robin is no longer used.  It may be useful to set
135 .I MAX_INHERIT_RR
136 to 2 or 3 when setting the default directory layout on the root of a
137 .B new
138 filesystem, so that top-level subdirectories are immediately spread
139 across MDTs, rather than waiting for the MDTs to become imbalanced.
140 Round-robin subdirectory creation is unlikely to be useful for existing
141 filesystems that already have many files and imbalanced MDTs, since space
142 balancing will already happen, and this will unnecessarily increase the number
143 of remote subdirectories (increasing overhead) without any benefit.
144 .SH NOTE
145 .PP
146 If neither
147 .B -c
148 or
149 .B -i
150 are specified,
151 .B lfs mkdir
152 will default to
153 .B -c 1 -i -1
154 and create the directory on an MDT that is less full than the others.
155 .PP
156 The
157 .B lfs setdirstripe
158 command is only usable by root unless the
159 .B "mdt.*.enable_remote_dir_gid"
160 is set on the MDS via
161 .B lctl set_param
162 to be either a non-zero numeric GID to limit it to a single group (e.g. the
163 .BR "operator " or " admin"
164 GID), or
165 .B "-1"
166 to allow any user/group to create remote directories.  By default, it is
167 .B "0"
168 to limit remote/striped directories to only the root user.
169
170 The root directory of the file system is on MDT0000, and directories and
171 files inherit the MDT of their parent directory unless a different MDT is
172 specified with this command.
173
174 By default, only directories on MDT0000 can contain directories that are not on
175 the same MDT.  However, if
176 .B "mdt.*.enable_remote_dir"
177 is set non-zero on an MDT (the default)
178 then it will allow creating remote directories that have parents other than
179 MDT0000. This is restricted to avoid creating directory trees that have
180 intermediate path components on a series different MDTs and become unavailable
181 if any of the intermediate MDTs are offline.
182 .SH EXAMPLES
183 .TP
184 .B $ lfs setdirstripe -c 2 -i 1 -H all_char /mnt/lustre/dir1
185 This creates a directory striped on two MDTs, whose first stripe is on
186 .B MDT0001
187 (MDT index 1), and whose hash type is
188 .BR all_char .
189 .TP
190 .B $ lfs mkdir --foreign=symlink --xattr PUUID/CUUID /mnt/lustre/dir1
191 This creates
192 .B dir1
193 with foreign (non-lustre/free format)
194 .B PUUID/CUUID
195 striping/LMV EA value (symlink type).
196 .SH AVAILABILITY
197 The
198 .B lfs setdirstripe
199 command is part of the Lustre filesystem.
200 .SH SEE ALSO
201 .BR lctl (8),
202 .BR lfs (1),
203 .BR lfs-getdirstripe (1),
204 .BR lfs-setstripe (1),
205 .BR lustre (7)