From: Hugo Mills <hugo@carfax.org.uk>
To: Marc MERLIN <marc@merlins.org>
Cc: Hans van Kranenburg <hans.van.kranenburg@mendix.com>,
linux-btrfs@vger.kernel.org
Subject: Re: balancing every night broke balancing so now I can't balance anymore?
Date: Sun, 14 May 2017 21:21:11 +0000 [thread overview]
Message-ID: <20170514212111.GL9701@carfax.org.uk> (raw)
In-Reply-To: <20170514201508.bd3dshfymqt4swpb@merlins.org>
[-- Attachment #1: Type: text/plain, Size: 3728 bytes --]
On Sun, May 14, 2017 at 01:15:09PM -0700, Marc MERLIN wrote:
> On Sun, May 14, 2017 at 09:13:35PM +0200, Hans van Kranenburg wrote:
> > On 05/13/2017 10:54 PM, Marc MERLIN wrote:
> > > Kernel 4.11, btrfs-progs v4.7.3
> > >
> > > I run scrub and balance every night, been doing this for 1.5 years on this
> > > filesystem.
> >
> > What are the exact commands you run every day?
>
> http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html
> (at the bottom)
> every night:
> 1) scrub
> 2) balance -musage=0
> 3) balance -musage=20
In most cases, this is going to make ENOSPC problems worse, not
better. The reason for doign this kind of balance is to recover unused
space and allow it to be reallocated. The typical behaviour is that
data gets overallocated, and it's metadata which runs out. So, the
last thing you want to be doing is reducing the metadata allocation,
because that's the scarce resource.
Also, I'd usually recommend using limit=n, where n is approximately
the amount of data overallcation (allocated space less used
space). It's much more controllable than usage.
Hugo.
> 4) balance -dusage=0
> 5) balance -dusage=20
>
> > > How did I get into such a misbalanced state when I balance every night?
> >
> > I don't know, since I don't know what you do exactly. :)
>
> Now you do :)
>
> > > My filesystem is not full, I can write just fine, but I sure cannot
> > > rebalance now.
> >
> > Yes, because you have quite some allocated but unused space. If btrfs
> > cannot just allocate more chunks, it starts trying a bit harder to reuse
> > all the empty spots in the already existing chunks.
>
> Ok. shouldn't balance fix problems just like this?
> I have 60GB-ish free, or in this case that's also >25%, that's a lot
>
> Speaking of unallocated, I have more now:
> Device unallocated: 993.00MiB
>
> This kind of just magically fixed itself during snapshot rotation and
> deletion I think.
> Sure enough, balance works again, but this feels pretty fragile.
> Looking again:
> Device size: 228.67GiB
> Device allocated: 227.70GiB
> Device unallocated: 993.00MiB
> Free (estimated): 58.53GiB (min: 58.53GiB)
>
> You're saying that I need unallocated space for new chunks to be
> created, which is required by balance.
> Should btrfs not take care of keeping some space for me?
> Shoudln't a nigthly balance, which I'm already doing, help even more
> with this?
>
> > > Besides adding another device to add space, is there a way around this
> > > and more generally not getting into that state anymore considering that
> > > I already rebalance every night?
> >
> > Add monitoring and alerting on the amount of unallocated space.
> >
> > FWIW, this is what I use for that purpose:
> >
> > https://packages.debian.org/sid/munin-plugins-btrfs
> > https://packages.debian.org/sid/monitoring-plugins-btrfs
> >
> > And, of course the btrfs-heatmap program keeps being a fun tool to
> > create visual timelapses of your filesystem, so you can learn how your
> > usage pattern is resulting in allocation of space by btrfs, and so that
> > you can visually see what the effect of your btrfs balance attempts is:
>
> That's interesting, but ultimately, users shoudln't have to micromanage
> their filesystem to that level, even btrfs.
>
> a) What is wrong in my nightly script that I should fix/improve?
> b) How do I recover from my current state?
>
> Thanks,
> Marc
--
Hugo Mills | You stay in the theatre because you're afraid of
hugo@... carfax.org.uk | having no money? There's irony...
http://carfax.org.uk/ |
PGP: E2AB1DE4 | Slings and Arrows
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2017-05-14 21:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-13 20:54 balancing every night broke balancing so now I can't balance anymore? Marc MERLIN
2017-05-14 7:34 ` Duncan
2017-05-14 19:13 ` Hans van Kranenburg
2017-05-14 20:15 ` Marc MERLIN
2017-05-14 20:57 ` Lionel Bouton
2017-05-14 21:30 ` Kai Krakow
2017-05-14 23:08 ` Lionel Bouton
2017-05-14 21:21 ` Hugo Mills [this message]
2017-05-14 23:16 ` Marc MERLIN
2017-05-15 8:14 ` Hugo Mills
2017-05-15 11:30 ` Lionel Bouton
2017-05-15 12:34 ` Austin S. Hemmelgarn
2017-05-14 21:22 ` Kai Krakow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170514212111.GL9701@carfax.org.uk \
--to=hugo@carfax.org.uk \
--cc=hans.van.kranenburg@mendix.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=marc@merlins.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.