Commit 13b5118
committed
disk: align footer
Some partitioning tools (`systemd-repart`) round down the usable end of
the disk to the grain boundary (made configurable in the previous
commit). This ensures that the *end* of the last partition on disk is
grain aligned.
`images` instead grows the last partition to take up all remaining size
on the disk. When the footer is not aligned to sector size that means
that the last partitions gets slightly larger than one would expect it
to be.
To figure out the size for the last partition we subtract the raw
non-aligned header size (16,896 bytes) from the total disk size and then
grow the last partition to that. This means that the last partition
gains 3,584 bytes (with a 4096 byte grain size).
Aligning the footer size to the grain size has the end result that the
last partition becomes exactly the requested size.
This new behavior is gated behind an `AlignFooter` flag in the partition
table as it's new behavior and it would change all pre-existing
partition tables.
Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>1 parent 7e0c0cd commit 13b5118
2 files changed
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
| 231 | + | |
228 | 232 | | |
229 | 233 | | |
230 | 234 | | |
| |||
516 | 520 | | |
517 | 521 | | |
518 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
519 | 526 | | |
520 | 527 | | |
521 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
790 | 839 | | |
791 | 840 | | |
792 | 841 | | |
| |||
0 commit comments