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

When changing format of a new partition, don't require wipe #2148

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Jan 27, 2025

No description provided.

if data.partition.format is not None:
if data.partition.format != partition.original_fstype():
if data.partition.wipe is None:
raise ValueError("changing partition format requires a wipe value")
if data.partition.wipe is None and partition.preserve:
Copy link
Member Author

@ogayot ogayot Jan 27, 2025

Choose a reason for hiding this comment

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

Should we check the value of preserve at the FS level (which may or may not exist) ? This is what we do to label "to be reformatted as ...." and "to be formatted as ....".

fs = device.fs()
if fs is not None:
if fs.preserve:
format_desc = _("already formatted as {fstype}")
elif device.original_fstype() is not None:
format_desc = _("to be reformatted as {fstype}")
else:
format_desc = _("to be formatted as {fstype}")

When dealing with a new partition, changing the format from e.g. ext4 to
unformatted should not require a wipe value. There is nothing yet to wipe.
OTOH it is still necessary for existing partitions.

Signed-off-by: Olivier Gayot <[email protected]>
@ogayot ogayot force-pushed the wipe-change-format branch from 646207f to 60693ec Compare January 27, 2025 15:53
@ogayot ogayot changed the title When changing format of a new parittion, don't require wipe When changing format of a new partition, don't require wipe Jan 27, 2025
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.

1 participant