Skip to contentSkip to conversation

anything wrong with `balance -dusage -musage` together?

DISCUSSION Lukas Pirl 3 participants 4 messages Nov 19, 2015 – Nov 20, 2015 Btrfs file system

lore
Share & tools
lore

Lukas Pirl

author
#0 lore raw

Hi list,

I rarely see balance used with -dusage -musage together, esp. with values other than zero.

The question is, is there anything wrong with running (say) balance -dusage=50 -musage=30 regularly?

Thanks and best regards,

Lukas

#1 lore raw
Quoted 7 lines · Lukas Pirl

Hi list,

I rarely see balance used with -dusage -musage together, esp. with values other than zero.

The question is, is there anything wrong with running (say) balance -dusage=50 -musage=30 regularly?

Nothing actively wrong with that, no. It certainly won't break
anything. It's just rarely actually useful. The usual situation is that you run out of one kind of storage before the other (data vs metadata, that is), and you need to free up some allocation of one of them so it can go to the other. This is typically too much data allocation, and metadata has run out (so -d is more often used than -m).

For the "usual" case of running out of metadata allocation, you
don't actually need much space to reclaim, so -dlimit=X for small X is an easier approach to use.

Hugo.

Signature · 4 lines
Hugo Mills             | Questions are a burden, and answers a prison for
hugo@... carfax.org.uk | oneself
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                                          The Prisoner
author
#2 lore raw

On 11/20/2015 12:59 PM, Hugo Mills wrote as excerpted:

Quoted 11 lines

Nothing actively wrong with that, no. It certainly won't break
anything. It's just rarely actually useful. The usual situation is that you run out of one kind of storage before the other (data vs metadata, that is), and you need to free up some allocation of one of them so it can go to the other. This is typically too much data allocation, and metadata has run out (so -d is more often used than -m).

For the "usual" case of running out of metadata allocation, you
don't actually need much space to reclaim, so -dlimit=X for small X is an easier approach to use.

Thanks Hugo for your quick reply.

Alright, the look at https://github.com/kdave/btrfsmaintenance
just made me think over regular balances using -*usage before one or the other space runs out (as suggested there).

Best,

Lukas

#3 lore raw
In reply to Lukas Pirl

Lukas Pirl posted on Fri, 20 Nov 2015 12:53:33 +1300 as excerpted:

Quoted 5 lines

I rarely see balance used with -dusage -musage together, esp. with values other than zero.

The question is, is there anything wrong with running (say) balance -dusage=50 -musage=30 regularly?

I see the question in general has already been answered, nothing at all wrong with invoking balance with both an -musage and a -dusage filter, it's only rare to see in examples because the examples are generally dealing with specific cases where one or the other, generally metadata, has run out, due to the other one, generally data, taking all the otherwise unallocated space with mostly empty allocations. So a quick -dusage filter to clear out the mostly empty data allocations is the most common example seen.

But I'd like to point out, not only is combining -dusage and -musage OK, but in some cases, specifically btrfs' mixed-bg mode where data and metadata are combined into the same blocks, it's actually _mandatory_.

Note that mkfs.btrfs defaulted to --mixed mode for small filesystems, under a GiB, for some time, and that while btrfs-progs 4.3 controversially does away with that default, it's still very strongly recommended for filesystems under a GiB, and recommended in general by many list regulars to between 8 and 32 GiB (I've even seen an argument for making it 64 GiB), as while slightly less efficient (and doubling data usage in dup mode), it does eliminate the data vs metadata hassles, which can be far worse at smaller filesystem sizes.

And some people use --mixed at even larger sizes, hundreds of gigs to TiB scale, often to enable them to do single-device dup mode data for better reliability and to better take advantage of btrfs' data integrity features, since until now dup mode has been allowed for metadata only, and thus has been disallowed for data except with mixed-mode. (Tho that's set to change as recently patches have been posted that would allow dup mode data as well, which when integrated, would do away with the biggest reason to use mixed mode at 100 gig and larger sizes.)

Anyway, with mixed mode, data and metadata are mixed in the same chunks, and balance will refuse to run with balance filters unless the -d and -m filters exactly duplicate each other. So on such a btrfs, to do a -dusage balance of any percentage, -musage must be added as well, with the exact same percentage.

So as I said, not only is there nothing wrong with combining -dusage and - musage, in some cases it's actually mandatory.

Signature · 3 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman