Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* Data total size shrinking during btrfs balance
@ 2016-10-09 20:59 Jeremy Yoder
  2016-10-09 21:08 ` Hugo Mills
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Yoder @ 2016-10-09 20:59 UTC (permalink / raw)
  To: linux-btrfs

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Data total size shrinking during btrfs balance
  2016-10-09 20:59 Data total size shrinking during btrfs balance Jeremy Yoder
@ 2016-10-09 21:08 ` Hugo Mills
  2016-10-09 21:35   ` Jeremy Yoder
  0 siblings, 1 reply; 3+ messages in thread
From: Hugo Mills @ 2016-10-09 21:08 UTC (permalink / raw)
  To: Jeremy Yoder; +Cc: linux-btrfs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Data total size shrinking during btrfs balance
  2016-10-09 21:08 ` Hugo Mills
@ 2016-10-09 21:35   ` Jeremy Yoder
  0 siblings, 0 replies; 3+ messages in thread
From: Jeremy Yoder @ 2016-10-09 21:35 UTC (permalink / raw)
  To: Hugo Mills, Jeremy Yoder, linux-btrfs

Interesting.  I've always noticed that value to be fairly close to the
total drive size, so I just assumed it was supposed to match.

Thanks!
Jeremy

On Sun, Oct 9, 2016 at 5:08 PM, Hugo Mills <hugo@carfax.org.uk> wrote:
> 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          |

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-09 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-09 20:59 Data total size shrinking during btrfs balance Jeremy Yoder
2016-10-09 21:08 ` Hugo Mills
2016-10-09 21:35   ` Jeremy Yoder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox