-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check btrfs: some alternative check modes #36
Comments
No, but it's not necessarily not a problem either. If your metadata stays the same size or gets smaller, there's no problem. If the metadata gets larger (which can happen even if the data is the same size, due to decreased average extent size, more directories or hardlinks, symlinks, xattrs, reflinks, snapshots, etc) and there's no free space left, the filesystem comes to a hard stop on ENOSPC. Ideally when the last block groups is allocated on the filesystem, there will be sufficient metadata allocations to fill up the data block groups and nothing more needs to be done; however, this cannot be guaranteed because metadata can be made arbitrarily large after all space on the disks has been allocated (e.g. by
The global reserve provides enough metadata to get through one btrfs transaction. This reserve allows you to add more disks if you've really run out of space, or delete some files or a snapshot, or maybe balance a data block group. It doesn't enable arbitrary metadata growth (e.g. touching every file in a snapshot)--you need unallocated space (or previously allocated metadata space) for that.
When low (but above zero) unallocated space is detected, start a data balance. When there is abundant unallocated space, cancel the data balance. Automate this with scheduling appropriate for your data and usage patterns to implement a minimal data balance regime. Most users need 3 + number_of_devices GB of free space for metadata at all times (on a filesystem over 50GB). Balance is (intentionally?) slower than data writing, so you'll need a higher free space target to allow for the amount of new data that will be added to the filesystem while the balance is running. As the filesystem gets closer to full, the data balance will run into the knapsack problem and will not release any more unallocated space; however, if you've been running balances while the filesystem fills up, you'll have a bit of extra metadata space allocated, and the filesystem will run out of data space before metadata space. Playing tug-of-war with data balances and unallocated space is messy and inefficient in iops. The other way to do it is to mount with Some suggestions that involve modifying the filesystem or the on disk data format:
|
Hey Zygo.
I see. With respect to btrfs itself, that probably means there's no golden solution... because the above could always easily happen, e.g. that one has still plenty of free space in data block groups... and then suddenly starts creating new dirs, or xattrs, etc.. But the point here was mainly with respect to All below is probably related to btrfs itself... and we should perhaps move that discussion back to the thread on linux-btrfs... (where I haven't had time to answer yet).
|
Hi! Checking if you're running out of unallocated raw disk space is indeed useful to get early signals about the problem that you're facing now. About the question on the mailing list about "Is there some way to see a distribution of the space usage of block groups?" Yes, there's Hans |
Hey.
Right now, check_btrfs allows to check for allocated/unallocated space.
btw: The option names and their descriptions may be a bit ambiguous with respect to allocated vs. unallocated.
First:
I'm not an expert, but is it (still) necessarily a problem if btrfs runs out of unallocated space?
I mean it has the global reserve... and if there is plenty of free space left in data respectively meta block groups, not having any unallocated space may not mean much, unless perhaps that balance will no longer be possible (which may however not be an issue).
And if there's still enough free space in the already allocated data respectively meta data block groups, ... most other things should continue to run just fine?
At the university here I run a large data centre for the LHC at CERN, and recently stumbled into the following situation:
https://lore.kernel.org/linux-btrfs/CAHzMYBR9dFVTw5kJ9_DfkcuvdrO4x+koicfiWgVNndh8qU2aEw@mail.gmail.com/T/#t
which I would like to be detectable by check_btrfs.
What happened there is basically that unallocated space was completely used up, quite some space (~800GB) was still free in the data block groups, but nothing (usable) was free in the meta-data block groups.
So while there would have been space for the file data itself, nothing was left for new file metadata, so one got
ENOSPC
.Of course, just checking for low unallocated space would also detect it, but would also ring the bell too often (namely when there's still enough left in the meta-data block groups.
So not sure how one could detect this better... maybe a check when unallocated space is below some threshold (or even 0) and free metadata space is also below some other threshold, while free data space is still above some threshold (otherwise, it would also report a fs, that's simply full).
Any ideas?
Cheers,
Chris.
The text was updated successfully, but these errors were encountered: