From: Hugo Mills <hugo@carfax.org.uk>
To: Jeremy Yoder <jmyoder@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Data total size shrinking during btrfs balance
Date: Sun, 9 Oct 2016 21:08:37 +0000 [thread overview]
Message-ID: <20161009210837.GD7683@carfax.org.uk> (raw)
In-Reply-To: <CALbEpLMp0L1aCCp5_ctYq_HE-XkW7XbXnNKP3SvDKcmxWYgOXw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4006 bytes --]
On Sun, Oct 09, 2016 at 04:59:04PM -0400, Jeremy Yoder wrote:
> I didn't notice this until it was nearly too late. I had run out of
> metadata space so I ran
> btrfs balance start -v -dusage=0 /mnt/btrfsroot
>
> That went fine, but I was still low on metadata space, so I tried a
> few variations:
> btrfs balance start -v -dusage=1 /mnt/btrfsroot
> btrfs balance start -v -dusage=5 /mnt/btrfsroot
> btrfs balance start -v -dusage=10 /mnt/btrfsroot
>
> I didn't run any of these to completion, I cancelled them after a few hours.
>
> I captured the output of a couple commands every once in a while:
> btrfs fi df /mnt/btrfsroot
> btrfs fi show /dev/sda5
>
> What I didn't notice (because I was looking at the metadata space) was
> the Data total size.
>
> It starts out as:
>
> Data, single: total=4.61TiB, used=2.50TiB
> System, DUP: total=8.00MiB, used=576.00KiB
> System, single: total=4.00MiB, used=0.00
> Metadata, DUP: total=46.50GiB, used=42.82GiB
> Metadata, single: total=8.00MiB, used=0.00
> unknown, single: total=512.00MiB, used=0.00
>
> Label: none uuid: e6818780-7d28-41fe-b7a8-e38b61a98621
> Total devices 1 FS bytes used 2.54TiB
> devid 1 size 5.35TiB used 4.70TiB path /dev/sda5
>
> Over time however, the Data total begins to drop:
> Data, single: total=4.56TiB, used=2.50TiB
> Data, single: total=4.41TiB, used=2.50TiB
> Data, single: total=4.23TiB, used=2.51TiB
> Data, single: total=4.00TiB, used=2.51TiB
> Data, single: total=3.59TiB, used=2.51TiB
> Data, single: total=3.35TiB, used=2.51TiB
>
> The drop corresponds to a drop in the "show" used amounts:
> devid 1 size 5.35TiB used 4.65TiB path /dev/sda5
> devid 1 size 5.35TiB used 4.50TiB path /dev/sda5
> devid 1 size 5.35TiB used 4.32TiB path /dev/sda5
> devid 1 size 5.35TiB used 4.09TiB path /dev/sda5
> devid 1 size 5.35TiB used 3.68TiB path /dev/sda5
> devid 1 size 5.35TiB used 3.44TiB path /dev/sda5
>
> System info:
> Ubuntu 14.04
> Linux server4 4.4.0-38-generic #57~14.04.1-Ubuntu SMP Tue Sep 6
> 17:20:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
>
> I had been running the 14.04 btrfs-progs version 3.12-1ubuntu0.1
>
> I just upgraded to btrfs-progs 4.4.1~ubuntu14.04.1~ppa1 from a PPA,
> which allowed me to run
> # btrfs fi usage /mnt/btrfsroot/
> Overall:
> Device size: 5.35TiB
> Device allocated: 3.44TiB
> Device unallocated: 1.91TiB
> Device missing: 0.00B
> Used: 2.59TiB
> Free (estimated): 2.75TiB (min: 1.80TiB)
> Data ratio: 1.00
> Metadata ratio: 2.00
> Global reserve: 512.00MiB (used: 0.00B)
>
> Data,single: Size:3.35TiB, Used:2.51TiB
> /dev/sda5 3.35TiB
>
> Metadata,DUP: Size:46.50GiB, Used:42.07GiB
> /dev/sda5 93.00GiB
>
> System,DUP: Size:32.00MiB, Used:416.00KiB
> /dev/sda5 64.00MiB
>
> Unallocated:
> /dev/sda5 1.91TiB
>
> Any suggestions?
Do nothing. The FS is working as designed. :)
The "Data, total" value you're worried about is the amount of space
currently allocated for use as data. The balance operation takes a
chunk of data allocation, and moves any data in it to other chunks.
Once the chunk is empty, it's freed up. Now, when the data is moved,
it will typically go to any free allocated space first; only if there
isn't any free space allocated for data will more space be allocated.
So, the normal behaviour is that when you run a balance, the data is
effectively compacted into fewer chunks, and the unused chunks are
freed up. If the FS needs more chunks allocated, it will do so
automatically, so you're not losing anything here.
Hugo.
--
Hugo Mills | You know... I'm sure this code would seem a lot
hugo@... carfax.org.uk | better if I never tried running it.
http://carfax.org.uk/ |
PGP: E2AB1DE4 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-10-09 21:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 20:59 Data total size shrinking during btrfs balance Jeremy Yoder
2016-10-09 21:08 ` Hugo Mills [this message]
2016-10-09 21:35 ` Jeremy Yoder
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=20161009210837.GD7683@carfax.org.uk \
--to=hugo@carfax.org.uk \
--cc=jmyoder@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