growpart: Add support for overprovisioning#35
Conversation
blackboxsw
left a comment
There was a problem hiding this comment.
quick pass. will actually exercise this in practice on a couple VMs to ensure I understand the implications.
paride
left a comment
There was a problem hiding this comment.
This is a nice addition, thanks! Before merging I think it would be good to have a simple test for it. Using https://github.com/canonical/cloud-utils/blob/main/test/test-growpart as a base this shouldn't be too much work: we grow the partition with --free-percent and then we check the number of blocks in /proc/partitions, somehow turning this:
echo "==== after ===="
grep "${lodev##*/}" /proc/partitions
into a check. No need to resize2fs IMO.
@dermotbradley would you be willing to add it to your PR?
Yes, working on that currently. |
Add option to 'growpart' to specify percentage of device that should be
left unallocated when growing partition. This is intended for consumer
SSDs and SD cards where the performance and/or lifetime of these devices
can be improved if some disk space (in addition to any the device "hides"
from users) is left unallocated.
Overprovisioning code caters for several distinct scenarios:
(1) MSDOS/MBR partitioned disk where the disk is >2TB and so MBR
partitions cannot extend beyond 2TB - if disk is larger than
(2TB + overprovisioning requirement) then nothing needs to be
done.
(2) MSDOS/MBR partitioned disk where the disk is >2TB and so MBR
partitions cannot extend beyond 2TB - if disk is not larger
than (2TB + overprovisioning requirement) then *some*
overprovisioning space still needs to be reserved.
(3) MSDOS/MBR partitioned disk <=2TB where overprovisioning space
needs to be reserved.
(4) GPT partitioned disk where overprovisioning space needs to be
reserved.
Also added a testcase script, test-growpart-overprovision.
1fad5b1 to
17cb8d3
Compare
|
I have overhauled the overprovisioning code and added a testcase. |
paride
left a comment
There was a problem hiding this comment.
This looks great, thanks for adding the test! O just have one question (see inline comment).
58a70c6 to
3cbf293
Compare
Correct some of the overprovisioning logic. Change overprovisioning testcase to not require root. Also correct some off-by-one errors in the existing growpart code and correct some existing testcases affected by this.
3cbf293 to
b72e55f
Compare
paride
left a comment
There was a problem hiding this comment.
This LGTM, including the off-by-one fixes, thanks!
|
Any chance to get this finally merged? |
Add option to 'growpart' to specify percentage of device that should be
left unallocated when growing partition. This is intended for consumer
SSDs and SD cards where the performance and/or lifetime of these devices
can be improved if some disk space (in addition to any the device "hides"
from users) is left unallocated.