Merge lp:~paelzer/curtin/fix-bug-1513085-partition-alignment-v3 into lp:~curtin-dev/curtin/trunk
Status: | Merged |
---|---|
Merged at revision: | 295 |
Proposed branch: | lp:~paelzer/curtin/fix-bug-1513085-partition-alignment-v3 |
Merge into: | lp:~curtin-dev/curtin/trunk |
Diff against target: |
99 lines (+52/-8) 2 files modified
curtin/commands/block_meta.py (+51/-7) examples/tests/lvm.yaml (+1/-1) |
To merge this branch: | bzr merge lp:~paelzer/curtin/fix-bug-1513085-partition-alignment-v3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
curtin developers | Pending | ||
Review via email: mp+277117@code.launchpad.net |
Commit message
Partition alignment and sizing fixes:
- end sector calculation so that partition size matches what was requested
- proper size of extended partition size calculation to be able to hold as much
as it was specified in the yaml
- proper logical partition start calculation and realignment
- prepare curtin for the appearance of 4K logical sector size disk.
- by that implicitly fixing our alignment issues as long as sizes are aligned
which they usually are as e.g. MAAS exposes only 1MB units
- extends one of the existing tests to cover 2G+3G logical in 5G extended
Description of the change
First partitions start at 2048 by default (which is parted default as well)
As I pointed out we have to understand that when currently creating a 1024
byte partition (small size makes no sense but good for the example) we do
2048 - 2048 + (1024/512)
2048 - 2050
That means we span 2048, 2049 2050 => that is 1536 byte
Also logical/extended partitions did wrong sector calculations by adding the
size of the extended (2 sectors) to the start - that only accidentially worked
most of the time.
Extended and Logical can't share the start sector and subsequent logical
partitions can't go head-to-head with former logical partitions.
While all that goes on a human would assume all that just works.
Also one will assume that e.g. a 5G extended partition can hold a 3G and a 2G
logical which so far it couldn't for all these reasons.
All that also broke alignment.
This patch now fixes:
- end sector calculation so that partition size matches what was requested
- proper size of extended partition size calculation to be able to hold as much
as it was specified in the yaml
- proper logical partition start calculation and realignment
- prepare curtin for the appearance of 4K logical sector size disk.
- by that implicitly fixing our alignment issues as long as sizes are aligned
which they usually are as e.g. MAAS exposes only 1MB units
- extends one of the existing tests to cover 2G+3G logical in 5G extended
This looks good. Thank you Christian.
We really should start to write some doc to say things like "1MB gap" and such.
and also document what we leave at the end.