Confused with BTRFS filesystem - why is it full?

When performing today’s update, I had to make extra space for it to complete.

The problem is that I don’t know why it’s full - I’m seeing 12.7GiB available on my 250GiB SSD.

Yet filelight looks like this:


Showing only 47.5GiB (which seems reasonable).

So why isn’t there 200GiB free???

I ran my cleanup:

sudo pacman -Sc && pamac clean --build-files && paccache
 -rvuk0 && paru --clean && flatpak uninstall --unused && sudo journa
lctl --vacuum-time=3h && sudo journalctl --flush --rotate
~  df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       233G  183G   41G  82% /
❯ \df -h -hT /home
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda2      btrfs  233G  183G   41G  82% /home

ncdu / --exclude /mnt for the local disk:

Total disk usage is reported as 41.0 GiB… but there’s only 40 GiB free from 250 GiB

Help!!!

Hello @Ben :wink:

What about your snapshots/subvolumes since you use btrfs?

Maybe that help you to get the size of each subvolume:

Please do use btrfs-command when using btrfs

Please post
sudo btrfs filesystem usage -h /

like:

sudo btrfs filesystem usage -h /                                                                                                                 ✔ 
[sudo] Passwort für andreas: 
Overall:
    Device size:		  1.76TiB
    Device allocated:		  1.33TiB
    Device unallocated:		441.94GiB
    Device missing:		    0.00B
    Device slack:		    0.00B
    Used:			  1.12TiB
    Free (estimated):		323.62GiB	(min: 323.62GiB)
    Free (statfs, df):		323.62GiB
    Data ratio:			     2.00
    Metadata ratio:		     2.00
    Global reserve:		512.00MiB	(used: 0.00B)
    Multiple profiles:		       no

Data,RAID1: Size:671.00GiB, Used:568.35GiB (84.70%)
   /dev/sda2	671.00GiB
   /dev/nvme0n1p3	671.00GiB

Metadata,RAID1: Size:8.00GiB, Used:6.38GiB (79.71%)
   /dev/sda2	  8.00GiB
   /dev/nvme0n1p3	  8.00GiB

System,RAID1: Size:32.00MiB, Used:128.00KiB (0.39%)
   /dev/sda2	 32.00MiB
   /dev/nvme0n1p3	 32.00MiB

Unallocated:
   /dev/sda2	220.97GiB
   /dev/nvme0n1p3	220.97GiB

Please have a special look at Unallocated:

du only shows what you have in your active subvolume !
But if you took snapshots, they are not acounted by du

Please use
btrfs subvolume list --help


You can find good Information about Btrfs in the wiki

1 Like

See here:

You need to create multiple separate subvolumes: Downloads, VM images, Games, multiple media and some unnecessary data (It exists everywhere in Internet). You do not need to take snapshots for them.

This cannot be the solution. You can use one volume as root and everything should work.

1 Like

I really should look to ditch Timeshift and set up Snapper properly.
For now, I simply deleted all the snapshots (previously I deleted 3, leaving 3 - it didn’t make much of a dent probably because the content of my root is fairly stable).

Anyway, I’m now seeing 114GiB free which seems okay.

I’ve also downloaded this thread as a MarkText, so I’ll edit and pare it down and start learning more.

sudo btrfs filesystem usage -h /

Overall:
    Device size:		232.59GiB
    Device allocated:		228.02GiB
    Device unallocated:		  4.56GiB
    Device missing:		    0.00B
    Device slack:		  512.00B
    Used:			105.34GiB
    Free (estimated):		114.12GiB	(min: 111.84GiB)
    Free (statfs, df):		114.12GiB
    Data ratio:			     1.00
    Metadata ratio:		     2.00
    Global reserve:		351.75MiB	(used: 0.00B)
    Multiple profiles:		       no

Data,single: Size:210.01GiB, Used:100.45GiB (47.83%)
   /dev/sda2	210.01GiB

Metadata,DUP: Size:9.00GiB, Used:2.44GiB (27.17%)
   /dev/sda2	 18.00GiB

System,DUP: Size:8.00MiB, Used:48.00KiB (0.59%)
   /dev/sda2	 16.00MiB

Unallocated:
   /dev/sda2	  4.56GiB

A special shoutout to @andreas85 who pretty much found my ‘Error 40’ moment.

So the confusion arises from the subvolume structures and filesystem reporting which excludes snapshots.

This is quite a hideous issue, that subvolumes that take physical space aren’t listed or referred to.

Thanks for that information, I remember the last time I met this issue I also cured it by basically purging them all and taking a fresh one.

I’m determined to stay on top of it, I couldn’t imagine giving up BTRFS.

Thanks for the input. Any additional comments are welcome, I’m starting a new notebook for this - it’s hard for my brain to adjust and wrap around it.

Be careful! Only unallocated counts !!!

(forget about “free”)

after deleting some snapshots this will rise :wink:

After removing snapshots i often do as root:

watch btrfs filesystem usage -h /

Then after a while i do:

btrfs balance start -musage=50 -dusage=50 /
Then after a while :

btrfs balance start -musage=70 -dusage=70 /
Then after a while :

btrfs balance start -musage=90 -dusage=90 /

:footprints:

A healthy btrfs needs to have 10% unallocated at least !

2 Likes

Sweet - so I get a live view in the top window - good because balance has no output or indication.

Live view also of unallocated, which just went past 70GiB after 3-4 minutes…


Time enough, perhaps to RTFM about Balance Filters.

Okay, so the musage/dusage 50 pass is complete.

had to relocate 84 out of 221 chunks

Unallocated: 92.52 GiB
Data: 132 GiB, used 103.04 GiB (78%)
Metadata, DUP: 4 GiB used 2.59 GiB (64.81%)
System, DUP: Size 32 GiB used 48kib (0.15%)

So that looks nice - back to the RTFM link now for a while.
Cheers guys - adding this to my notebook for sure :wink:

Also, for now, I’ll get information conky panel pop up for 15 seconds after launching conky to keep an eye on things… this seems an important aspect to monitor - and look at schedule checks/warnings/maintenance.

Screenshot_20230126_071915

1 Like

I am writing a new page in the wiki

If you have wishes, what to place there … :footprints:

2 Likes