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