Open
Conversation
Currently, the 'new' method can be used to effectively manage partitions
in an image when the source image does not have the desired layout.
However, it relies on a root filesystem archive, which is not available
in all cases (e.g. Ubuntu does not publish Raspberry Pi rootfs
archives).
The 'repartition' method allows for taking an existing image and
changing its partitions. That is, partitions may be arbitrarily created,
grown, shrunk, or destroyed: this is done according to the partition
layout we give in the image config.
This adds two new options to partition configuration:
* `resize_fs`: Whether to run resize2fs on the partition after
repartitioning. This is necessary because:
- Not all partitions can be resized with resize2fs (e.g. NTFS)
- Only the user knows whether or not a partition from the source image
has been resized
* `skip_mkfs`: If true, the partition will **not** be formatted with
mkfs in repartition mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR creates a new image build method,
repartition, which doesn't add much (or any, really) new functionality, but rather re-uses existing steps, effectively combining thenewandresizemethods.This allows the user to, using a raw image file as a basis:
image_partitionsconfig)mkfs(the user chooses which partitions they want to format, as we don't know which ones are 'newly created' since we don't parse partition tables of existing images)resize2fsThis is something that was especially useful in my particular use-case, but I think it could be useful more widely as well, hence this PR :)
Use-cases
/homepartitionBackwards compatibility
I've tried to make this change entirely backwards-compatible, so that no existing builds will be affected by it.
To do this:
skip_mkfsdefaults to false, and hence the Mkfs step behaviour is unchanged (it's only currently used with thenewmethod, as far as I can tell, in which case we shouldn't be skipping it by default for any partitions)resize_fsonly has an effect when using the repartition method, and hence the behaviour of the resize step should be unchanged