linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Becker <floyd.net@gmail.com>
To: Karsten Vinding <karstenvinding@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Balance of Raid1 pool, does not balance properly.
Date: Thu, 10 Jan 2019 19:58:15 +0100	[thread overview]
Message-ID: <CAEtw4r1-YEotbHF-SF_N12by=d+6h=hwb9u8Rt6RFHeGZaw=Pw@mail.gmail.com> (raw)
In-Reply-To: <24856b7a-e4ca-bf12-f70b-7f016142e6b2@gmail.com>

for the future you can create a little cron script to avoid this issue.
the data distribution should then be more regular, even if you delete
or overwrite a lot.

deppend on your workload use the right :

# cron.daily / cron.weekly
btrfs balance start -musage=0 -dusage=0 # releases empty blocks for
more unallocated space with can used by future balance runs
btrfs balance start -musage=25 -dusage=25
btrfs balance start -musage=50 -dusage=50


# cron.weekly / cron.monthly
btrfs balance start -musage=90 -dusage=90

A full balance run is then only needed if you add a new device to the
pool or replace a device with a bigger one.


if you are more interesseted about the block usage of your current fs
you can use this little script:

cd /tmp
wget https://raw.githubusercontent.com/kdave/btrfs-progs/master/btrfs-debugfs
chmod +x btrfs-debugfs
stats=$(sudo ./btrfs-debugfs -b /)

echo "00-49: " $(echo "$stats" | grep "usage 0.[0-4]" -c)
echo "50-79: " $(echo "$stats" | grep "usage 0.[5-7]" -c)
echo "80-89: " $(echo "$stats" | grep "usage 0.8" -c)
echo "90-99: " $(echo "$stats" | grep "usage 0.9" -c)
echo "100:   " $(echo "$stats" | grep "usage 1." -c)

The btrfs-debugfs script is from the btrfs progs source and report the
usage of each block group. The following script groups the result.

This script should take less than a few minutes to complete.

Or you can use btrfs-headmap with create a picture:
https://github.com/knorrie/btrfs-heatmap

Am Do., 10. Jan. 2019 um 19:21 Uhr schrieb Karsten Vinding
<karstenvinding@gmail.com>:
>
> Thanks for the answer.
>
> I had already tried "
>
> btrfs balance start -musage=75 -dusage=75 /mnt
>
> It only reallocated 3 blocks.
>
> But after I had moved some data, I ran it with 90, and it realocated a lot more.
>
> I have a new balance running, and this time it seems to be doing its job. At least data is distributed more evenly across disks.
>
> Its not done yet, but its looking fine.
>
>

  reply	other threads:[~2019-01-10 18:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08 19:40 Balance of Raid1 pool, does not balance properly Karsten Vinding
2019-01-09  1:08 ` Duncan
2019-01-09 17:20 ` Karsten Vinding
2019-01-09 20:47   ` Peter Becker
2019-01-10 18:21     ` Karsten Vinding
2019-01-10 18:58       ` Peter Becker [this message]
2019-01-11 22:04         ` Karsten Vinding

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='CAEtw4r1-YEotbHF-SF_N12by=d+6h=hwb9u8Rt6RFHeGZaw=Pw@mail.gmail.com' \
    --to=floyd.net@gmail.com \
    --cc=karstenvinding@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).