Results 1 to 3 of 3

Thread: btrfsmaintenance detect_mixed_bg -- What is a mixed block group?

  1. #1
    Join Date
    Apr 2016
    Location
    North America
    Posts
    537

    Default btrfsmaintenance detect_mixed_bg -- What is a mixed block group?

    Code:
    # function: detect_mixed_bg
    # parameter: path to a mounted filesystem
    #
    # check if the filesystem contains mixed block groups,
    detect_mixed_bg() {
        # simple test is to read 'btrfs fi df',
        # (we could look for /sys/sfs/btrfs/UUID/allocation/mixed if we know
        # the UUID)
    
        btrfs filesystem df "$1" | grep -q "Data+Metadata"
    }
    https://github.com/kdave/btrfsmainte...ance-functions

    This is called in https://github.com/kdave/btrfsmainte...rfs-balance.sh
    but I'm not understanding what a "mixed block group" is;
    although, I'm guessing it has to do with data and metadata being in the same block.

    The following returns nothing on my system, which I guess means no "mixed block groups" were detected.
    Code:
    btrfs filesystem df / | grep -q "Data+Metadata"
    What is a mixed block group?
    In what situation is one created?
    What would the output of this command look like if one was detected?

  2. #2
    Join Date
    Apr 2016
    Location
    North America
    Posts
    537

    Default Re: btrfsmaintenance detect_mixed_bg -- What is a mixed block group?

    -M|--mixed

    Normally the data and metadata block groups are isolated. The mixed mode will remove the isolation and store both types in the same block group type. This helps to utilize the free space regardless of the purpose and is suitable for small devices. The separate allocation of block groups leads to a situation where the space is reserved for the other block group type, is not available for allocation and can lead to ENOSPC state.

    The recommended size for the mixed mode is for filesystems less than 1GiB. The soft recommendation is to use it for filesystems smaller than 5GiB. The mixed mode may lead to degraded performance on larger filesystems, but is otherwise usable, even on multiple devices.

    The nodesize and sectorsize must be equal, and the block group types must match.

    Note: versions up to 4.2.x forced the mixed mode for devices smaller than 1GiB. This has been removed in 4.3+ as it caused some usability issues.
    https://btrfs.wiki.kernel.org/index.....btrfs#OPTIONS

    So I guess if this wasn't used when the filesystem was created, you will never have mixed block groups.

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,829
    Blog Entries
    2

    Default Re: btrfsmaintenance detect_mixed_bg -- What is a mixed block group?

    Quote Originally Posted by ravas View Post
    https://btrfs.wiki.kernel.org/index.....btrfs#OPTIONS

    So I guess if this wasn't used when the filesystem was created, you will never have mixed block groups.
    I'd agree,
    I'd assume that once the partition has been formatted with BTRFS (not the volumes), you can't modify how the metadata is stored.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •