8,826
edits
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
| Line 242: | Line 242: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Don't forget to delete snapshots, or you'll soon run into '''[[Btrfs#Out_of_space|out of space]] problems'''. Btrfs needs free space (at least 5 GB) to do its work. If your volume is more than 90% full, you'll need to figure out what to do (quickly). Even a Manjaro update can be more than 10 GB in size, so you'll always need some free space. | |||
* ++++ '''[[Btrfs#Extend_a_volume|Add]]''' some partition/device to the volume | * ++++ '''[[Btrfs#Extend_a_volume|Add]]''' some partition/device to the volume | ||
* +++ '''Remove''' some snapshots you don't need | * +++ '''Remove''' some snapshots you don't need (starting with the oldest one!) | ||
* ++ [[Btrfs#Compression_.E2.87.92|Compress]] your volume | * ++ [[Btrfs#Compression_.E2.87.92|Compress]] your volume | ||
* + '''Delete''' some files (This does only help if they are not part of '''any''' snapshot) | * + '''Delete''' some files (This does only help if they are not part of '''any''' snapshot) | ||
| Line 265: | Line 265: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Please also have a look at [https://github.com/jrabinow/snapper-rollback snapper-rollback@github] and at [https://wiki.archlinux.org/title/Snapper#Suggested_filesystem_layout snapshot-layout@wiki.archlinux] for the suggested flat layout and the reasoning. ([https://forum.manjaro.org/t/how-to-manual-rollback-with-btrfs/80230 Rollback example ]) | Please also have a look at [https://github.com/jrabinow/snapper-rollback snapper-rollback@github] and at [https://wiki.archlinux.org/title/Snapper#Suggested_filesystem_layout snapshot-layout@wiki.archlinux] for the suggested flat layout and the reasoning. ([https://forum.manjaro.org/t/how-to-manual-rollback-with-btrfs/80230 Rollback example ]) | ||
{{BoxWarning|Don't forget to | {{BoxWarning|Don't forget to delete snapshots before you run out of space|Each time you create a snapshot, you only use the '''rest of the volume''' to save all changes. Eventually, you'll need to free the snapshot. Don't overuse the space. Btrfs needs '''breathing room.''' Don't use more than '''95%''' and leave at least '''5 GB free''', or you'll be in big trouble.}} | ||
{{BoxDanger|NO Snapshots together with quotas|There are reports about massive problems when using '''quotas''' together with snapshots (snapper, timeshift). Please have a look at: [https://btrfs.wiki.kernel.org/index.php/Quota_support#Known_issues Known_issues@btrfs.kernel.org]}} | {{BoxDanger|NO Snapshots together with quotas|There are reports about massive problems when using '''quotas''' together with snapshots (snapper, timeshift). Please have a look at: [https://btrfs.wiki.kernel.org/index.php/Quota_support#Known_issues Known_issues@btrfs.kernel.org]}} | ||
</div> | </div> | ||
| Line 359: | Line 359: | ||
* '''balance''' all chunks that are less than 90% full. This '''will''' take some time ! | * '''balance''' all chunks that are less than 90% full. This '''will''' take some time ! | ||
{{RootCmd|command=btrfs balance start -dusage=90 /}} | {{RootCmd|command=btrfs balance start -dusage=90 /}} | ||
{{BoxWarning|Don't use filters higher than | {{BoxWarning|Don't use filters higher than 95%|This is unnecessary on an SSD drive. On a hard drive, this will put a lot of strain on the disk. Even with today's hard drives (>2TB), it may take a very long time. (e.g. 24 hours or more)}} | ||
</div> | </div> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== Merging chunks === | === Merging chunks === | ||
As you use your volume, you will be creating some files, deleting some, modifying some. Then some parts of the chunks are empty. But this is not a coherent space that can be easily reused. Usually this is not a problem for btrfs and will be cleaned up automatically over time. However, if space is scarce (> | As you use your volume, you will be creating some files, deleting some, modifying some. Then some parts of the chunks are empty. But this is not a coherent space that can be easily reused. Usually this is not a problem for btrfs and will be cleaned up automatically over time. However, if space is scarce (> 85% full), it is advisable to merge free areas together. This can be done by using balance with a filter. | ||
</div> | </div> | ||
| Line 381: | Line 381: | ||
When you changed RAID-levels (for example from RAID 0 to RAID 1) there is no automatic duplication of the chunks. Only when writing further, btrfs will respect the changed RAID-level. This may not be what you intended. To complete the conversion to another RAID-level you need to tell btrfs to rewrite chunks where needed. You do this with a manual balance: | When you changed RAID-levels (for example from RAID 0 to RAID 1) there is no automatic duplication of the chunks. Only when writing further, btrfs will respect the changed RAID-level. This may not be what you intended. To complete the conversion to another RAID-level you need to tell btrfs to rewrite chunks where needed. You do this with a manual balance: | ||
</div> | </div> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Metadata === | |||
It is rarely recommended to include blocks with metadata in a balance. It is advantageous, in exceptional cases, if the following conditions are currently met: | |||
You can check with: | |||
{{RootCmd|command=sudo btrfs fi us /|grep 'Meta.*Size'}} | |||
{{ic|Metadata,RAID1: Size:9.00GiB, Used:6.58GiB (73.09%)}} | |||
* Several GB of metadata are present in your filesystem (''6.6 GB present, 9 GB used'') | |||
* This metadata is poorly distributed (''73%'') | |||
* Significantly more than one full GB could become free (9 GB - 6.6 GB ==> ''2.4 GB could become free'') | |||
The command is then: | |||
{{RootCmd|command=btrfs balance start -musage=95 /}} | |||
Btrfs had to move 9 GB of metadata to free up 1 GB ! | |||
{{ic|Metadata,RAID1: Size:8.00GiB, Used:6.58GiB (82.20%)}} | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 436: | Line 452: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
==== Avoid to get out of space with btrfs! ==== | ==== Avoid to get out of space with btrfs! ==== | ||
Don't | Don't skimp on storage space when creating a Btrfs volume. A Btrfs volume should normally be less than 90% full. Then it's recommended to adjust the volume. In an emergency, 95% (plus at least 5 GB free) is fine. However, this isn't beneficial for neither the Btrfs volume nor an SSD. | ||
{{BoxWarning|Don't forget to include the snapshots in the bill|Manjaro is a rolling release distribution. There will be a lot of changes over time.}} | {{BoxWarning|Don't forget to include the snapshots in the bill|Manjaro is a rolling release distribution. There will be a lot of changes over time.}} | ||
{{BoxInfo|Tip: Check how close you are to "out of space".| Look at '''Device unallocated:''' (not at ''Free (estimated):'') [https://forum.manjaro.org/t/could-not-boot-due-to-brfs-no-space-condition-how-should-i-keep-using-btrfs/92922/7 1] | {{BoxInfo|Tip: Check how close you are to "out of space".| Look at '''Device unallocated:''' (not at ''Free (estimated):'') [https://forum.manjaro.org/t/could-not-boot-due-to-brfs-no-space-condition-how-should-i-keep-using-btrfs/92922/7 1] | ||
{{RootCmd|command=btrfs filesystem usage /}} | {{RootCmd|command=btrfs filesystem usage /}} | ||
}} | }} | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Get out of jail === | === Get out of jail === | ||
This said, there is an '''easy way out''': Give btrfs more space ;-) | This said, there is an '''easy way out''': Give btrfs more space ;-) | ||
* '''add a (unformatted) partition''' (for example a fast extern USB-Stick with 8GB) to the btrfs-volume with{{RootCmd|command=btrfs device add /dev/[sdz4] /}} | * '''add a (unformatted) partition''' (for example a fast extern USB-Stick with 8GB) to the btrfs-volume with{{RootCmd|command=btrfs device add /dev/[sdz4] /}} | ||
{{BoxDanger|Do NOT remove this USB-Stick|From now on this partition belongs to your volume! '''Do not boot without it'''. If possible do not reboot at all in this stage! This USB-stick has to stay until '''btrfs device remove''' has '''completed'''.}} | {{BoxDanger|Do NOT remove this USB-Stick|From now on this partition belongs to your volume! '''Do not boot without it'''. If possible do not reboot at all in this stage! This USB-stick has to stay until '''btrfs device remove''' has '''completed'''.}} | ||
* look for old snapshots you don´t need, remove them '''now''' | * look for old snapshots you don´t need, remove them '''now''' (starting with the oldest one) | ||
* '''or delete some files''' you do not need | * '''or delete some files''' you do not need | ||
* Do this until your disk will be not more then 95% full | * Do this until your disk will be not more then 95% full (plus 5 GB free space) | ||
</div> | </div> | ||
| Line 458: | Line 477: | ||
{{BoxSuccess|Tip: Want to watch the volume clean up ?|{{UserCmd|command=pamac install procps-ng}}}} | {{BoxSuccess|Tip: Want to watch the volume clean up ?|{{UserCmd|command=pamac install procps-ng}}}} | ||
{{BoxSuccess||After that inside a terminal: {{RootCmd|command=watch -n 60 btrfs filesystem usage -h / }}}} | {{BoxSuccess||After that inside a terminal: {{RootCmd|command=watch -n 60 btrfs filesystem usage -h / }}}} | ||
* If neccesary '''balance''' your volume with a filter(90%) This '''will''' take some more time !{{RootCmd|command=btrfs balance start -dusage=95 /}} | * If neccesary '''balance''' your volume with a filter(90-95 %) This '''will''' take some more time !{{RootCmd|command=btrfs balance start -dusage=95 /}} | ||
</div> | </div> | ||