Skip to content
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

BTRFS filesystem requires more than 30MB (KIWI default minimum) #1835

Open
davidcassany opened this issue Jun 3, 2021 · 7 comments
Open

Comments

@davidcassany
Copy link
Collaborator

davidcassany commented Jun 3, 2021

Problem description

If building an OEM expandable image including btrfs LVM volumes, the minimal size used for those volumes turns to be 30MB (KIWI default). However BTRFS refuses to format a filesystem that is less than 128MB.

This can be reproduced with something like:

<systemdisk name="onit" preferlvm="true">
        <volume name="home"/>
        <volume name="root" size="5G" />
        <volume name="standby" size="5G" label="STANDBY"/>
        <volume name="tmp"/>
        <volume name="opt"/>
        <volume name="srv"/>
        <volume name="boot/grub2/i386-pc"/>
        <volume name="boot/grub2/x86_64-efi" mountpoint="boot/grub2/x86_64-efi"/>
        <volume name="usr/local"/>
        <volume name="var" copy_on_write="false" size="5G" label="VAR" mountpoint="/var"/>
        <volume name="containerd" copy_on_write="false" size="1G" label="CONTAINERD" mountpoint="/var/lib/rancher/k3s/containerd"/>
        <volume name="storage" copy_on_write="false" size="1G" label="STORAGE" mountpoint="/var/lib/rancher/k3s/storage"/>
        <volume name="rancherconf" copy_on_write="false" size="1G" label="RANCHERCONF" mountpoint="/etc/rancher"/>
    </systemdisk>

Producing an error similar to:

[ INFO    ]: 07:56:13 | Creating volumes(btrfs)
[ INFO    ]: 07:56:13 | --> volume home with 30 MB
[ ERROR   ]: 07:56:13 | KiwiCommandError: mkfs.btrfs: stderr: ERROR: '/dev/onit/home' is too small to make a usable filesystem
ERROR: minimum size for each btrfs device is 114294784
, stdout: btrfs-progs v4.19.1

Expected behaviour

Volumes creation does not fail.

OS and Software information

  • KIWI version:
  • Operating system:
  • OBS version:
@schaefi
Copy link
Collaborator

schaefi commented Jun 5, 2021

yeah we know btrfs is space hungry. The 30MB is a min size setting for a volume without a size setup. The setting is applied in addition to the data blocks of data which is found in the image root tree for this volume. These default setting works for any filesystem we have ... except btrfs.

As it's also not possible to pre calculate the size of a btrfs filesystem to hold X bytes of real blocks, there is no clean way for
a good default or size calculation. This is the reason why there is no extra handling of size for the btrfs filesystem and the only good answer I can give here is: specify a size :-)

All empiric methods I tried in the past failed for btrfs under certain circumstances

From a coding perspective we can have a conversation to maintain different volume
default sizes per volume management.

@staticmethod
def get_min_volume_mbytes():
    """
    Provides default minimum volume size in mbytes

    :return: mbsize value

    :rtype: int
    """
    return 30

This method is used in LVM and btrfs context

I'm fine to have this more granular, but I very much doubt it will really fix the size issue for btrfs filesystems

@davidcassany
Copy link
Collaborator Author

the only good answer I can give here is: specify a size :-)

Yes indeed, this is the same answer I gave on the chat conversation and apparently it did not work out. That's when I decided to fill the issue, the work around that actually worked was to include some dummy file of 128MB inside the offending volume. The problem of the above setup is that it is a really niche case, using LVM on top of btrfs is not so common and even less common in KIWI. However the description is a valid one. I have to admit I did not test myself this setup, however we discussed it with some user in the chat long and deep enough to make me think something unexpected was happening on KIWI side.

@Conan-Kudo
Copy link
Member

Why not just raise the minimum size?

@schaefi
Copy link
Collaborator

schaefi commented Jun 21, 2021

raise to what value to make btrfs happy ? This is non deterministic. I would rather go with David's suggestion and add an extra default size handling for btrfs in kiwi. That's what all the others did as well btrfs filesystem df vs. df ... same story

@Conan-Kudo
Copy link
Member

Sure, I guess. It makes sense to have that capability anyway.

@schaefi
Copy link
Collaborator

schaefi commented Jul 13, 2021

From the community meeting we agreed on:

  • provide one minimum default size setting for volumes
  • extend the interface for filesystems to allow setting a constraint for the minimum size
  • apply minimum size constraint to the btrfs filesystem from which we know the current default is not sufficient

@Conan-Kudo
Copy link
Member

Uhh did we ever do this? We still need to ensure Btrfs has a minimum size of 16MiB when using mkfs.btrfs --mixed and 109 MiB otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants