1
- From kernel 3.3 onwards, btrfs balance can limit its action to a subset of the
1
+ From kernel 3.3 onwards, BTRFS balance can limit its action to a subset of the
2
2
whole filesystem, and can be used to change the replication configuration (e.g.
3
- moving data from single to RAID1). This functionality is accessed through the
4
- *-d *, *-m * or *-s * options to btrfs balance start, which filter on data,
5
- metadata and system blocks respectively.
3
+ convert data from ``single `` to ``RAID1 ``).
6
4
7
- A filter has the following structure: * type[=params][,type=...] *
5
+ Balance can be limited to a block group profile with the following options:
8
6
9
- The available types are:
7
+ * ``-d `` for data block groups
8
+ * ``-m `` for metadata block groups (also implicitly applies to *-s *)
9
+ * ``-s `` for system block groups
10
+
11
+ The options have an optional parameter which means that the parameter must start
12
+ right after the option without a space (this is mandatory getopt syntax), like
13
+ ``-dusage=10 ``. Options for all block group types can be specified in one command.
14
+
15
+ A filter has the following structure: ``filter[=params][,filter=...] ``
16
+
17
+ To combine multiple filters use ``, ``, without spaces. Example: ``-dconvert=raid1,soft ``
18
+
19
+ BTRFS can have different profiles on a single device or the same profile on
20
+ multiple device.
21
+
22
+ The main reason why you want to have different profiles for data and metadata
23
+ is to provide additional protection of the filesystem's metadata when devices fail,
24
+ since a single sector of unrecoverable metadata will break the filesystem,
25
+ while a single sector of lost data can be trivially recovered by deleting the broken file.
26
+
27
+ Before changing profiles, make sure there is enough unallocated space on
28
+ existing drives to create new metadata block groups (for filesystems
29
+ over 50GiB, this is ``1GB * (number_of_devices + 2)) ``.
30
+
31
+ Default profiles on BTRFS are:
32
+
33
+ * data: ``single ``
34
+ * metadata:
35
+ * single devices: ``dup ``
36
+ * multiple devices: ``raid1 ``
37
+
38
+
39
+ The available filter types are:
40
+
41
+ Filter types
42
+ ^^^^^^^^^^^^
10
43
11
44
profiles=<profiles>
12
45
Balances only block groups with the given profiles. Parameters
13
- are a list of profile names separated by "* | *" (pipe).
46
+ are a list of profile names separated by `` | `` (pipe).
14
47
15
48
usage=<percent>, usage=<range>
16
49
Balances only block groups with usage under the given percentage. The
17
50
value of 0 is allowed and will clean up completely unused block groups, this
18
51
should not require any new work space allocated. You may want to use *usage=0 *
19
52
in case balance is returning ENOSPC and your filesystem is not too full.
20
53
21
- The argument may be a single value or a range. The single value * N * means *at
22
- most N percent used *, equivalent to * ..N * range syntax. Kernels prior to 4.4
54
+ The argument may be a single value or a range. The single value `` N `` means *at
55
+ most N percent used *, equivalent to `` ..N `` range syntax. Kernels prior to 4.4
23
56
accept only the single value format.
24
57
The minimum range boundary is inclusive, maximum is exclusive.
25
58
@@ -29,44 +62,44 @@ devid=<id>
29
62
30
63
drange=<range>
31
64
Balance only block groups which overlap with the given byte range on any
32
- device. Use in conjunction with * devid * to filter on a specific device. The
33
- parameter is a range specified as * start..end * .
65
+ device. Use in conjunction with `` devid `` to filter on a specific device. The
66
+ parameter is a range specified as `` start..end `` .
34
67
35
68
vrange=<range>
36
69
Balance only block groups which overlap with the given byte range in the
37
70
filesystem's internal virtual address space. This is the address space that
38
71
most reports from btrfs in the kernel log use. The parameter is a range
39
- specified as * start..end * .
72
+ specified as `` start..end `` .
40
73
41
74
convert=<profile>
42
75
Convert each selected block group to the given profile name identified by
43
76
parameters.
44
77
45
78
.. note ::
46
- Starting with kernel 4.5, the * data * chunks can be converted to/from the
47
- * DUP * profile on a single device.
79
+ Starting with kernel 4.5, the `` data `` chunks can be converted to/from the
80
+ `` DUP `` profile on a single device.
48
81
49
82
.. note ::
50
- Starting with kernel 4.6, all profiles can be converted to/from * DUP * on
83
+ Starting with kernel 4.6, all profiles can be converted to/from `` DUP `` on
51
84
multi-device filesystems.
52
85
53
86
limit=<number>, limit=<range>
54
87
Process only given number of chunks, after all filters are applied. This can be
55
- used to specifically target a chunk in connection with other filters (* drange * ,
56
- * vrange * ) or just simply limit the amount of work done by a single balance run.
88
+ used to specifically target a chunk in connection with other filters (`` drange `` ,
89
+ `` vrange `` ) or just simply limit the amount of work done by a single balance run.
57
90
58
- The argument may be a single value or a range. The single value * N * means *at
59
- most N chunks *, equivalent to * ..N * range syntax. Kernels prior to 4.4 accept
91
+ The argument may be a single value or a range. The single value `` N `` means *at
92
+ most N chunks *, equivalent to `` ..N `` range syntax. Kernels prior to 4.4 accept
60
93
only the single value format. The range minimum and maximum are inclusive.
61
94
62
95
stripes=<range>
63
96
Balance only block groups which have the given number of stripes. The parameter
64
- is a range specified as * start..end * . Makes sense for block group profiles that
97
+ is a range specified as `` start..end `` . Makes sense for block group profiles that
65
98
utilize striping, i.e. RAID0/10/5/6. The range minimum and maximum are
66
99
inclusive.
67
100
68
101
soft
69
- Takes no parameters. Only has meaning when converting between profiles.
102
+ Takes no parameters. Only has meaning when converting between profiles, or
70
103
When doing convert from one profile to another and soft mode is on,
71
104
chunks that already have the target profile are left untouched.
72
105
This is useful e.g. when half of the filesystem was converted earlier but got
76
109
For example, this means that we can convert metadata chunks the "hard" way
77
110
while converting data chunks selectively with soft switch.
78
111
79
- Profile names, used in *profiles * and *convert * are one of: *raid0 *, *raid1 *,
80
- *raid1c3 *, *raid1c4 *, *raid10 *, *raid5 *, *raid6 *, *dup *, *single *. The mixed
81
- data/metadata profiles can be converted in the same way, but it's conversion
112
+ Profile names, used in ``profiles `` and ``convert `` are one of:
113
+
114
+ * ``raid0 ``
115
+ * ``raid1 ``
116
+ * ``raid1c3 ``
117
+ * ``raid1c4 ``
118
+ * ``raid10 ``
119
+ * ``raid5 ``
120
+ * ``raid6 ``
121
+ * ``dup ``
122
+ * ``single ``
123
+
124
+ The mixed data/metadata profiles can be converted in the same way, but conversion
82
125
between mixed and non-mixed is not implemented. For the constraints of the
83
126
profiles please refer to :doc: `mkfs.btrfs(8)<mkfs.btrfs> ` section
84
127
:ref: `PROFILES<man-mkfs-profiles> `.
0 commit comments