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

Allow resizing a GPT #235

Merged
merged 4 commits into from
Jul 15, 2024
Merged

Allow resizing a GPT #235

merged 4 commits into from
Jul 15, 2024

Conversation

paul-rodriguez
Copy link
Contributor

These changes allow:

  • observing the total size and last data sector of a GPT
  • resizing a GPT (for example to make it fit its block device)
  • expanding a GPT partition

Introduction of methods to observe the total size and resize a GPT.
@deitch
Copy link
Collaborator

deitch commented Jul 12, 2024

This looks pretty good. We don't have to adjust any more generic interfaces, since expanding a partition is uniquely a gpt thing.

The assumption is that one would expand the partition, and then call table.Write() to write it to disk?

Can we add some tests? Look at how table_test.go does it, which probably is the right place for it. I wouldn't want to affect the original testdata/gpt.img, but maybe it can be copied to a tmpdir, then modified, and read using the library to see that the changes took? Since we already test the reading of partition tables independently, we can rely on those to validate the changes.

@paul-rodriguez
Copy link
Contributor Author

The assumption is that one would expand the partition, and then call table.Write() to write it to disk?

Yes indeed.

Can we add some tests? Look at how table_test.go does it, which probably is the right place for it. I wouldn't want to affect the original testdata/gpt.img, but maybe it can be copied to a tmpdir, then modified, and read using the library to see that the changes took? Since we already test the reading of partition tables independently, we can rely on those to validate the changes.

Sure thing, thanks for the pointers.

@paul-rodriguez
Copy link
Contributor Author

@deitch I have pushed some unit tests for the Resize and Expand functions. My apologies if this mention is not good etiquette!

deitch
deitch previously approved these changes Jul 15, 2024
@deitch
Copy link
Collaborator

deitch commented Jul 15, 2024

Not a problem at all. Thank you for this. Let's let CI run.

@deitch
Copy link
Collaborator

deitch commented Jul 15, 2024

Some linting issues.

@paul-rodriguez
Copy link
Contributor Author

It should be ok now

@deitch
Copy link
Collaborator

deitch commented Jul 15, 2024

Looks good. Are you ready to go with this?

@paul-rodriguez
Copy link
Contributor Author

Yes, it works fine for my purposes. Thank you!

@deitch deitch merged commit a54d42a into diskfs:master Jul 15, 2024
20 checks passed
@deitch
Copy link
Collaborator

deitch commented Jul 15, 2024

Thanks @paul-rodriguez

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