19

I use btrfs snapshots quite a bit, and one of the things that interests me is how much space a given snapshot takes up - or to be more specific - how much exclusive data a btrfs snapshot is taking up, so that I know if I delete the snapshot, how much space I would free up.

The only way I know of finding out this information is by enabling btrfs quotas with

# btrfs quota enable /

and running

# btrfs qgroup show /

This is very effective. The thing is - I don't actually use btrfs quotas for anything other than this, which means I have the choice of either always having btrfs quotas enabled, or enabling them temporarily just before running the "btrfs qgroup show /" command, and immediately disabling them. Also, last I heard, btrfs quotas were still experimental (am I wrong?).

Basically what I want to know is:

  1. Does keeping btrfs quotas enabled impact system stability?
  2. Does keeping btrfs quotas enabled impact system performance?

I realize that the "to be safe" answer is to only enable quotas when I need them, but I'm actually making a script that runs "btrfs qgroup show /" and prints the output in a more readable form, and adding code that enables and disables quotas all the time slows down the script considerably, and adds complexity, so I'd rather keep quotas enabled all the time, but I have no clue if there's a downside to it.

2
  • I can't really answer about the impacts, but I have two comments: (1) last time I used Btrfs quotas (around Linux 3.15 maybe?) there were bugs that caused it to calculate negative usage, and (2) leaving quotas enabled all the time is likely better (faster, more stable) than turning them on and off over and over again.
    – Celada
    Commented Mar 16, 2015 at 6:28
  • NOTE: btrfs is still not considered a production grade filesystem at this time. So I would not be storing any critical information on this type of filesystem.
    – mdpc
    Commented Mar 16, 2015 at 7:16

1 Answer 1

7

I run use btrfs for my personal NAS. It's a 3.7T filesystem with over a thousand snapshots. I use the snapshots to sync backups to external drives. For my use case, enabling quotas has detrimental effects on system stability and performance. BTRFS transactions can become stalled for hours doing quota calculations. This causes any process that touches that filesystem to hang in uninterruptible disk sleep. Even ls or df will hang and become unkillable until the quota calculations complete.

I think if I were to use far fewer snapshots I would not experience this problem. Quotas do seem to perform tolerably well for some people's workloads, just not mine.

1
  • IMHO: NEVER EVER turn quotas on on PROD. An be careful of tools that do that automatically, like btrfs-du. Commented Feb 7, 2020 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .