diskfs / go-diskfs

MIT License
494 stars 112 forks source link

Allow resizing a GPT #235

Closed paul-rodriguez closed 1 month ago

paul-rodriguez commented 1 month ago

These changes allow:

deitch commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

deitch commented 1 month ago

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

deitch commented 1 month ago

Some linting issues.

paul-rodriguez commented 1 month ago

It should be ok now

deitch commented 1 month ago

Looks good. Are you ready to go with this?

paul-rodriguez commented 1 month ago

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

deitch commented 1 month ago

Thanks @paul-rodriguez