btrfs-progs: use btrfs_open_dir for btrfs device command
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-balance.asciidoc
1 btrfs-balance(8)
2 ================
3
4 NAME
5 ----
6 btrfs-balance - balance btrfs filesystem
7
8 SYNOPSIS
9 --------
10 *btrfs balance* <subcommand> <args>
11
12 DESCRIPTION
13 -----------
14 *btrfs balance* is used to balance chunks in a btrfs filesystem across
15 multiple or even single device.
16
17 See `btrfs-device`(8) for more details about the effect on device management.
18
19 NOTE: The balance subcommand also exists under the *filesystem* namespace. This
20 still works for backward compatibility but is deprecated and should not be
21 used anymore.
22
23 NOTE: A short syntax *btrfs balance <path>* works due to backward compatibility
24 but is deprecated and should not be used anymore. Use *btrfs balance start*
25 command instead.
26
27 SUBCOMMAND
28 ----------
29 *cancel* <path>::
30 Cancel running or paused balance.
31
32 *pause* <path>::
33 Pause running balance.
34
35 *resume* <path>::
36 Resume interrupted balance.
37
38 *start* [options] <path>::
39 Balance chunks across the devices *online*.
40 +
41 Balance and/or convert (change allocation profile of) chunks that
42 passed all filters in a comma-separated list of filters for a
43 particular chunk type.
44 If filter list is not given balance all chunks of that type.
45 In case none of the -d, -m or -s options is
46 given balance all chunks in a filesystem.
47 +
48 `Options`
49 +
50 -d[<filters>]::::
51 act on data chunks. See `FILTERS` section for details about <filters>.
52 -m[<filters>]::::
53 act on metadata chunks. See `FILTERS` section for details about <filters>.
54 -s[<filters>]::::
55 act on system chunks (only under -f). See `FILTERS` section for details about <filters>.
56 -v::::
57 be verbose
58 -f::::
59 force reducing of metadata integrity
60
61 *status* [-v] <path>::
62 Show status of running or paused balance.
63 +
64 If '-v' option is given, output will be verbose.
65
66 FILTERS
67 -------
68 From kernel 3.3 onwards, btrfs balance can limit its action to a subset of the
69 full filesystem, and can be used to change the replication configuration (e.g.
70 moving data from single to RAID-1). This functionality is accessed through the
71 '-d', '-m' or '-s' options to btrfs balance start, which filter on data,
72 metadata and system blocks respectively.
73
74 A filter has the following stucture: ::
75 'type'[='params'][,'type'=...]
76
77 The available types are:
78
79 *profiles*::
80 Balances only block groups with the given replication profiles. Parameters
81 are a list of profile names separated by |.
82
83 *usage*::
84 Balances only block groups with usage under the given percentage. The
85 value of 0 is allowed and will clean up completely unused block groups, this
86 should not require any new space allocated. You may want to use usage=0 in
87 case balance is returnin ENOSPC and your filesystem is not too full.
88
89 *devid*::
90 Balances only block groups which have at least one chunk on the given
91 device (by btrfs device ID -- use btrfs fi show to list device IDs)
92
93 *drange*::
94 Balances only block groups which overlap with the given byte range on any
95 device. (Use in conjunction with "devid" to filter on a specific device). The
96 parameter is a range specified as <start..end>.
97
98 *vrange*::
99 Balances only block groups which overlap with the given byte range in the
100 filesystem's internal virtual address space. This is the address space that
101 most reports from btrfs in the kernel log use. The parameter is a range
102 specified as <start..end>.
103
104 *convert*::
105 Convert each selected block group to the given profile name identified by
106 parameters.
107
108 *limit*::
109 Process only given number of chunks, after all filters apply. This can be used
110 to specifically target a chunk in connection with other filters (drange,
111 vrange) or just simply limit the amount of work done by a single balance run.
112
113 *soft*::
114 Takes no parameters. Only has meaning when converting between profiles.
115 When doing convert from one profile to another and soft mode is on,
116 restriper won't touch chunks that already have the target profile. This is
117 useful if e.g. half of the FS was converted earlier.
118 +
119 The soft mode switch is (like every other filter) per-type. This means
120 that we can convert for example meta chunks the "hard" way while converting
121 data chunks selectively with soft switch.
122
123 Profile names, used in profiles and convert are one of: 'raid0', 'raid1',
124 'raid10', 'raid5', 'raid6', 'dup', 'single'.
125
126 EXIT STATUS
127 -----------
128 *btrfs balance* returns a zero exit status if it succeeds. Non zero is
129 returned in case of failure.
130
131 AVAILABILITY
132 ------------
133 *btrfs* is part of btrfs-progs.
134 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
135 further details.
136
137 SEE ALSO
138 --------
139 `mkfs.btrfs`(8),
140 `btrfs-device`(8)