Constant System freeze [BTRFS related]

Update: Issue Resolved – No More Freezing

It’s been a few days, and I’m happy to report that the freezing issue has been resolved. Just to summarize for anyone else who might come across this thread with a similar problem:

I’m using BTRFS with snapshots on a 512GB NVMe SSD. My disk usage had filled up to around 60-70%, and that’s when I started noticing system freezes. After checking with dmesg, I saw several messages about “hung tasks” along with BTRFS stack traces.

If you’re using BTRFS, make sure to:

  • Regularly run btrfs scrub and btrfs balance (depending on your use case).
  • Automate this process using tools like btrfs-assistant and btrfsmaintenance, as mentioned in a previous comment. as mentioned here

If you’re also using LUKS on BTRFS (especially on an SSD), ensure that the discards no_read_workqueue no_write_workqueue flags are enabled in your /etc/crypttab file as mentioned in this comment.

This setup has worked for me, and the system is running smoothly now.

Big thanks to @mbod, @EOS, and everyone else for the helpful advice!

2 Likes