Someone brought up the issue of running out of space on btrfs and not being able to delete stuff. There are posts about this from years ago, but I wanted to see if it's still a problem.

The answer is... kind of, if you try hard enough and do absolutely unhinged things. I had to create a snapshot of a tiny (4GB) but full (data + metadata) filesystem with hundreds of thousands of files (with data, with xattrs, and empty to fill everything up) and then delete files without deleting the snapshot, retrying when I got an error and sync()ing the filesystem every time. At one point I managed to make the FS go read-only, and then remounting again and trying more torture in parallel shells eventually got it wedged into a state where it couldn't mount R/W at all (cannot do orphan cleanup due to -ENOSPC).

Even then, the FS was still mountable R/O (so all the data was recoverable). And even then, I found a way out: although you can't add a device to a FS that isn't mounted R/W, you can expand the base device with btrfs filesystem resize --offline, and you can use dm to glue two devices together temporarily for this purpose. I was able to mount R/W then, delete stuff the "proper" way (snapshots first), shrink again, and completely fix the situation.

So yeah, I don't think this is really a problem any more, more specific bugs notwithstanding. You have to try really really hard to cause the issue and even then there's still a way out.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://vt.social/users/lina/statuses/116169904206108341 on your instance and quote it. (Note that quoting is not supported in Mastodon.)