Troubleshooting System Stutter, Lags, Freezes, and Hangs



Disable BTRFS Quota (qgroups)



Garuda and other distributions have seen reports of system slowdowns and freezes happening with btrfs quota's enabled. Disabling btrfs quotas would seem a logical step if you experience freezes during BTRFS maintenance operations. if you seemingly experience a freeze during a balancing operation, try waiting as long as possible to hopefully let things resolve on their own. Balancing operations can sometimes take a very long time to complete. Never shut down your computer when a balancing operation is in progress.

To disable BTRFS quotas run:

sudo btrfs quota disable /

Disabling qgroups will impact the systems ability to gauge the remaining disk space left for creating snapshots. If you disable qgroups you must be vigilant in ensuring you have adequate free space left for new snapshots. You do not want auto-snapshots to result in a completely filled drive, as this is a serious issue that you do not want to occur. Even though this requires more manual scrutiny on the users part, for systems that are severely impacted by freezes this seems an adequate trade off. You must be the judge of if the benefits of having qgroups enabled outweighs any negative side-effects you are experiencing.

Information on BTRFS quota support.

There has been some discussion about disabling qgroups by default on Garuda. At the time of writing, I believe BTRFS quotas are still enabled in all editions. As it seems that only a small minority of systems are affected by this issue, (and qgroups are a useful feature) BTRFS quotas may remain the default.

Edit:

Since switching to using snapper from timeshift BTRFS quotas are no longer enabled by default. If you are still using timeshift for your system snapshots, then BTRFS quotas are likely enabled on your system.

It has been reported that some updates may re-enable qroups even though they were manually disabled. Therefore, you will need to check if quotas have been re-enabled if you begin experiencing the same issues again.

Read the link below for information on how to permanently disable qgroups if using timeshift for creating snapshots:

BTRFS quota is automatically re-enabled if I disable it



BTRFS Balancing Tips:



Garuda uses the BTRFS filesystem which is quite different from the old standard ext4 used by many distros. Unlike ext4, BTRFS requires regular maintenance to be performed. Services are employed to perform these maintenance tasks on a regular schedule. There are however times when the user may want to perform some tasks manually.

It has been reported that if many snapshots have been created, lags and freezes may occur on some systems. If you are experiencing lags or freezing issues it may be helpful to disable BTRFS quotas and then delete all stored snapshots. After making these changes and performing a BTRFS balance performance is sometimes improved quite substantially. I personally usually manually delete all my snapshots and perform a BTRFS balance after I have accumulated 5 or more snapshots.

After doing a very large update or deleting large amounts of data, performance degradation may occur on some systems. After those operations it is often beneficial to perform a BTRFS balance to ensure your performance does not suffer. Numerous people have reported dramatic improvements in performance after performing a BTRFS balancing as some systems seem to require this more than others. Be sure to reboot after the balancing is complete. Also be sure to create a new system snapshot after you've completed all those operations.

The command below will launch a 60% balancing operation on / (root) and will also provide updates on how far along the process is to completion:

bash -c "sudo btrfs balance start -musage=60 -dusage=60 / & sudo watch -t -n5 btrfs balance status / &&  fg"

BTRFS balancing operations can sometimes take a very long time to complete. Never shut down your computer when a balancing operation is in progress.



8 Likes