All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
To: "Lentes, Bernd" <bernd.lentes@helmholtz-muenchen.de>
Cc: arvidjaar <arvidjaar@gmail.com>, Btrfs ML <linux-btrfs@vger.kernel.org>
Subject: Re: some principal questions to "disk full"
Date: Fri, 28 May 2021 15:51:13 -0400	[thread overview]
Message-ID: <20210528195113.GF11733@hungrycats.org> (raw)
In-Reply-To: <647580601.78931938.1622022062919.JavaMail.zimbra@helmholtz-muenchen.de>

On Wed, May 26, 2021 at 11:41:02AM +0200, Lentes, Bernd wrote:
> 
> 
> ----- On May 26, 2021, at 7:36 AM, arvidjaar arvidjaar@gmail.com wrote:
> 
> > On 25.05.2021 19:20, Lentes, Bernd wrote:
>  
> 
> >> What can i do to prevent a "disk full" situation ?
> >> Running regulary "btrfs balance" in a cron job ?

Run

	btrfs balance start -dlimit=1 /path/to/your/fs

about once a day.  This will force the filesystem to free up some
allocated but unused space in data chunks, making them unallocated.
This will ensure you have enough unallocated space to allow you to
allocate a new metadata chunk when needed.

btrfs might allocate a new metadata chunk at any time, so it is a good
idea to ensure at least 1GB (preferably 5 or 10 GB) is always unallocated.
The filesystem does have workarounds that will let it continue to work
with very low disk space, but they can degrade performance, increase
write wear, and increase exposure to firmware bugs if your drive has them.

Never balance metadata (full balance or btrfs balance start -m) from a
maintenance script.  This will free metadata chunks and lead directly to
ENOSPC gotchas.  The kernel deals with metadata allocations fairly well
for most users--but only if you don't break it with metadata balances.

If possible, resize your filesystem to about 5GB less than the underlying
device size.  That way, if you get stuck with low space for metadata, you
can do 'btrfs fi resize 1:max /fs' to get some quick and safe emergency
space to complete a balance or a snapshot delete.  Don't forget to resize
back to 5GB less than full size when the crisis is resolved.

> > If you are using more or less recent kernel version, you need not run
> > btrfs balance at all except when possibly converting profiles or adding
> > new device. btrfs became reasonably good at managing free space.
> 
> What is "more or less recent" ? Which version numbers ?

3.18 or later.  It's certainly not a new feature.

> Bernd



      reply	other threads:[~2021-05-28 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 16:20 some principal questions to "disk full" Lentes, Bernd
2021-05-26  5:36 ` Andrei Borzenkov
2021-05-26  9:41   ` Lentes, Bernd
2021-05-28 19:51     ` Zygo Blaxell [this message]

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=20210528195113.GF11733@hungrycats.org \
    --to=ce3g8jdj@umail.furryterror.org \
    --cc=arvidjaar@gmail.com \
    --cc=bernd.lentes@helmholtz-muenchen.de \
    --cc=linux-btrfs@vger.kernel.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.