-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add the btrfs partitioning mode #694
Conversation
I can't say for sure (I don't remember), but I bet we gave little consideration for this when adding it. It was probably a decision to add it and figure out the config later. Like you said, it's a sane enough default.
I remember thinking about this, going back and forth on ideas for how to handle sizing. One idea was to sum up the min sizes and set the whole volume as the sum. Erroring out on sizing for subvols also makes sense though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not got very far but some nitpicks/comments ideas inline before I call it a day :) Thanks for the work on this, looks very nice so far and I really think this will help bootc!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks very nice! I focused on the code in the review and did not dig into how fedora uses btrfs and how that maps but it seems also fine. Great stuff, some ideas/nitpicks inline but no blockers (from my POV).
Or only error if the min-size is larger than the total volume size? |
This PR is stale because it has been open 30 days with no activity. Remove "Stale" label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 30+7 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I have some git commit and history related nitpicks:
- There are a couple of commits with long messages.
- Can we get the history cleaned up a bit? For instance squashing the small follow-up commits into the ones that introduced the small issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw, I like it but my review only counts +0.5 as I did a bunch of tweaks to it. If this gets merged I will also look at a small followup to see if #694 (comment) makes sense and I am thinking about testing this more, maybe via #732 even - we give the partition code a bunch of inputs and see if we get the expected btrfs (but maybe I'm overthinking things here :)
Merge conflicts |
Prior this commit, the GenUUID method of Btrfs didn't propagate the generated UUID to a subvolume. Thus, when GetFSSpec was called on the subvolume, an empty UUID was returned. Thus, invalid kernel arguments were generated (for root fs), and the system rendered to be unbootable.
ForEachMountable is called for every subvolume, thus if there was one btrfs partition with multiple subvolumes, the code generated multiple mkfs.btrfs stages for one partition, breaking the build. This commit adds a tiny bit of logic for ensuring that we call mkfs just once per each partition.
So the code just panicked before. Let's generate a device name in a similar way as we do for a luks container.
This commit also adds a test that covers both mkfs.btrfs (see the previous commit) and creating subvolumes.
This commit also adds a semi-fake partition table with a Btrfs setup.
This commits also removes the generic opts (MntOpts) from btrfs subvolumes. They were not used anywhere, and I think it's much better to make all supported mount options explicit, rather than storing them in a generic array.
TODO: needs tests The conversion code from raw partitioning is basically the same as the one for LVM. The main difference is that LVM just embeds an already defined filesystem, but btrfs-ication needs to do some guessing because the code actually creates a new partition: specifically, I just hardcoded the compression to zstd:1. This is not ideal, but it's the Fedora's default, so it's imho fine as the first iteration.
This is weird, because we just hardcode zstd:1, but it's good enough for the starters (and also inspired by Fedora). I also introduced a constant for the default btrfs compression.
If the base partition table uses a read-only root filesystem (ostree), let's respect that when converting the root to a btrfs subvolume.
Add new TestGenImageKernelOptionsBtrfsNotRootCmdlineGenerated() to check that no commandline is generated for non "/" partitions.
A new test TestCreatePartitionTableBtrfsify was added. This test also uncovered a small bug in ensureBtrfs() that got fixed along the way.
Should be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving but the error from the linter should be fixed to avoid weird loop side-effects.
Linter error is addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, the changes from Michael are wonderful, thanks!
(This is a revived #422.)
This PR has basically three parts:
Weird parts:
TODO:
ensureBtrfs
)