linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: Is it necessary to balance a btrfs raid1 array?
Date: Thu, 11 Sep 2014 11:10:32 +0000 (UTC)	[thread overview]
Message-ID: <pan$adf48$e9cbe46e$6e0e0ee7$acdeaa9a@cox.net> (raw)
In-Reply-To: lurrju$n90$1@ger.gmane.org

Bob Williams posted on Thu, 11 Sep 2014 10:56:14 +0100 as excerpted:

> So if a RAID1/two disk system uses the disks symmetrically, why did my
> balance command take 22 hours? That's what puzzles me, as my
> understanding of RAID1 is that the disk use *is* symmetrical.

What you're missing is what balance actually /does/.

Balance will take every chunk it sees, data or metadata (with metadata 
including system as well), and rewrite it to a new location.  In simplest 
conception that's /all/ it does.

So your 22 hours was the time it took to rewrite-shift, effectively, the 
entire filesystem, one chunk at a time, from one location to another.

Now it so happens that in the process balance does a bunch of other stuff 
too, like combine partially empty blocks of the same type during the 
rewrite, filling them up such that the rewritten version likely takes 
fewer chunks than the original, thus having the effect of freeing the 
extra chunks back to unallocated space that's now again free to be used 
for data or metadata instead of tied up in chunks that are one or the 
other but can't be switched.

And after adding/deleting devices, that rewrite process balances out 
usage between devices.

And with the convert option (used with -d or -m, below) that rewrite can 
be used to convert the rewritten chunks to some other raid layout than 
the original.

And with the -d and -m options (along with -s), you can limit the chunks 
balance looks at to data or metadata (the latter including system as 
well, -s) instead of all chunks.

And with the usage option (along with -d or -m, above), you can limit the 
chunks looked at to those under a particular percentage fill, thus 
allowing to do the chunk consolidation more efficiently without taking 
time to do ALL chunks of that type as it would otherwise do.

But bottom line, balance is a chunk rewriter, and you told it to rewrite 
everything on the filesystem, so that's exactly what it did.  And with 
nearly a TB of data on spinning rust, that took awhile, about 22 hours 
"awhile"!

-- 
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


  reply	other threads:[~2014-09-11 11:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 12:27 Is it necessary to balance a btrfs raid1 array? Bob Williams
2014-09-10 13:06 ` Austin S Hemmelgarn
2014-09-10 13:48   ` Rich Freeman
2014-09-10 14:41     ` Austin S Hemmelgarn
2014-09-10 17:44   ` Bob Williams
2014-09-10 18:43 ` Goffredo Baroncelli
2014-09-10 19:32   ` Sean Greenslade
2014-09-10 22:28     ` Goffredo Baroncelli
2014-09-11  1:25       ` Sean Greenslade
2014-09-11  3:51         ` Zygo Blaxell
2014-09-11  4:23           ` Sean Greenslade
2014-09-11  6:55           ` Duncan
2014-09-11  9:56   ` Bob Williams
2014-09-11 11:10     ` Duncan [this message]
2014-09-11  4:30 ` Zygo Blaxell
2014-09-11  9:08   ` Bob Williams

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='pan$adf48$e9cbe46e$6e0e0ee7$acdeaa9a@cox.net' \
    --to=1i5t5.duncan@cox.net \
    --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).