"No space left on device" But I have free space left

Unallocated went to zero. Therefore no way to add more metadata block groups. Therefore eventually the existing ones got filled up.

The workload does matter, and how it ages matters too.

I do not manually balance at all in years, but I have recently enabled dynamic reclaim. If you are manually rebalancing (not really recommended for most use cases) do a filtered balance to limit it to data block groups. The btrfsmaintenance package has systemd service and timer units that uses filtered balance, so that’s OK too if you’re not interested in testing and reporting problems.

I personally would rather run into problems, and then get them reported upstream for broader improvement. But I realize this is not everyone’s cup of tea!

Does this mean that btrfs cannot allocate new metadata blocks on the second device, only data blocks, or is it unable to allocate metadata as this would also require free blocks for metadata on device 1 to make the allocation on device 2?

similar to xfs. I encountered something like this in a middle size environment ~150 - 200 systems. At some point, their NFS filesystems would be unable to create new files / inodes. FS had to be extended to allow xfs to allocate new blocks for inodes.
It turned out that the xfs filesystems were all heavily fragmented, and at some point all free data blocks did consist of single, max three consecutive blocks only! But XFS needs at least 4 consecutive blocks = 16KiB for inodes!
For some reason they had the nfs mount option noac enabled on all nfs clients, which had overridden virtually every optimization xfs can do to prevent/limit fragmentation. And ofc. the write performance was horrible. :scream:

The python script reminds me of xfs_db -r -c 'freesp -s' <device> or xfs_db -r -c 'frag ' <device>.

If starting out with a single device btrfs, and adding a 2nd device, it should be able to allocate any block group type.

Adding the device implies a kind of mkfs - superblocks will be written, and then because btrfs must update the device btree but can’t write to device 1, therefore must write to device 2, it must first create a metadata chunk on device 2, and that means updating the chunk btree which is stored in system bg. So a totally full single device btrfs, adding a 2nd device means creating at least a system (chunk btree) and metadata (all other btrees) chunk on that 2nd device. Right away. So that’ll either succeed or fail.

it’s potentially trickier with more devices.

Thanks for this post and to all the helpers. I was certainly very confused when I was getting the “No space left on device” errors when I was seeing 77G of free space on the drive.

Symptoms were being unable to update, write files, couldn’t open certain apps (like browsers, disk usage analyzer), frequently getting kicked to the user login screen (following a short black screen), couldn’t use the GNOME system menu Power button (it would just do the black screen → login screen thing). Thankfully poweroff still worked.

Due to being kicked to login screen frequently, I booted into a Fedora 44 live USB and mounted the BTRFS volume for the rest.

$ sudo btrfs filesystem usage /run/media/liveuser/fedora
Overall:
   Device size:                    236.89GiB
   Device allocated:               236.89GiB
   Device unallocated:               1.00MiB
   Device missing:                     0.00B
   Device slack:                       0.00B
   Used:                           159.13GiB
   Free (estimated):                76.92GiB     (min: 76.92GiB)
   Free (statfs, df):               76.92GiB
   Data ratio:                          1.00
   Metadata ratio:                      2.00
   Global reserve:                 432.16MiB     (used: 0.00B)
   Multiple profiles:                     no

Data,single: Size:220.87GiB, Used:143.95GiB (65.18%)
  /dev/nvme0n1p3        220.87GiB

Metadata,DUP: Size:8.00GiB, Used:7.59GiB (94.86%)
  /dev/nvme0n1p3         16.00GiB

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

Looking at the above, Device allocated + unallocated (and maybe the Metadata) should be what stand out, yes?

First balance attempt failed with “No space left on device”, unsurprisingly.

$ sudo btrfs balance start -dusage=50 /run/media/liveuser/fedora

Followed by sudo dmesg | tail, which mentioned ‘77 enospc errors during balance’

Unlike the original poster, I could afford to delete some files. I deleted one of my Steam games that was >1GiB, ran the balance command with -dusage=50 again and that fixed the issue for me- ‘Device unallocated’ now showed as 80GiB, and I was able to run some updates normally. Yay!

I’ll look into enabling dynamic reclaim now. Is it still recommended? From what I can tell, it was being tested last year, but I’m not seeing it mentioned in more recent discussions, and it doesn’t appear to have been enabled by default yet.

I can still recommend dynamic reclaim. It should help more often than not.

Upstream is just being deliberate, but eventually it will become the default and will continue to be improved.

Note that most of the time dynamic reclaim won’t do anything. If one of the trigger thresholds is met, it will use existing balance code path in a very limited (filtered) manner. Dynamic reclaim will either work or it won’t; and if it’s doesn’t work, you’re not worse off than “no space left on device”.

Thanks for the info- it sounds worthwhile to me, especially given how easy it is to enable. In case others who are searching may not have come across this info yet, I’ll include the info on checking if it is enabled as well as enabling it.

I’d checked to see if it was already enabled using the command from this post:

cat /sys/fs/btrfs/*/allocation/data/dynamic_reclaim

It wasn’t enabled, of course, so I grabbed the BTRFS filesystem’s UUID from btrfs fi show, then used the method from this post (thanks again, Chris!) and rebooted after:

$ sudo nano /etc/tmpfiles.d/btrfs-enable-reclaim.conf 

<insert into the file> where $UUID is the UUID for the btrfs file system in question
 
# enable dynamic and periodic reclaim on "butterpool" for data block groups
w /sys/fs/btrfs/$UUID/allocation/data/dynamic_reclaim - - - - 1
w /sys/fs/btrfs/$UUID/allocation/data/periodic_reclaim - - - - 1

@vzak11 Please be nice to others and follow the CoC when posting. If you think something is wrong or even dangerous, tell people in a neutral way without offending them or dismissing their issues, or just flag the posts: then a mod can take over :classic_smiley: You also can just ignore something that you think is not worth your time. It’s not realistic to respond to everything, for any of us, so we all must ignore a lot anyway :smiley:

We don’t prohibit discussion.
We do prohibit personal attacks and enforce compliance with the fedora CoC.

You can see the moderation guidelines here.

Sorry, could you explain my witch “personal attacks” I did there? It was only about thema of thread.

This in itself is an attack since you are calling everyone who uses btrfs ‘stupid’

Specifically it implies that the OP who has the problem is stupid as well for using the default file system on fedora.

Your post was off topic and contrary to the CoC which requires that nothing personal should be posted, and only discussion of the facts should occur. Additionally your post added nothing except a personal opinion to the thread and should not have appeared.

Read the CoC and ensure that your posts comply with its requirements. You may also want to review the Moderation Guidelines which specify how infractions are handled.

The warning by @py0xc3 above is valid.

Hmm, I wrote about “stupid problems” of solution - not about people. Do you think, that it is problems?

I expected that discussion would be about advatages or disadvatages of CoW fs. I could see only problems. Btrfs/zfs is not a “holy grail”.

O.K. it is discusion there…

Hello,

I don’t like to reopen this thread, but I have a new information:

Hmm, I expect, that you know it via internal channels.

Sorry, for my name of Fedora users: “would you like a testing guina pigs”, but as you know, we are “a testing guina pigs” for RedHat. Fedora is the development version of RedHat.

Sorry, for my behaviour in this thread, but I’m a bit butcher…

No need for internal channels - it’s publicly discussed on this site.

O.K. we will we see what it bring. My apology, but I’m a bit conservative. Not every a new solution are better than older. Hawgh…

My two cents:

  1. OP has every reason to expect the ability to create a new directory with 88% usage of the fs. It’s a teeny tiny amount of additional metadata.
  2. Btrfs is similar to XFS in that there is no distinction between privileged and non-privileged user space usage, i.e. there’s no reserve for root only like ext234. Therefore it’s inevitable we’re depending on the desktop environment to warn the user when free space gets too low. 88% is not at the GNOME Shell threshold for such a warning though.
  3. It may not seem like it but I interpret @vzak11 's criticism as directed on the technology failures giving users a hard time. I think that’s appropriate and on topic.
  4. I suggest any one tag Btrfs discussions with @chrismurphy so I get pinged or bug me on matrix in most any room but in particular we have https://matrix.to/#/#btrfs:fedoraproject.org as a dedicated room for this topic.
  5. I am not sensitive to Btrfs criticism. Some of it is deserved, some of it isn’t. It’s fine to discuss it but in general it’s helpful if the criticism contains some level of detail.

One thing to note is that nothing gets better without troubleshooting. And troubleshooting file systems can be super tedious which is one reason why folks runs to fsck, and then we lose the file system state that can tell us why the problem happened in the first place. The user wants to get back to work (entirely reasonable) while fs devs need present file system state information (entirely reasonable but conflicts with users getting back to work).

Anyway I think we’re doing pretty well on the Btrfs front. There are some problems, it’s not zero. But also there are fewer problems than a lot of people feared. And it has solved a number of significant issues, perhaps especially confusion over having available free space in / or in /home but not automatically being able to use that free space in another partition.