Skip to content

pkg/disk.yaml: add an option to not grow root#2524

Open
jbtrystram wants to merge 2 commits into
osbuild:mainfrom
jbtrystram:disk-dont-grow-rootfs
Open

pkg/disk.yaml: add an option to not grow root#2524
jbtrystram wants to merge 2 commits into
osbuild:mainfrom
jbtrystram:disk-dont-grow-rootfs

Conversation

@jbtrystram

Copy link
Copy Markdown
Contributor

Add a grow_root_to_fill_disk boolean option to allow not growing the root partition to use all available space. Defaults to true for backwards compatibility.

This allows creating disk images with empty available space, so users can create additionnal partitions or grow the root at first boot via e.g. cloud-utils-growpart.

See discussion in coreos/fedora-coreos-tracker#2188

Assisted-By: Opencode.ai <Opus 4.6>

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments below but more generally:

I'm not sure where this option fits better. I'll have to think about it some more but I think my preference right now is to make not growing the default behaviour for image definitions. We would have to keep the blueprint behaviour the same, so users don't get different behaviour, but the image definitions make no stability guarantees. So the new rules would be:

  • Partition tables in image definitions get created as they are described, with no growing.
  • Customizing a partition table from the blueprint does automatic things, including root growing.
  • Blueprint adds an option, somewhere, that prevents growing root to fill.
    • This could be a boolean, but it might also become an option that lets users control which filesystem to grow. In other words, it could be grow_to_fill = "<mountpoint>|None", with default value /, and None disabling the behaviour.
  • Grow to fill option is also added to image definitions for similar behaviour.

This is just a bit of brainstorming, so don't take any of these as instructions. We need to consider all side effects and how this fits into potential future behaviour first.

Comment thread pkg/disk/partition_table.go Outdated
Comment thread pkg/disk/partition_table.go
Comment on lines +40 to +44
// Controls whether the root partition (the one containing "/") is
// grown to fill the remaining disk space during relayout. Defaults
// to true (nil means true) to preserve backward compatibility. Set
// to false to keep the root partition at its specified size.
GrowRootToFillDisk *bool `json:"grow_root_to_fill_disk,omitempty" yaml:"grow_root_to_fill_disk,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like booleans defaulting to true. We do have it in a few places, but that's usually when interacting with external configs and their defaults. If we're making our own, I'd rather avoid it.

Negative bools (like DisableX = true) are also a bit tricky and error prone. But this whole discussion is moot anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it default to true so it keep the same existing behavior when not specified, to not change people that haven't changed their configs.

Add a `grow_root_to_fill_disk` boolean option to allow not growing the
root partition to use all available space. Defaults to `true` for
backwards compatibility.

This allows creating disk images with empty available space, so users
can create additionnal partitions or grow the root at first boot
via e.g. `cloud-utils-growpart`.

See discussion in coreos/fedora-coreos-tracker#2188

Assisted-By: Opencode.ai <Opus 4.6>
@jbtrystram
jbtrystram force-pushed the disk-dont-grow-rootfs branch from f486058 to c3343a0 Compare July 16, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants