Difference between revisions of "Btrfs Maintenance"

ReadRateDegradation
(Erste Vorschläge)
(ReadRateDegradation)
Line 32: Line 32:


==== error ====
==== error ====
If btrfs encounters an unrecoverable error, such as a checksum mismatch, the filesystem is mounted read-only. (When using RAID2, such errors are auto-repaired)
If btrfs encounters an unrecoverable error, such as a checksum mismatch, the filesystem will be mounted '''read-only'''. (When using RAID2, such errors are auto-repaired)


==== clean ====
==== clean ====
Line 38: Line 38:


== Manual Maintenace ==
== Manual Maintenace ==
From time to time it may be advisable to check the health of the volume. This is done with:
From time to time it may be advisable to check the health of the volume.
{{BoxInfo|Notice| Be aware,  that with btrfs all maintenance is performed on a normally running system. The volume can be fully used. Even a shutdown during such an action is not problematic. Btrfs will continue to execute the action after the next boot until it completes.}}


=== usage ===
=== usage ===
Line 44: Line 45:


==== check unallocated space ====
==== check unallocated space ====


{{RootCmd|command=btrfs filesystem usage -h /}}
{{RootCmd|command=btrfs filesystem usage -h /}}
Line 63: Line 63:
If you have some space "free" on your volume, but the unallocated space is below 10% (or close to 10%), you can help btrfs to rebalance some chunks.
If you have some space "free" on your volume, but the unallocated space is below 10% (or close to 10%), you can help btrfs to rebalance some chunks.


{{RootCmd|command=btrfs balance start -musage=50 -dusage=50}}
{{RootCmd|command=btrfs balance start -musage=50 -dusage=50 /}}
Btrfs looks for chunks that contain more than 50% free space. It will take 2 of them and then move everything into a new chunk. After that, one chunk is released. This continues until each chunk is at least 50% full.
Btrfs looks for chunks that contain more than 50% free space. It will take 2 of them and then move everything into a new chunk. After that, one chunk is released. This continues until each chunk is at least 50% full.


Line 69: Line 69:


If you have less than 20% unallocated space, please do the following:
If you have less than 20% unallocated space, please do the following:
{{RootCmd|command=btrfs balance start -musage=75 -dusage=75}}  
{{RootCmd|command=btrfs balance start -musage=75 -dusage=75 /}}  
Btrfs looks for chunks that are less than 75% full.
Btrfs looks for chunks that are less than 75% full.
It will take 4 of them and then move everything into 3 new chunks. After that, one chunk can be released. This continues until each chunk is at least 75% full.
It will take 4 of them and then move everything into 3 new chunks. After that, one chunk can be released. This continues until each chunk is at least 75% full.


If you still have less than 20% unallocated space, please do the following:
If you still have less than 20% unallocated space, please do the following:
{{RootCmd|command=btrfs balance start -musage=90 -dusage=90}}  
{{RootCmd|command=btrfs balance start -musage=90 -dusage=90 /}}  




Line 84: Line 84:
Tip:watch -d btrfs scrub status /
Tip:watch -d btrfs scrub status /


== special cases ==
There seem to be some cases where additional maintenance is needed.
==== ssd ====
===== Read Rate Degradation =====
This is not a problem of all ssd's in general, but only of some rare cases. Replacing the firmware solves the problem.
A possibility to test the read-speed with btrfs is to read all data (scrub). If your ssd has this RRD-problem, a balance will help because it does rewrite all data to a new place. This can be done while the system is in use !
{{RootCmd|command=btrfs balance start --full-balance /}}
This will take a long time. You can shutdown your pc whenever you want. Dont't be surprised. the balance will restart after boot until it is finished !
==== rotational disks ====
On rotational disks fragmentation may become a problem in some rare use cases. Then you can defragment your btrfs.
===== de-fragmentation (not recommended) =====
This is NOT the same as defragmentation in older windows filesystems. Btrfs does NOT need defragmentation as normal maintenance. Do this only, if you can measure a huge loss of read-performance because a specific file/database is fragmented!
* Only defragment these specific files.
You have been warned !
<!-- If you use code, it should be like below example(a space before that) -->
<!-- If you use code, it should be like below example(a space before that) -->


Line 89: Line 106:


<!-- Don't forget to look more templates: https://wiki.manjaro.org/index.php/Help:Template -->
<!-- Don't forget to look more templates: https://wiki.manjaro.org/index.php/Help:Template -->


=See Also=
=See Also=
translator
1,001

edits