Btrfs-progs: add option to skip whether a scrub has started/resumed in userspace
[platform/upstream/btrfs-progs.git] / man / btrfs.8.in
1 .TH BTRFS 8 "" "btrfs" "btrfs"
2 .\"
3 .\" Man page written by Goffredo Baroncelli <kreijack@inwind.it> (Feb 2010)
4 .\" Modified by Qu Wenruo <quwenruo@cn.fujitsu.com> (Jun 2013)
5 .\"
6 .SH NAME
7 btrfs \- control a btrfs filesystem
8 .SH SYNOPSIS
9 \fBbtrfs\fP \fBsubvolume create\fP [-i \fI<qgroupid>\fP] [\fI<dest>\fP/]\fI<name>\fP
10 .PP
11 \fBbtrfs\fP \fBsubvolume delete\fP \fI<subvolume>\fP [\fI<subvolume>...\fP]
12 .PP
13 \fBbtrfs\fP \fBsubvolume list\fP [\fIoptions\fP] [-G [+|-]\fIvalue\fP] [-C [+|-]\fIvalue\fP] [--sort=rootid,gen,ogen,path] \fI<path>\fP
14 .PP
15 \fBbtrfs\fP \fBsubvolume snapshot\fP [-r] \fI<source>\fP \fI<dest>\fP|[\fI<dest>\fP/]\fI<name>\fP
16 .PP
17 \fBbtrfs\fP \fBsubvolume get-default\fP\fI <path>\fP
18 .PP
19 \fBbtrfs\fP \fBsubvolume set-default\fP\fI <id> <path>\fP
20 .PP
21 \fBbtrfs\fP \fBsubvolume find-new\fP\fI <subvolume> <lastgen>\fP
22 .PP
23 \fBbtrfs\fP \fBsubvolume show\fP\fI <path>\fP
24 .PP
25 .PP
26 \fBbtrfs\fP \fBfilesystem df\fP\fI <path>\fP
27 .PP
28 \fBbtrfs\fP \fBfilesystem show\fP [\fI--mounted\fP|\fI--all-devices\fP|\fI<uuid>\fP]\fP
29 .PP
30 \fBbtrfs\fP \fBfilesystem sync\fP\fI <path> \fP
31 .PP
32 \fBbtrfs\fP \fBfilesystem defragment\fP [\fIoptions\fP] \fI<file>\fP|\fI<dir>\fP [\fI<file>\fP|\fI<dir>...\fP]\fP
33 .PP
34 \fBbtrfs\fP \fBfilesystem resize\fP [\fIdevid\fP:][+/\-]\fI<size>\fP[gkm]|[\fIdevid\fP:]\fImax <path>\fP
35 .PP
36 \fBbtrfs\fP \fBfilesystem label\fP [\fI<device>\fP|\fI<mount_point>\fP] [\fI<newlabel>\fP]
37 .PP
38 .PP
39 \fBbtrfs\fP \fB[filesystem] balance start\fP [\fIoptions\fP] \fI<path>\fP
40 .PP
41 \fBbtrfs\fP \fB[filesystem] balance pause\fP\fI <path>\fP
42 .PP
43 \fBbtrfs\fP \fB[filesystem] balance cancel\fP\fI <path>\fP
44 .PP
45 \fBbtrfs\fP \fB[filesystem] balance resume\fP\fI <path>\fP
46 .PP
47 \fBbtrfs\fP \fB[filesystem] balance status\fP [-v] \fI<path>\fP
48 .PP
49 .PP
50 \fBbtrfs\fP \fBdevice add\fP [-Kf] \fI<device>\fP [\fI<device>...\fP] \fI<path>\fP
51 .PP
52 \fBbtrfs\fP \fBdevice delete\fP \fI<device>\fP [\fI<device>...\fP] \fI<path>\fP
53 .PP
54 \fBbtrfs\fP \fBdevice scan\fP [\fI--all-devices\fP|\fI<device> \P[\fI<device>...\fP]
55 .PP
56 \fBbtrfs\fP \fBdevice ready\fP\fI <device>\fP
57 .PP
58 \fBbtrfs\fP \fBdevice stats\fP [-z] {\fI<path>\fP|\fI<device>\fP}
59 .PP
60 .PP
61 \fBbtrfs\fP \fBscrub start\fP [-BdqrRf] [-c \fIioprio_class\fP -n \fIioprio_classdata\fP] {\fI<path>\fP|\fI<device>\fP}
62 .PP
63 \fBbtrfs\fP \fBscrub cancel\fP {\fI<path>\fP|\fI<device>\fP}
64 .PP
65 \fBbtrfs\fP \fBscrub resume\fP [-BdqrR] [-c \fIioprio_class\fP -n \fIioprio_classdata\fP] {\fI<path>\fP|\fI<device>\fP}
66 .PP
67 \fBbtrfs\fP \fBscrub status\fP [-d] {\fI<path>\fP|\fI<device>\fP}
68 .PP
69 .PP
70 \fBbtrfs\fP \fBcheck\fP [\fIoptions\fP] \fI<device>\fP
71 .PP
72 \fBbtrfs\fP \fBrescue chunk-recover\fP [\fIoptions\fP] \fI<path>\fP
73 .PP
74 \fBbtrfs\fP \fBrescue super-recover\fP [\fIoptions\fP] \fI<path>\fP
75 .PP
76 \fBbtrfs\fP \fBrestore\fP [\fIoptions\fP] \fI<device>\fP
77 .PP
78 .PP
79 \fBbtrfs\fP \fBinspect-internal inode-resolve\fP [-v] \fI<inode>\fP \fI<path>\fP
80 .PP
81 \fBbtrfs\fP \fBinspect-internal logical-resolve\fP [-Pv] [-s \fI<size>\fP] \fI<logical>\fP \fI<path>\fP
82 .PP
83 \fBbtrfs\fP \fBinspect-internal subvolid-resolve\fP \fI<subvolid>\fP \fI<path>\fP
84 .PP
85 \fBbtrfs\fP \fBinspect-internal rootid\fP \fI<path>\fP
86 .PP
87 .PP
88 \fBbtrfs\fP \fBsend\fP [-v] [-p \fI<parent>\fP] [-c \fI<clone-src>\fP] [-f \fI<outfile>\fP] \fI<subvol>\fP
89 .PP
90 \fBbtrfs\fP \fBreceive\fP [-ve] [-f \fI<infile>\fP] \fI<mount>\fP
91 .PP
92 .PP
93 \fBbtrfs\fP \fBquota enable\fP\fI <path>\fP
94 .PP
95 \fBbtrfs\fP \fBquota disable\fP\fI <path>\fP
96 .PP
97 \fBbtrfs\fP \fBquota rescan\fP [-s] \fI<path>\fP
98 .PP
99 .PP
100 \fBbtrfs\fP \fBqgroup assign\fP \fI<src>\fP \fI<dst>\fP \fI<path>\fP
101 .PP
102 \fBbtrfs\fP \fBqgroup remove\fP \fI<src>\fP \fI<dst>\fP \fI<path>\fP
103 .PP
104 \fBbtrfs\fP \fBqgroup create\fP \fI<qgroupid>\fP \fI<path>\fP
105 .PP
106 \fBbtrfs\fP \fBqgroup destroy\fP \fI<qgroupid>\fP \fI<path>\fP
107 .PP
108 \fBbtrfs\fP \fBqgroup show\fP \fI<path>\fP
109 .PP
110 \fBbtrfs\fP \fBqgroup limit\fP [\fIoptions\fP] \fI<size>\fP|\fBnone\fP [\fI<qgroupid>\fP] \fI<path>\fP
111 .PP
112 .PP
113 \fBbtrfs\fP \fBreplace start\fP [-Bfr] \fI<srcdev>\fP|\fI<devid> <targetdev> <mount_point>\fP
114 .PP
115 \fBbtrfs\fP \fBreplace status\fP [-1] \fI<mount_point>\fP
116 .PP
117 \fBbtrfs\fP \fBreplace cancel\fP \fI<mount_point>\fP
118 .PP
119 \fBbtrfs\fP \fBhelp|\-\-help \fP
120 .PP
121 \fBbtrfs\fP \fB<command> \-\-help \fP
122 .PP
123 .SH DESCRIPTION
124 .B btrfs
125 is used to control the filesystem and the files and directories stored. It is
126 the tool to create or destroy a snapshot or a subvolume for the
127 filesystem, to defrag a file or a directory, flush the data to the disk,
128 to resize the filesystem, to scan the device.
129
130 It is possible to abbreviate the commands unless the commands are ambiguous.
131 For example: it is possible to run
132 .I btrfs sub snaps
133 instead of
134 .I btrfs subvolume snapshot.
135 But
136 .I btrfs file s
137 is not allowed, because
138 .I file s
139 may be interpreted both as
140 .I filesystem show
141 and as
142 .I filesystem sync.
143 In this case
144 .I btrfs
145 returns filesystem sync
146 If a command is terminated by
147 .I --help
148 , the detailed help is showed. If the passed command matches more commands,
149 detailed help of all the matched commands is showed. For example
150 .I btrfs dev --help
151 shows the help of all
152 .I device*
153 commands.
154
155 .SH COMMANDS
156 .TP
157
158 \fBsubvolume create\fP [-i \fI<qgroupid>\fP] [\fI<dest>\fP/]\fI<name>\fP
159 Create a subvolume \fI<name>\fR in \fI<dest>\fR.
160 If \fI<dest>\fR is not given subvolume \fI<name>\fR will be created in the
161 current directory.
162 .RS
163
164 \fIOptions\fP
165 .IP "\fB-i\fP \fI<qgroupid>\fR" 5
166 Add the newly created subvolume to a qgroup. This option can be given multiple
167 times.
168 .RE
169 .TP
170
171 \fBsubvolume delete\fR\fI <subvolume> \fP[\fI<subvolume>...\fP]\fR
172 Delete the subvolume \fI<subvolume>\fR. If \fI<subvolume>\fR is not a
173 subvolume, \fBbtrfs\fR returns an error.
174 .TP
175
176 \fBsubvolume list\fR [\fIoptions\fP] [-G [+|-]\fIvalue\fP] [-C [+|-]\fIvalue\fP] [--sort=rootid,gen,ogen,path] \fI<path>\fR
177
178 List the subvolumes present in the filesystem \fI<path>\fR. For every
179 subvolume the following information is shown by default.
180 ID \fI<ID>\fP top level \fI<ID>\fP path \fI<path>\fP
181 where path is the relative path of the subvolume to the \fItop level\fR
182 subvolume.
183
184 The subvolume's ID may be used by the \fBsubvolume set-default\fR command, or
185 at mount time via the \fIsubvolid=\fR option.
186 If \fI-p\fR is given, then \fIparent <ID>\fR is added to the output between ID
187 and top level. The parent's ID may be used at mount time via the
188 \fIsubvolrootid=\fR option.
189 .RS
190
191 \fIOptions\fP
192 .IP "\fB-p\fP" 5
193 print parent ID.
194 .IP "\fB-a\fP" 5
195 print all the subvolumes in the filesystem and distinguish between
196 absolute and relative path with respect to the given \fI<path>\fP.
197 .IP "\fB-c\fP" 5
198 print the ogeneration of the subvolume, aliases: ogen or origin generation.
199 .IP "\fB-g\fP" 5
200 print the generation of the subvolume.
201 .IP "\fB-o\fP" 5
202 print only subvolumes bellow specified <path>.
203 .IP "\fB-u\fP" 5
204 print the UUID of the subvolume.
205 .IP "\fB-q\fP" 5
206 print the parent uuid of subvolumes (and snapshots).
207 .IP "\fB-t\fP" 5
208 print the result as a table.
209 .IP "\fB-s\fP" 5
210 only snapshot subvolumes in the filesystem will be listed.
211 .IP "\fB-r\fP" 5
212 only readonly subvolumes in the filesystem will be listed.
213 .IP "\fB-G [+|-]\fIvalue\fP\fP" 5
214 list subvolumes in the filesystem that its generation is
215 >=, <= or = \fIvalue\fP. '+' means >= \fIvalue\fP, '-' means <= \fIvalue\fP, If there is
216 neither '+' nor '-', it means = \fIvalue\fP.
217 .IP "\fB-C [+|-]\fIvalue\fP" 5
218 list subvolumes in the filesystem that its ogeneration is
219 >=, <= or = \fIvalue\fP. The usage is the same to '-g' option.
220 .IP "\fB--sort=rootid,gen,ogen,path\fP" 5
221 list subvolumes in order by specified items.
222 you can add '+' or '-' in front of each items, '+' means ascending, '-'
223 means descending. The default is ascending.
224
225 for \fB--sort\fP you can combine some items together by ',', just like
226 \f--sort=+ogen,-gen,path,rootid\fR.
227 .RE
228 .TP
229
230 \fBsubvolume snapshot\fP [-r] \fI<source>\fP \fI<dest>\fP|[\fI<dest>\fP/]\fI<name>\fP
231 Create a writable/readonly snapshot of the subvolume \fI<source>\fR with the
232 name \fI<name>\fR in the \fI<dest>\fR directory.
233 If only \fI<dest>\fR is given, the subvolume will be named the basename of \fI<source>\fR.
234 If \fI<source>\fR is not a subvolume, \fBbtrfs\fR returns an error.
235 If \fI-r\fR is given, the snapshot will be readonly.
236 .TP
237
238 \fBsubvolume get-default\fR\fI <path>\fR
239 Get the default subvolume of the filesystem \fI<path>\fR. The output format
240 is similar to \fBsubvolume list\fR command.
241 .TP
242
243 \fBsubvolume set-default\fR\fI <id> <path>\fR
244 Set the subvolume of the filesystem \fI<path>\fR which is mounted as
245 \fIdefault\fR. The subvolume is identified by \fI<id>\fR, which
246 is returned by the \fBsubvolume list\fR command.
247 .TP
248
249 \fBsubvolume find-new\fR\fI <subvolume> <last_gen>\fR
250 List the recently modified files in a subvolume, after \fI<last_gen>\fR ID.
251 .TP
252
253 \fBsubvolume show\fR\fI <path>\fR
254 Show information of a given subvolume in the \fI<path>\fR.
255 .TP
256
257 \fBfilesystem df\fP\fI <path>\fR
258 Show space usage information for a mount point.
259 .TP
260
261 \fBfilesystem show\fR [\fI--mounted\fP|\fI--all-devices\fP|\fI<uuid>\fR]\fR
262 Show the btrfs filesystem with some additional info. If no option or \fIUUID\fP
263 is passed, \fBbtrfs\fR shows information of all the btrfs filesystem both mounted
264 and unmounted.
265 If \fB--mounted\fP is passed, it would probe btrfs kernel to list mounted btrfs filesystem(s);
266 If \fB--all-devices\fP is passed, all the devices under /dev are scanned;
267 otherwise the devices list is extracted from the /proc/partitions file.
268 .TP
269
270 \fBfilesystem sync\fR\fI <path> \fR
271 Force a sync for the filesystem identified by \fI<path>\fR.
272 .TP
273
274 \fBfilesystem defragment\fP [\fIoptions\fP] \fI<file>\fP|\fI<dir>\fP [\fI<file>\fP|\fI<dir>...\fP]\fP
275 Defragment file data and/or directory metadata. If \fB-r\fP is passed, 
276 files in \fIdir\fR will be defragmented recursively.
277
278
279 The start position and the number of bytes to defragment can be specified by
280 \fIstart\fR and \fIlen\fR. Any extent bigger than threshold will be
281 considered already defragged. Use 0 to take the kernel default, and use 1 to
282 say every single extent must be rewritten. You can also turn on compression in
283 defragment operations.
284 .RS
285
286 \fIOptions\fR
287 .IP "\fB-v\fP" 5
288 be verbose
289 .IP "\fB-c\fP" 5
290 compress file contents while defragmenting
291 .IP "\fB-r\fP" 5
292 defragment files recursively
293 .IP "\fB-f\fP" 5
294 flush filesystem after defragmenting
295 .IP "\fB-s \fIstart\fP\fP" 5
296 defragment only from byte \fIstart\fR onward
297 .IP "\fB-l \fIlen\fP\fP" 5
298 defragment only up to \fIlen\fR bytes
299 .IP "\fB-t \fIsize\fP\fP" 5
300 defragment only files at least \fIsize\fR bytes big
301
302 For \fBstart\fP, \fBlen\fP, \fBsize\fP it is possible to append a suffix
303 like \fBk\fP for 1 KBytes, \fBm\fP for 1 MBytes...
304
305 NOTE: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of data,
306 don't use it if you use snapshots, have de-duplicated your data or made
307 copies with \fBcp --reflink\fP.
308 .RE
309 .TP
310
311 .\"
312 .\" Some wording are extracted by the resize2fs man page
313 .\"
314 \fBfilesystem resize\fP [\fIdevid\fP:][+/\-]\fI<size>\fP[gkm]|[\fIdevid\fP:]\fImax <path>\fR
315 Resize a filesystem identified by \fI<path>\fR for the underlying device
316 \fIdevid\fR.  The \fIdevid\fR can be found with \fBbtrfs filesystem show\fR and
317 defaults to 1 if not specified.
318 The \fI<size>\fR parameter specifies the new size of the filesystem.
319 If the prefix \fI+\fR or \fI\-\fR is present the size is increased or decreased
320 by the quantity \fI<size>\fR.
321 If no units are specified, the unit of the \fI<size>\fR parameter defaults to
322 bytes. Optionally, the size parameter may be suffixed by one of the following
323 units designators: 'K', 'M', or 'G', kilobytes, megabytes, or gigabytes,
324 respectively.
325
326 If 'max' is passed, the filesystem will occupy all available space on the
327 device \fIdevid\fR.
328
329 The \fBresize\fR command \fBdoes not\fR manipulate the size of underlying
330 partition.  If you wish to enlarge/reduce a filesystem, you must make sure you
331 can expand the partition before enlarging the filesystem and shrink the
332 partition after reducing the size of the filesystem.  This can done using
333 \fBfdisk(8)\fR or \fBparted(8)\fR to delete the existing partition and recreate
334 it with the new desired size.  When recreating the partition make sure to use
335 the same starting disk cylinder as before.
336 .TP
337
338 \fBfilesystem label\fP [\fI<dev>\fP|\fI<mount_point>\fP] [\fInewlabel\fP]\fP
339 Show or update the label of a filesystem. \fI[<device>|<mountpoint>]\fR is used
340 to identify the filesystem. 
341 If a \fInewlabel\fR optional argument is passed, the label is changed. The
342 following constraints exist for a label:
343 .IP
344 - the maximum allowable length shall be less than 256 chars
345 .TP
346
347 \fB[filesystem] balance start\fR [\fIoptions\fP] \fI<path>\fR
348 Balance chunks across the devices
349 Balance and/or convert (change allocation profile of) chunks that
350 passed all \fIfilters\fR in a comma-separated list of filters for a
351 particular chunk type.
352 If filter list is not given balance all chunks of that type.
353 In case none of the \fI-d\fR, \fI-m\fR or \fI-s\fR options is
354 given balance all chunks in a filesystem.
355 .RS
356
357 \fIOptions\fR
358 .IP "\fB-d[\fIfilters\fP]\fR" 5
359 act on data chunks
360 .IP "\fB-m[\fIfilters\fP]\fR" 5
361 act on metadata chunks
362 .IP "\fB-s[\fIfilters\fP]\fR" 5
363 act on system chunks (only under -f)
364 .IP "\fB-v\fP" 5
365 be verbose
366 .IP "\fB-f\fP" 5
367 force reducing of metadata integrity
368 .RE
369 .TP
370
371 \fB[filesystem] balance pause\fR\fI <path>\fR
372 Pause running balance.
373 .TP
374
375 \fB[filesystem] balance cancel\fR\fI <path>\fR
376 Cancel running or paused balance.
377 .TP
378
379 \fB[filesystem] balance resume\fR\fI <path>\fR
380 Resume interrupted balance.
381 .TP
382
383 \fB[filesystem] balance status\fR [-v] \fI<path>\fR
384 Show status of running or paused balance.
385 .RS
386
387 \fIOptions\fR
388 .IP "\fB-v\fP" 5
389 be verbose
390 .RE
391 .TP
392
393 \fBdevice add\fR\fI [-Kf] <dev> \fP[\fI<dev>...\fP] \fI<path>\fR
394 Add device(s) to the filesystem identified by \fI<path>\fR.
395 If applicable, a whole device discard (TRIM) operation is performed.
396 .RS
397
398 \fIOptions\fR
399 .IP "\fB-K|--nodiscard\fP" 5
400 do not perform discard by default
401 .IP "\fB-f|--force\fP" 5
402 force overwrite of existing filesystem on the given disk(s)
403 .RE
404 .TP
405
406 \fBdevice delete\fR\fI <dev> \fP[\fI<dev>...\fP] \fI<path>\fR
407 Remove device(s) from a filesystem identified by \fI<path>\fR.
408 .TP
409
410 \fBdevice scan\fR [--all-devices|\fI<device> \fP[\fI<device>...\fP]\fR
411 If one or more devices are passed, these are scanned for a btrfs filesystem. 
412 If no devices are passed, \fBbtrfs\fR uses block devices containing btrfs
413 filesystem as listed by blkid.
414 Finally, if \fB--all-devices\fP is passed, all the devices under /dev are 
415 scanned.
416 .TP
417
418 \fBdevice ready\fR \fI<device>\fR
419 Check device to see if it has all of it's devices in cache for mounting.
420 .TP
421
422 \fBdevice stats\fP [-z] {\fI<path>\fP|\fI<device>\fP}
423 Read and print the device IO stats for all devices of the filesystem
424 identified by \fI<path>\fR or for a single \fI<device>\fR.
425 .RS
426
427 \fIOptions\fR
428 .IP "\fB-z\fP" 5
429 Reset stats to zero after reading them.
430 .RE
431 .TP
432
433 \fBscrub start\fP [-BdqrR] [-c \fIioprio_class\fP -n \fIioprio_classdata\fP] {\fI<path>\fP|\fI<device>\fP}
434 Start a scrub on all devices of the filesystem identified by \fI<path>\fR or on
435 a single \fI<device>\fR. Without options, scrub is started as a background
436 process. Progress can be obtained with the \fBscrub status\fR command. Scrubbing
437 involves reading all data from all disks and verifying checksums. Errors are
438 corrected along the way if possible.
439 .IP
440 The default IO priority of scrub is the idle class. The priority can be configured similar to the
441 .BR ionice (1)
442 syntax.
443 .RS
444
445 \fIOptions\fR
446 .IP "\fB-B\fP" 5
447 Do not background and print scrub statistics when finished.
448 .IP "\fB-d\fP" 5
449 Print separate statistics for each device of the filesystem (-B only).
450 .IP "\fB-q\fP" 5
451 Quiet. Omit error messages and statistics.
452 .IP "\fB-r\fP" 5
453 Read only mode. Do not attempt to correct anything.
454 .IP "\fB-R\fP" 5
455 Raw print mode. Print full data instead of summary.
456 .IP "\fB-c \fIioprio_class\fP" 5
457 Set IO priority class (see
458 .BR ionice (1)
459 manpage).
460 .IP "\fB-n \fIioprio_classdata\fP" 5
461 Set IO priority classdata (see
462 .BR ionice (1)
463 manpage).
464 .IP "\fB-f\fP" 5
465 force to check whether scrub has started or resumed in userspace.
466 this is useful when scrub stat record file is damaged.
467 .RE
468 .TP
469
470 \fBscrub cancel\fP {\fI<path>\fP|\fI<device>\fP}
471 If a scrub is running on the filesystem identified by \fI<path>\fR, cancel it.
472 Progress is saved in the scrub progress file and scrubbing can be resumed later
473 using the \fBscrub resume\fR command.
474 If a \fI<device>\fR is given, the corresponding filesystem is found and
475 \fBscrub cancel\fP behaves as if it was called on that filesystem.
476 .TP
477
478 \fBscrub resume\fP [-BdqrR] [-c ioprio_class -n ioprio_classdata] {\fI<path>\fP|\fI<device>\fP}
479 Resume a canceled or interrupted scrub cycle on the filesystem identified by
480 \fI<path>\fR or on a given \fI<device>\fR. Does not start a new scrub if the
481 last scrub finished successfully.
482 .RS
483
484 \fIOptions\fR
485 .TP
486 see \fBscrub start\fP.
487 .RE
488 .TP
489
490 \fBscrub status\fP [-d] {\fI<path>\fP|\fI<device>\fP}
491 Show status of a running scrub for the filesystem identified by \fI<path>\fR or
492 for the specified \fI<device>\fR.
493 If no scrub is running, show statistics of the last finished or canceled scrub
494 for that filesystem or device.
495 .RS
496
497 \fIOptions\fR
498 .IP "\fB-d\fP" 5
499 Print separate statistics for each device of the filesystem.
500 .RE
501 .TP
502
503 \fBcheck\fR [\fIoptions\fP] <device>\fR
504 Check an unmounted btrfs filesystem.
505 .RS
506
507 \fIOptions\fR
508 .IP "\fB-s|--support \fI<superblock>\fP\fR" 5
509 use this superblock copy.
510 .IP "\fB--repair\fP" 5
511 try to repair the filesystem.
512 .IP "\fB--init-csum-tree\fP" 5
513 create a new CRC tree.
514 .IP "\fB--init-extent-tree\fP" 5
515 create a new extent tree.
516 .RE
517 .TP
518
519 \fBrescue chunk-recover\fR [\fIoptions\fP] <device>\fR
520 Recover the chunk tree by scanning the devices one by one.
521 .RS
522
523 \fIOptions\fR
524 .IP "\fB-y\fP" 5
525 assume an answer of 'yes' to all questions.
526 .IP "\fB-v\fP" 5
527 verbose mode.
528 .IP "\fB-h\fP" 5
529 help.
530 .RE
531 .TP
532
533 \fBrescue super-recover\fR [\fIoptions\fP] <device>\fR
534 Recover bad superblocks from good copies.
535 .RS
536
537 \fIOptions\fR
538 .IP "\fB-y\fP" 5
539 assume an answer of 'yes' to all questions.
540 .IP "\fB-v\fP" 5
541 verbose mode.
542 .RE
543 .TP
544
545 \fBrestore\fR [\fIoptions\fP] <device>\fR
546 Try to restore files from a damaged filesystem(unmounted).
547 .RS
548
549 \fIOptions\fR
550 .IP "\fB-s\fP" 5
551 get snapshots.
552 .IP "\fB-x\fP" 5
553 get extended attributes.
554 .IP "\fB-v\fP" 5
555 verbose.
556 .IP "\fB-i\fP" 5
557 ignore errors.
558 .IP "\fB-o\fP" 5
559 overwrite.
560 .IP "\fB-t \fI<location>\fP\fP" 5
561 tree location.
562 .IP "\fB-f \fI<offset>\fP\fP" 5
563 filesystem location.
564 .IP "\fB-u \fI<block>\fP\fP" 5
565 super mirror.
566 .IP "\fB-r \fI<rootid>\fP\fP" 5
567 root objectid.
568 .IP "\fB-d\fP" 5
569 find dir.
570 .IP "\fB-l\fP" 5
571 list tree roots.
572 .RE
573 .TP
574
575 \fBinspect-internal inode-resolve\fP [-v] \fI<inode>\fP \fI<path>\fP
576 Resolves an <inode> in subvolume <path> to all filesystem paths.
577 .RS
578
579 \fIOptions\fR
580 .IP "\fB-v\fP" 5
581 verbose mode. print count of returned paths and ioctl() return value
582 .RE
583 .TP
584
585 \fBinspect-internal logical-resolve\fP [-Pv] [-s bufsize] \fI<logical>\fP \fI<path>\fP
586 Resolves a <logical> address in the filesystem mounted at <path> to all inodes.
587 By default, each inode is then resolved to a file system path (similar to the
588 \fBinode-resolve\fP subcommand).
589 .RS
590
591 \fIOptions\fR
592 .IP "\fB-P\fP" 5
593 skip the path resolving and print the inodes instead
594 .IP "\fB-v\fP" 5
595 verbose mode. print count of returned paths and all ioctl() return values
596 .IP "\fB-s \fI<bufsize>\fP" 5
597 set inode container's size. This is used to increase inode container's size in case it is
598 not enough to read all the resolved results. The max value one can set is 64k.
599 .RE
600 .TP
601
602 \fBinspect-internal subvolid-resolve\fP \fI<subvolid> <path>\fP
603 Get file system paths for the given subvolume ID.
604 .TP
605
606 \fBinspect-internal rootid\fP \fI<path>\fP
607 For a given file or directory, return the containing tree root id. For a
608 subvolume return it's own tree id.
609
610 The result is undefined for the so-called empty subvolumes (identified by inode number 2).
611 .TP
612
613 \fBsend\fP [-v] [-p \fI<parent>\fP] [-c \fI<clone-src>\fP] [-f \fI<outfile>\fP] \fI<subvol>\fP
614 Send the subvolume to stdout.
615 Sends the subvolume specified by \fI<subvol>\fR to stdout.
616 By default, this will send the whole subvolume. To do an incremental
617 send, use '\fI-p <parent>\fR'. If you want to allow btrfs to clone from
618 any additional local snapshots, use '\fI-c <clone-src>\fR' (multiple times
619 where applicable). You must not specify clone sources unless you
620 guarantee that these snapshots are exactly in the same state on both
621 sides, the sender and the receiver. It is allowed to omit the
622 '\fI-p <parent>\fR' option when '\fI-c <clone-src>\fR' options are given, in
623 which case '\fBbtrfs send\fP' will determine a suitable parent among the
624 clone sources itself.
625 .RS
626
627 \fIOptions\fR
628 .IP "\fB-v\fP" 5
629 Enable verbose debug output. Each occurrence of this option increases the
630 verbose level more.
631 .IP "\fB-p \fI<parent>\fP" 5
632 Send an incremental stream from \fI<parent>\fR to \fI<subvol>\fR.
633 .IP "\fB-c \fI<clone-src>\fP" 5
634 Use this snapshot as a clone source for an incremental send (multiple allowed).
635 .IP "\fB-f \fI<outfile>\fP" 5
636 Output is normally written to stdout. To write to a file, use this option.
637 An alternative would be to use pipes.
638 .RE
639 .TP
640
641 \fBreceive\fP [-ve] [-f \fI<infile>\fR] \fI<mount>\fR
642 Receive subvolumes from stdin.
643 Receives one or more subvolumes that were previously
644 sent with btrfs send. The received subvolumes are stored
645 into \fI<mount>\fP.
646 btrfs receive will fail in case a receiving subvolume
647 already exists. It will also fail in case a previously
648 received subvolume was changed after it was received.
649 After receiving a subvolume, it is immediately set to
650 read only.
651 .RS
652
653 \fIOptions\fR
654 .IP "\fB-v\fP" 5
655 Enable verbose debug output. Each occurrence of this option increases the
656 verbose level more.
657 .IP "\fB-f \fI<infile>\fR" 5
658 By default, btrfs receive uses stdin to receive the subvolumes.
659 Use this option to specify a file to use instead.
660 .IP "\fB-e\fP" 5
661 Terminate after receiving an <end cmd> in the data stream.
662 Without this option, the receiver terminates only if an error is recognized or on EOF.
663 .RE
664 .TP
665
666 \fBquota enable\fR \fI<path>\fR
667 Enable subvolume quota support for a filesystem.
668 .TP
669
670 \fBquota disable\fR \fI<path>\fR
671 Disable subvolume quota support for a filesystem.
672 .TP
673
674 \fBquota rescan\fR [-s] \fI<path>\fR
675 Trash all qgroup numbers and scan the metadata again with the current config.
676 .RS
677
678 \fIOptions\fR
679 .IP "\fB-s\fP" 5
680 show status of a running rescan operation.
681 .RE
682 .TP
683
684 \fBqgroup assign\fP \fI<src> <dst> <path>\fP
685 Enable subvolume qgroup support for a filesystem.
686 .TP
687
688 \fBqgroup remove\fP \fI<src> <dst> <path>\fP
689 Remove a subvol from a quota group.
690 .TP
691
692 \fBqgroup create\fP \fI<qgroupid> <path>\fP
693 Create a subvolume quota group.
694 .TP
695
696 \fBqgroup destroy\fP \fI<qgroupid> <path>\fP
697 Destroy a subvolume quota group.
698 .TP
699
700 \fBqgroup show\fP \fI<path>\fP
701 Show all subvolume quota groups.
702 .TP
703
704 \fBqgroup limit\fP [\fIoptions\fP] \fI<size>\fP|\fBnone\fP [\fI<qgroupid>\fP] \fI<path>\fP
705 Limit the size of a subvolume quota group.
706 .TP
707
708 \fBreplace start\fR [-Bfr] \fI<srcdev>\fP|\fI<devid> <targetdev> <path>\fR
709 Replace device of a btrfs filesystem.
710 On a live filesystem, duplicate the data to the target device which
711 is currently stored on the source device. If the source device is not
712 available anymore, or if the \fB-r\fR option is set, the data is built
713 only using the RAID redundancy mechanisms. After completion of the
714 operation, the source device is removed from the filesystem.
715 If the \fI<srcdev>\fR is a numerical value, it is assumed to be the device id
716 of the filesystem which is mounted at mount_point, otherwise is is
717 the path to the source device. If the source device is disconnected,
718 from the system, you have to use the \fIdevid\fR parameter format.
719 The \fI<targetdev>\fP needs to be same size or larger than the \fI<srcdev>\fR.
720 .RS
721
722 \fIOptions\fR
723 .IP "\fB-r\fP" 5
724 only read from \fI<srcdev>\fR if no other zero-defect mirror exists (enable
725 this if your drive has lots of read errors, the access would be very slow)
726 .IP "\fB-f\fP" 5
727 force using and overwriting \fI<targetdev>\fR even if it looks like
728 containing a valid btrfs filesystem. A valid filesystem is
729 assumed if a btrfs superblock is found which contains a
730 correct checksum. Devices which are currently mounted are
731 never allowed to be used as the \fI<targetdev>\fR
732 .IP "\fB-B\fP" 5
733 do not background
734 .RE
735 .TP
736
737 \fBreplace status\fR [-1] \fI<mount_point>\fR
738 Print status and progress information of a running device replace operation.
739 .RS
740
741 \fIOptions\fR
742 .IP "\fB-1\fP" 5
743 print once instead of print continuously until the replace
744 operation finishes (or is canceled)
745 .RE
746 .TP
747
748 \fBreplace cancel\fR \fI<mount_point>\fR
749 Cancel a running device replace operation.
750 .RE
751
752 .SH EXIT STATUS
753 \fBbtrfs\fR returns a zero exist status if it succeeds. Non zero is returned in
754 case of failure.
755
756 .SH AVAILABILITY
757 .B btrfs
758 is part of btrfs-progs. Btrfs filesystem is currently under heavy development,
759 and not suitable for any uses other than benchmarking and review.
760 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
761 further details.
762 .SH SEE ALSO
763 .BR mkfs.btrfs (8),
764 .BR ionice (1)