summaryrefslogtreecommitdiff
path: root/Documentation/btrfs-filesystem.txt
blob: e3e270ff0957db903b8d2247174ce78be0091c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
btrfs-filesystem(8)
===================

NAME
----
btrfs-filesystem - control btrfs filesystem

SYNOPSIS
--------
*btrfs filesystem* <subcommand> <args>

DESCRIPTION
-----------
*btrfs filesystem* is used to do the filesystem level control jobs, including
all the regular filesystem operations like setting/getting label,
resizing, defragment.

SUBCOMMAND
----------
*df* <path> [<path>...]::
Show space usage information for a mount point.

*show* [--mounted|--all-devices|<path>|<uuid>|<device>|<label>]::
Show the btrfs filesystem with some additional info.
+
If no option nor <path>|<uuid>|<device>|<label> is passed, btrfs shows
information of all the btrfs filesystem both mounted and unmounted.
If '--mounted' is passed, it would probe btrfs kernel to list mounted btrfs
filesystem(s);
If '--all-devices' is passed, all the devices under /dev are scanned;
otherwise the devices list is extracted from the /proc/partitions file.

*sync* <path>::
Force a sync for the filesystem identified by <path>.

*defragment* [options] <file>|<dir> [<file>|<dir>...]::
Defragment file data and/or directory metadata *online*.
+
If '-r' is passed, files in dir will be defragmented recursively.
The start position and the number of bytes to defragment can be specified by
start and len using '-s' and '-l' options below.
Any extent bigger than threshold given by '-t' option, will be considered
already defragged.
Use 0 to take the kernel default, and use 1 to
say every single extent must be rewritten.
You can also turn on compression in defragment operations.
+
`Options`
+
-v::::
be verbose
-c::::
compress file contents while defragmenting
-r::::
defragment files recursively
-f::::
flush filesystem after defragmenting
-s <start>::::
defragment only from byte <start> onward
-l <len>::::
defragment only up to <len> bytes
-t <size>::::
defragment only files at least <size> bytes big
+
For <start>, <len>, <size> it is possible to append a suffix
like 'k' for 1 KBytes, 'm' for 1 MBytes...
+
WARNING: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of data,
don't use it if you use snapshots, have de-duplicated your data or made
copies with `cp --reflink`.

// Some wording are extracted by the resize2fs man page
*resize* [<devid>:][+/-]<size>[gkm]|[<devid>:]max <path>::
Resize a filesystem identified by <path> for the underlying device
devid *online*. +
The devid can be found with *btrfs filesystem show* and
defaults to 1 if not specified.
The <size> parameter specifies the new size of the filesystem.
If the prefix + or - is present the size is increased or decreased
by the quantity <size>.
If no units are specified, the unit of the <size> parameter defaults to
bytes. Optionally, the size parameter may be suffixed by one of the following
units designators: \'K\', \'M', or \'G', kilobytes, megabytes, or gigabytes,
respectively.
+
If \'max' is passed, the filesystem will occupy all available space on the
device devid.
+
The resize command does not manipulate the size of underlying
partition.  If you wish to enlarge/reduce a filesystem, you must make sure you
can expand the partition before enlarging the filesystem and shrink the
partition after reducing the size of the filesystem.  This can done using
`fdisk`(8) or `parted`(8) to delete the existing partition and recreate
it with the new desired size.  When recreating the partition make sure to use
the same starting disk cylinder as before.

*label* [<dev>|<mountpoint>] [<newlabel>]::
Show or update the label of a filesystem.
+
[<device>|<mountpoint>] is used to identify the filesystem. 
If a newlabel optional argument is passed, the label is changed.
NOTE: the maximum allowable length shall be less than 256 chars

EXIT STATUS
-----------
*btrfs filesystem* returns a zero exist status if it succeeds. Non zero is
returned in case of failure.

AVAILABILITY
------------
*btrfs* is part of btrfs-progs. Btrfs filesystem is currently under heavy
development,
and not suitable for any uses other than benchmarking and review.
Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
further details.

SEE ALSO
--------
`mkfs.btrfs`(8),