Whamcloud - gitweb
LU-6635 lfsck: block replacing the OST-object for test
[fs/lustre-release.git] / lustre / doc / lfs.1
1 .TH lfs 1 "2009 Jan 29" Lustre "user utilities"
2 .SH NAME
3 lfs \- Lustre utility to create a file with specific striping pattern, find the striping pattern of existing files, do certain quota operations, and manage distributed namespace options for directories
4 .SH SYNOPSIS
5 .br
6 .B lfs
7 .br
8 .B lfs changelog [--follow] <mdtname> [startrec [endrec]]
9 .br
10 .B lfs changelog_clear <mdtname> <id> <endrec>
11 .br
12 .B lfs check <mds|osts|servers>
13 .br
14 .B lfs data_version [-n] \fB<filename>\fR
15 .br
16 .B lfs df [-i] [-h] [--lazy] [--pool|-p <fsname>[.<pool>] [path]
17 .br
18 .B lfs fid2path [--link <linkno>] <fsname|rootpath> <fid> ...
19 .br
20 .B lfs find <directory|filename>
21         \fB[[!] --atime|-A [-+]N] [[!] --mtime|-M [-+]N] [[!] --ctime|-C [+-]N]
22         \fB[--maxdepth|-D N] [[!] --mdt|-m <uuid|index,...>] [--name|-n pattern]
23         \fB[[!] --ost|-O <uuid|index,...>] [--print|-p] [--print0|-P]
24         \fB[[!] --size|-s [-+]N[kMGTPE]]
25         \fB[[!] --stripe-count|-c [+-]<stripes>]
26         \fB[[!] --stripe-index|-i <index,...>]
27         \fB[[!] --stripe-size|-S [+-]N[kMG]]
28         \fB[[!] --layout|-L raid0,released]
29         \fB[--type |-t {bcdflpsD}] [[!] --gid|-g|--group|-G <gname>|<gid>]
30         \fB[[!] --uid|-u|--user|-U <uname>|<uid>] [[!] --pool <pool>]\fR
31 .br
32 .B lfs getname [-h]|[path ...]
33 .br
34 .B lfs getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v]
35         \fB[--stripe-count|-c ] [--stripe-index|-i] [--mdt-index|-M] [--fid|-F]
36         \fB[--stripe-size|-S] [--directory|-d] [--layout|-L] [--generation|-g]
37         \fB[--pool|-p] [--recursive|-r] [--raw|-R] <dirname|filename> ...\fR
38 .br
39 .B lfs migrate \fB-m <mdt_index>\fR
40 .IR directory
41 .br
42 .B lfs migrate [\fB-c | --stripe-count <stripe_count>\fR]
43                [\fB-i | --stripe-index <start_ost_idx>\fR]
44                [\fB-S | --stripe-size <stripe_size>\fR]
45                [\fB-p | --pool <pool_name>\fR]
46                [\fB-o | --ost-list <ost_indices>\fR]
47                [\fB-b | --block\fR]
48                [\fB-n | --non-block\fR]
49 .IR file|directory
50 .br
51 .B lfs mkdir [\fB-c | --count <stripe_count>\fR]
52              [\fB-i | --index <mdt_idx>\fR]
53              [\fB-h | --hash-type <hash_name>\fR]
54              [\fB-m | --mode <mode>\fR]
55              [\fB-D | --default\fR]
56 .IR directory
57 .br
58 .B lfs osts
59 .RB [ path ]
60 .br
61 .B lfs mdts
62 .RB [ path ]
63 .br
64 .B lfs path2fid [--parents] <path> ...
65 .br
66 .B lfs pool_list <filesystem>[.<pool>] | <pathname>
67 .br
68 .B lfs quota [-q] [-v] [-o obd_uuid|-I ost_idx|-i mdt_idx] [-u <uname>| -u <uid>|-g <gname>| -g <gid>] <filesystem>
69 .br
70 .B lfs quota -t <-u|-g> <filesystem>
71 .br
72 .B lfs quotacheck [-ug] <filesystem>
73 .br
74 .B lfs quotaon [-ugf] <filesystem>
75 .br
76 .B lfs quotaoff [-ug] <filesystem>
77 .br
78 .B lfs setquota <-u|--user|-g|--group> <uname|uid|gname|gid>
79              \fB[--block-softlimit <block-softlimit>]
80              \fB[--block-hardlimit <block-hardlimit>]
81              \fB[--inode-softlimit <inode-softlimit>]
82              \fB[--inode-hardlimit <inode-hardlimit>]
83              \fB<filesystem>\fR
84 .br
85 .B lfs setquota <-u|--user|-g|--group> <uname|uid|gname|gid>
86              \fB[-b <block-softlimit>] [-B <block-hardlimit>]
87              \fB[-i <inode-softlimit>] [-I <inode-hardlimit>]
88              \fB<filesystem>\fR
89 .br
90 .B lfs setquota -t <-u|-g>
91              \fB[--block-grace <block-grace>]\fR
92              \fB[--inode-grace <inode-grace>]\fR
93              \fB<filesystem>\fR
94 .br
95 .B lfs setquota -t <-u|-g>
96              \fB[-b <block-grace>] [-i <inode-grace>]\fR
97              \fB<filesystem>\fR
98 .br
99 .B lfs setstripe [--stripe-size|-S stripe_size] [--stripe-count|-c stripe_count]
100         \fB[--stripe-index|-i start_ost_index] [--pool|-p <poolname>]
101         \fB[--ost-list|-o <ost_indices>] <directory|filename>\fR
102 .br
103 .B lfs setstripe -d <dir>
104 .br
105 .B lfs --version
106 .br
107 .B lfs help
108 .SH DESCRIPTION
109 .B lfs
110 can be used to create a new file with a specific striping pattern, determine
111 the default striping pattern, gather the extended attributes (object numbers
112 and location) for a specific file. It can be invoked interactively without any
113 arguments or in a non-interactive mode with one of the arguments supported.
114 .SH OPTIONS
115 The various options supported by lfs are listed and explained below:
116 .TP
117 .B changelog
118 Show the metadata changes on an MDT.  Start and end points are optional.  The --follow option will block on new changes; this option is only valid when run direclty on the MDT node.
119 .TP
120 .B changelog_clear
121 Indicate that changelog records previous to <endrec> are no longer of
122 interest to a particular consumer <id>, potentially allowing the MDT to
123 free up disk space. An <endrec> of 0 indicates the current last record.
124 Changelog consumers must be registered on the MDT node using \fBlctl\fR.
125 .TP
126 .B check
127 Display the status of MDS or OSTs (as specified in the command) or all the servers (MDS and OSTs)
128 .TP
129 .B df [-i] [-h] [--lazy] [--pool|-p <fsname>[.<pool>] [path]
130 Report filesystem disk space usage or inodes usage (with \fB-i\fR) of each
131 MDT/OST, or a subset of OSTs if a pool is specified with \fB-p\fR.  By default
132 print the usage of all mounted Lustre filesystems, otherwise if \fBpath\fR is
133 specified print only the usage of that filesystem.  If \fB-h\fR is given, the
134 output is printed in \fIh\fRuman readable format, using SI base-2 suffixes
135 for \fBM\fRega-, \fBG\fRiga-, \fBT\fRera-, \fBP\fReta-, or \fBE\fRxabytes.
136 The \fB--lazy\fR/\fB-l\fR option skips any OST that is currently disconnected
137 from the client.  This avoids blocking the \fBdf\fR output if an OST is down,
138 and only returns the space on the OSTs that can currently be accessed.
139 .TP
140 .B find
141 To search the directory tree rooted at the given dir/file name for the files that match the given parameters: \fB--atime\fR (file was last accessed N*24 hours ago), \fB--ctime\fR (file's status was last changed N*24 hours ago), \fB--mtime\fR (file's data was last modified N*24 hours ago), \fB--obd\fR (file has an object on a specific OST or OSTs), \fB--size\fR (file has size in bytes, or \fBk\fRilo-, \fBM\fRega-, \fBG\fRiga-, \fBT\fRera-, \fBP\fReta-, or \fBE\fRxabytes if a suffix is given), \fB--type\fR (file has the type: \fBb\fRlock, \fBc\fRharacter, \fBd\fRirectory, \fBp\fRipe, \fBf\fRile, sym\fBl\fRink, \fBs\fRocket, or \fBD\fRoor (Solaris)), \fB--uid\fR (file has specific numeric user ID), \fB--user\fR (file owned by specific user, numeric user ID allowed), \fB--gid\fR (file has specific group ID), \fB--group\fR (file belongs to specific group, numeric group ID allowed), \fB--layout\fR (file has a raid0 layout or is released). The option \fB--maxdepth\fR limits find to decend at most N levels of directory tree. The options \fB--print\fR and \fB--print0\fR print full file name, followed by a newline or NUL character correspondingly.  Using \fB!\fR before an option negates its meaning (\fIfiles NOT matching the parameter\fR).  Using \fB+\fR before a numeric value means \fIfiles with the parameter OR MORE\fR, while \fB-\fR before a numeric value means \fIfiles with the parameter OR LESS\fR.
142 .TP
143 .B getname [-h]|[path ...]
144 Report all the Lustre mount points and the corresponding Lustre filesystem
145 instance. If one or more \fBpath\fR entries are provided, then only the
146 Lustre instance for these mount points is returned. If the path given is not on
147 a Lustre instance 'No such device' is reported.
148 .TP
149 .B osts
150 .RB [ path ]
151 List all the OSTs for all mounted filesystems. If a \fBpath\fR is provided
152 that is located on a lustre mounted file system then only the OSTs belonging
153 to that filesystem are displayed.
154 .TP
155 .B getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v]
156         \fB[--count | -c ] [--index | -i | --offset | -o  ]
157         \fB[--pool | -p ] [--size | -s ] [--directory | -d ]
158         \fB[--layout | -L ] [--fid | -F ] [--generation | -g ]
159         \fB[--recursive | -r ] [--raw | -R ] <dirname|filename>\fR
160 .br
161 List the striping information for a given filename or directory tree.
162 By default the stripe count, size, and offset will be returned. If you
163 only want specific striping information then the options of
164 .BR --count ,
165 .BR --size ,
166 .BR --index ,
167 .BR --offset ,
168 .BR --layout ,
169 .BR --fid ,
170 .BR --generation ,
171 or
172 .B --pool
173 can be used to return only the specific fields.
174 .br
175 If the
176 .B --raw
177 option is specified, the stripe information is printed without substituting the
178 filesystem's default values for unspecified fields. If the striping EA is not
179 set, 0, 0, and -1 will be printed for the stripe count, size, and offset
180 respectively.
181 In the case where you only want details about the files' object id
182 information then the
183 .B --quiet
184 option is used. Additional information available about striping can be
185 displayed with
186 .BR --verbose .
187 The default behavior when a directory is specified is to list the striping
188 information for all files within the specified directory (like
189 .RB ' "ls -l" ') .
190 This can be expanded with
191 .B --recursive
192 which will recurse into all subdirectories.
193 If you wish to get striping information for only the specified directory, then
194 .B --directory
195 can be used to limit the information, like
196 .RB ' "ls -d" ').
197 You can limit the returned files to those with objects on a specific OST with
198 .BR --obd .
199 To show only the FID use
200 .BR --fid .
201 The layout generation can be printed with the
202 .B --generation
203 option.
204 .TP
205 .B setstripe [--stripe-count|-c stripe_count] [--stripe-size|-S stripe_size]
206         \fB[--stripe-index|-i start_ost_index] [--pool <poolname>]
207         \fB[--ost-index|-o <ost_indices>] <dirname|filename>\fR
208 .br
209 To create a new file, or set the directory default, with the specified striping
210 parameters.  The
211 .I stripe_count
212 is the number of OSTs to stripe a file over. A
213 .I stripe_count
214 of 0 means to use the filesystem-wide default stripe count (default 1), and a
215 .I stripe_count
216 of -1 means to stripe over all available OSTs.  The
217 .I stripe_size
218 is the number of bytes to store on each OST before moving to the next OST.  A
219 .I stripe_size
220 of 0 means to use the filesystem-wide default stripe_size (default 1MB).  The
221 .I start_ost_index
222 is the OST index (starting at 0) on which to start striping for this file.  A
223 .I start_ost_index
224 of -1 allows the MDS to choose the starting index and it is strongly
225 recommended, as this allows space and load balancing to be done by the MDS as
226 needed. The
227 .B -o
228 option is used to specify the exact stripe layout on the file system.
229 .I ost_indices
230 is a list of OSTs referenced by their indices, which are specified in decimal
231 or hex form and can be obtained using the
232 .B lfs osts
233 command. The list format consists of individual OST indices and index ranges
234 separated by commas, e.g. 1,2-4,7. The
235 .B -o
236 option may be specified multiple times to stripe across the union of all listed
237 OSTs. If the
238 .B -c
239 option is combined with
240 .B -o
241 the
242 .I stripe_count
243 must agree with the number of OSTs in
244 .IR ost_indices .
245 If the
246 .B -i
247 option is combined with
248 .B -o
249 the
250 .I start_ost_index
251 must be in the OST list, and it will be used as the index on which to start
252 striping the file. Otherwise the striping will occur in the order specified in
253 .IR ost_indices .
254 The
255 .I poolname
256 is the name of a predefined pool of OSTs (see
257 .BR lctl (8))
258 that will be used for striping. The
259 .IR stripe_count ,
260 .IR stripe_size ,
261 and
262 .I start_ost_index
263 will be used as well; the
264 .I start_ost_index
265 must be part of the pool or an error will be returned.
266 .TP
267 .B setstripe -d
268 Delete the default striping on the specified directory.
269 .TP
270 .B fid2path [--link <linkno>] <fsname|rootpath> <fid> ...
271 Print out the pathname(s) for the specified \fIfid\fR(s) from the filesystem
272 mounted at \fBrootpath\fR or named \fBfsname\fR.  If a file has multiple
273 hard links, then all of the pathnames for that file are printed, unless
274 \fB--link\fR limits the printing to only the specified link number (starting
275 at 0, in no particular order).  If multiple fids are specified, but only a
276 single pathname is needed for each file, use \fB--link 0\fR.
277 .TP
278 .B path2fid [--parents] <path> ...
279 Print out the FIDs for the specified \fBpath(s)\fR.  If multiple pathnames
280 are given, then they will be printed one per line with the path as prefix.
281 The \fB--parents\fR switch makes it output the parent FID and name(s) of the
282 given entries. If an entry has multiple links, these are displayed on a single
283 line, tab-separated.
284 .TP
285 .B pool_list
286 .RI { filesystem }[ .poolname "] | {" pathname }
287 List the pools in
288 .I filesystem
289 or
290 .IR pathname ,
291 or the OSTs in
292 .IR filesystem.pool .
293 .TP
294 .B quota [-q] [-v] [-o obd_uuid|-i mdt_idx|-I ost_idx] [-u|-g <uname>|<uid>|<gname>|<gid>] <filesystem>
295 To display disk usage and limits, either for the full filesystem, or for objects on a specific obd. A user or group name or an ID can be specified. If both user and group are omitted quotas for current uid/gid are shown. -v provides more verbose (with per-obd statistics) output. -q disables printing of additional descriptions (including column titles).
296 .TP
297 .B quota -t <-u|-g> <filesystem>
298 To display block and inode grace times for user (-u) or group (-g) quotas
299 .TP
300 .B quotacheck [-ugf] <filesystem> (deprecated as of 2.4.0)
301 To scan the specified filesystem for disk usage, and create or update quota files. Options specify quota for users (-u) groups (-g) and force (-f). Not useful anymore with servers >= 2.4.0 since space accounting is always turned on.
302 .TP
303 .B quotaon [-ugf] <filesystem> (deprecated as of 2.4.0)
304 To turn filesystem quotas on. Options specify quota for users (-u) groups (-g) and force (-f). Not used anymore in lustre 2.4.0 where quota enforcement must be enabled via conf_param (e.g. lctl conf_param ${FSNAME}.quota.<ost|mdt>=<u|g|ug>)
305 .TP
306 .B quotaoff [-ugf] <filesystem> (deprecated as of 2.4.0)
307 To turn filesystem quotas off.  Options specify quota for users (-u) groups (-g) and force (-f). Not used anymore in lustre 2.4.0 where quota enforcement can be turned off (for inode or block) by running the following command on the MGS: lctl conf_param ${FSNAME}.quota.<ost|mdt>=""
308 .TP
309 .B setquota  <-u|-g> <uname>|<uid>|<gname>|<gid> [--block-softlimit <block-softlimit>] [--block-hardlimit <block-hardlimit>] [--inode-softlimit <inode-softlimit>] [--inode-hardlimit <inode-hardlimit>] <filesystem>
310 To set filesystem quotas for users or groups. Limits can be specified with -b, -k, -m, -g, -t, -p suffixes which specify units of 1, 2^10, 2^20, 2^30, 2^40 and 2^50 accordingly. Block limits unit is kilobyte (1024) by default and block limits are always kilobyte-grained (even if specified in bytes), see EXAMPLES
311 .TP
312 .B setquota -t [-u|-g] [--block-grace <block-grace>] [--inode-grace <inode-grace>] <filesystem>
313 To set filesystem quota grace times for users or groups. Grace time is specified in "XXwXXdXXhXXmXXs" format or as an integer seconds value, see EXAMPLES
314 .TP
315 .B swap_layouts <filename1> <filename2>
316 Swap the data (layout and OST objects) of two regular files. The
317 two files have to be in the same filesystem, owned by the same user,
318 reside on the same MDT and writable by the user.
319
320 Swapping the layout of two directories is not permitted.
321 .TP
322 .B data_version [-n] <filename>
323 Display current version of file data. If -n is specified, data version is read
324 without taking lock. As a consequence, data version could be outdated if there
325 is dirty caches on filesystem clients, but this will not force data flushes and
326 has less impact on filesystem.
327
328 Even without -n, race conditions are possible and data version should be
329 checked before and after an operation to be confident the data did not change
330 during it.
331 .TP
332 .B mkdir
333 lfs mkdir is documented in the man page: lfs-mkdir(1). NOTE:
334 .B lfs setdirstripe
335 is an alias of the command
336 .B lfs mkdir
337 .TP
338 .B mv
339 lfs mv is deprecated, use lfs
340 .B migrate
341 instead.
342 .TP
343 .B migrate
344 See lfs-migrate(1).
345 .TP
346 .B --version
347 Output the build version of the lfs utility. Use "lctl lustre_build_version" to get the version of the Lustre kernel modules
348 .TP
349 .B help
350 Provides brief help on the various arguments
351 .TP
352 .B exit/quit
353 Quit the interactive lfs session
354 .SH EXAMPLES
355 .TP
356 .B $ lfs setstripe -s 128k -c 2 /mnt/lustre/file1
357 This creates a file striped on two OSTs with 128kB on each stripe.
358 .TP
359 .B $ lfs setstripe -d /mnt/lustre/dir
360 This deletes a default stripe pattern on dir. New files will use the default striping pattern created therein.
361 .TP
362 .B $ lfs getstripe -v /mnt/lustre/file1
363 Lists the detailed object allocation of a given file
364 .TP
365 .B $ lfs find /mnt/lustre
366 Efficiently lists all files in a given directory and its subdirectories
367 .TP
368 .B $ lfs find /mnt/lustre -mtime +30 -type f -print
369 Recursively list all regular files in given directory more than 30 days old
370 .TP
371 .B $ lfs find --obd OST2-UUID /mnt/lustre/
372 Recursively list all files in a given directory that have objects on OST2-UUID.
373 .tP
374 .B $ lfs check servers
375 Check the status of all servers (MDT, OST)
376 .TP
377 .B $ lfs osts
378 List all the OSTs
379 .TP
380 .B $ lfs mdts
381 List all the MDTs
382 .TP
383 .B $ lfs df -h
384 Lists space usage per OST and MDT in human readable format.
385 .TP
386 .B $ lfs df -i
387 Lists inode usage per OST and MDT
388 .TP
389 .B $ lfs df --pool <filesystem>[.<pool>] | <pathname>
390 List space or inode usage for a specific OST pool
391 .TP
392 .B $ lfs quota -u bob /mnt/lustre
393 List quotas of user `bob'
394 .TP
395 .B $ lfs quota -t -u /mnt/lustre
396 Show grace times for user quotas on /mnt/lustre
397 .TP
398 .B $ lfs quotachown -i /mnt/lustre
399 Change file owner and group
400 .TP
401 .B $ lfs quotacheck -ug /mnt/lustre
402 Quotacheck for user and group - will turn on quotas after making the check.
403 .TP
404 .B $ lfs quotaon -ug /mnt/lustre
405 Turn quotas of user and group on
406 .TP
407 .B $ lfs quotaoff -ug /mnt/lustre
408 Turn quotas of user and group off
409 .TP
410 .B $ lfs setquota -u bob --block-softlimit 2000000 --block-hardlimit 1000000 /mnt/lustre
411 Set quotas of user `bob': 1GB block quota hardlimit and 2 GB block quota softlimit
412 .TP
413 .B $ lfs setquota -t -u --block-grace 1000 --inode-grace 1w4d /mnt/lustre
414 Set grace times for user quotas: 1000 seconds for block quotas, 1 week and 4 days for inode quotas
415 .TP
416 .SH BUGS
417 The \fBlfs find\fR command isn't as comprehensive as \fBfind\fR(1).
418 .SH AUTHOR
419 The lfs command is part of the Lustre filesystem.
420 .SH SEE ALSO
421 .BR lfs-hsm (1),
422 .BR lfs-setdirstripe (1),
423 .BR lfs-getdirstripe (1),
424 .BR lfs-mkdir (1),
425 .BR lfs_migrate (1),
426 .BR lfs-migrate (1),
427 .BR lctl (8),
428 .BR lustre (7)