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
22whole 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 ``).
64
7- A filter has the following structure: * type[=params][,type=...] *
5+ Balance can be limited to a block group profile with the following options:
86
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+ ^^^^^^^^^^^^
1043
1144profiles=<profiles>
1245 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).
1447
1548usage=<percent>, usage=<range>
1649 Balances only block groups with usage under the given percentage. The
1750 value of 0 is allowed and will clean up completely unused block groups, this
1851 should not require any new work space allocated. You may want to use *usage=0 *
1952 in case balance is returning ENOSPC and your filesystem is not too full.
2053
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
2356 accept only the single value format.
2457 The minimum range boundary is inclusive, maximum is exclusive.
2558
@@ -29,44 +62,44 @@ devid=<id>
2962
3063drange=<range>
3164 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 `` .
3467
3568vrange=<range>
3669 Balance only block groups which overlap with the given byte range in the
3770 filesystem's internal virtual address space. This is the address space that
3871 most reports from btrfs in the kernel log use. The parameter is a range
39- specified as * start..end * .
72+ specified as `` start..end `` .
4073
4174convert=<profile>
4275 Convert each selected block group to the given profile name identified by
4376 parameters.
4477
4578 .. 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.
4881
4982 .. 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
5184 multi-device filesystems.
5285
5386limit=<number>, limit=<range>
5487 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.
5790
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
6093 only the single value format. The range minimum and maximum are inclusive.
6194
6295stripes=<range>
6396 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
6598 utilize striping, i.e. RAID0/10/5/6. The range minimum and maximum are
6699 inclusive.
67100
68101soft
69- Takes no parameters. Only has meaning when converting between profiles.
102+ Takes no parameters. Only has meaning when converting between profiles, or
70103 When doing convert from one profile to another and soft mode is on,
71104 chunks that already have the target profile are left untouched.
72105 This is useful e.g. when half of the filesystem was converted earlier but got
76109 For example, this means that we can convert metadata chunks the "hard" way
77110 while converting data chunks selectively with soft switch.
78111
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
82125between mixed and non-mixed is not implemented. For the constraints of the
83126profiles please refer to :doc: `mkfs.btrfs(8)<mkfs.btrfs> ` section
84127:ref: `PROFILES<man-mkfs-profiles> `.
0 commit comments