From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: btrfs balance on single device
Date: Sun, 15 Dec 2013 23:28:21 +0000 (UTC) [thread overview]
Message-ID: <pan$138cb$448d68e$2d9dcb10$fc6a898a@cox.net> (raw)
In-Reply-To: CAAeznTryb7kyuvEyBFniv-UtGCQwdNtZMhpxm=-2MtKZSOj9Tw@mail.gmail.com
Leonidas Spyropoulos posted on Sun, 15 Dec 2013 20:28:05 +0000 as
excerpted:
> Oh, so the df report from btrfs doesn't show the total as 'free'! But it
> means how much space the filesystem allocated so far.
Yes.
Btrfs allocates in chunks, 256 MiB at a time for metadata (but on a
single device, metadata chunks are DUP by default, so two are created at
once, thus half a gig), 1 GiB at at a time for data (single device
values, when there's plenty of unallocated space left in ordered to do
so). As these chunks are filled up new ones are allocated as necessary
(assuming there's enough unallocated space left to do so).
But normal usage including deleting old files and rewriting parts of
existing files (to new locations due to btrfs' copy-on-write/COW
semantics) will often leave several partially filled chunks around, and a
balance rewrites chunks, consolidating into fewer new chunks when
possible as it does so.
That's what the btrfs fi df reports showed, many partially filled chunks
before the balance, fewer but full chunks afterward, with the freed chunk
space returned to the unallocated pool.
While btrfs fi df could report unallocated space as well, given the
possibility of it being allocated differently (DUP vs SINGLE, and on
multi-device filesystems, the various raid modes), it can't reliably
predict how that unallocated space will be used and thus how much
/effective/ free space you have.
But btrfs fi show gives the total filesystem size, as well as the total
allocated. So between df and show, plus a little math if necessary, you
get a better picture.
--
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
next prev parent reply other threads:[~2013-12-15 23:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-15 20:20 btrfs balance on single device Leonidas Spyropoulos
2013-12-15 20:24 ` Hugo Mills
2013-12-15 20:28 ` Leonidas Spyropoulos
2013-12-15 23:28 ` Duncan [this message]
2013-12-16 23:22 ` Leonidas Spyropoulos
2013-12-17 5:02 ` Duncan
[not found] ` <CAAeznTpZ6p1_ZR6xy-YGynAJu88jZ_52AQURuxT4qTeEYLOjdg@mail.gmail.com>
2013-12-18 10:44 ` Leonidas Spyropoulos
2013-12-18 11:05 ` Hugo Mills
2013-12-18 11:29 ` Leonidas Spyropoulos
2013-12-19 8:14 ` Leonidas Spyropoulos
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$138cb$448d68e$2d9dcb10$fc6a898a@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).