-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btrfs-progs: docs: add balance filter examples
Add more examples and explanations how the filters can be used. Pull-request: #486 Author: Eideen Signed-off-by: David Sterba <[email protected]>
- Loading branch information
1 parent
9362803
commit 1e18750
Showing
3 changed files
with
176 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,8 @@ Filters | |
------- | ||
|
||
.. include:: ch-balance-filters.rst | ||
|
||
Examples | ||
-------- | ||
|
||
.. include:: ch-balance-examples.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
Adding new device | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
The unallocated space requirements depend on the selected storage | ||
profiles. The requirements for the storage profile must be met for the | ||
selected for both data and metadata (e.g. if you have single data and | ||
RAID1 metadata, the stricter RAID1 requirements must be met or the | ||
filesystem may run out of metadata space and go read-only). | ||
|
||
Before adding a drive, make sure there is enough unallocated space on | ||
existing drives to create new metadata block groups (for filesystems | ||
over 50GB, this is `1GB * (number_of_devices + 2))`. | ||
|
||
If using a striped profile (`raid0`, `raid10`, `raid5`, or `raid6`), then do a | ||
full data balance of all data after adding a drive. If adding multiple | ||
drives at once, do a full data balance after adding the last one. | ||
|
||
.. code-block:: bash | ||
btrfs balance start -v --full-balance mnt/ | ||
If the balance is interrupted, it can be restarted using the *stripes* | ||
filter (i.e. `-dstripes=1..N` where *N* is the previous size of the array | ||
before the new device was added) as long as all devices are the same size. | ||
If the device sizes are different, a specialized userspace balance tool | ||
is required. The data balance must be completed before adding any new | ||
devices or increasing the size of existing ones. | ||
|
||
.. code-block:: bash | ||
# For going from 4 disk to 5 disks, in Raid 5 | ||
btrfs balance start -v -dstripes=1..4 mnt/ | ||
If you are not using a striped profile now, but intend to convert to a | ||
striped profile in the future, always perform a full data balance after | ||
adding drives or replacing existing drives with larger ones. The stock | ||
*btrfs balance* tool cannot cope with special cases on filesystems with | ||
striped raid profiles, and will paint itself into a corner that will | ||
require custom userspace balancing tools to recover if you try. | ||
|
||
To watch one can use the following: | ||
|
||
.. code-block:: bash | ||
watch "btrfs filesystem usage -T mnt/; btrfs balance status mnt/" | ||
Convert RAID1 after mkfs with defaults | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
If you forgot to set the block group profile when creating the volume, run the | ||
following command: | ||
|
||
.. code-block:: bash | ||
btrfs balance start -v convert=raid1,soft mnt/ | ||
This will convert all remaining profiles that are not yet *raid1*. | ||
|
||
Convert data to RAID10 with RAID1C4 for metadata | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
If you a have multi device setup, or you'd like to have different profiles on a | ||
single disk, e.g. *RAID10* for data and *RAID1C4* for metadata and system: | ||
|
||
.. code-block:: bash | ||
btrfs balance start -v -mconvert=raid1C4,soft -dconvert=raid10,soft mnt/ | ||
Compact under used chunks | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
If the data chunks are not balanced and used only partially, the *usage* filter | ||
can be used to make them more compact: | ||
|
||
.. code-block:: bash | ||
btrfs balance start -v -dusage=10 mnt/ | ||
If the percent starts from a small number, like 5 or 10, the chunks will be | ||
processed relatively quickly and will make more space available. Increasing the | ||
percentage can then make more chunks compact by relocating the data. | ||
|
||
Chunks utilized up to 50% can be relocated to other chunks while still freeing | ||
the space. With utilization higher than 50% the chunks will be basically only | ||
moved on the devices. The actual chunk layout may help to coalesce the free | ||
space but this is a secondary effect. | ||
|
||
.. code-block:: bash | ||
for USAGE in {10..50..10} do | ||
btrfs balance start -v -dusage=$USAGE mnt/ | ||
done | ||
Fix incomplete balance | ||
^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
If the balance is interrupted (due to reboot or cancelled) during conversion to | ||
RAID1. The following command will skip all RAID1 chunks that have been already | ||
converted and continue with what's left to convert. Note that an interrupted | ||
conversion may leave the last chunk under utilized. | ||
|
||
.. code-block:: bash | ||
btrfs balance start convert=raid1,soft mnt/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters