6

I'm running Ubuntu 16.04.2 LTS with btrfs on 4 8 TB Seagate drives in RAID 1. Every 30 seconds btrfs-transacti shows up in iotop with ca. 80 M/s for 15 seconds, even when the system is not used. The system is only used for storing backups once a day, but has disc activity all day.

How can I find out what causes these write peaks and how can I stop it?

Christian
  • 181
  • 2
  • 8

2 Answers2

3

I believe it is btrfs autodefrag. I get those as well. This is an option that has to be set explicitly in the fstab, but many people do and recommend it, especially on spinning rust hard drives. SSDs don't really care about fragments produced by copy-on-write.

Then, if your /var/log directory is on btrfs, I believe you end up defragging the systemd journal files quite often.

One thing that Fedora does but I'm not sure about Ubuntu, is it marks the /var/log/journal directory and all subdirectories and files with chattr +C. The 'C' attribute marks it as not copy-on-write, which means btrfs reads and writes it much as ext4 or xfs would.

Using the "C" attribute prevents large amounts of fragmentation or autodefrag writes but also means the file isn't protected by checksums.

Even though I'm not sure of your exact situation it's my best guess that you have /var/log/journal on btrfs, with autodefrag set, and without the C attribute. Which would explain the constant writes throughout the day, and the large amount of use in the btrfs-transaction threads.

Zan Lynx
  • 2,218
0

On Fedora 36, I used command iotop -aP. It showed me Brave was doing continuous writes even without any user interactions and youtube stuff. The btrfs-transaction and Brave writes seemed related as the numbers were staying close and were updating in sync. When I closed Brave the btrfs-transacition numbers didn't go up...
At the end of a normal day my SSD usage was ~5GB reads and 30+GB writes!!

I've switched to chrome for now.

the Hutt
  • 123