Skip to contentSkip to conversation

docs: Update for stopping small mbr gap support

PATCH In review Michael Chang 3 participants 3 messages Mar 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs: Update for stopping small mbr gap support

Further to the discussion about disabling btrfs zstd support for i386-pc[1], this paragraph in manual about mbr gap size doesn't seem to hold true any longer.

"You must ensure that the first partition starts at least 31 KiB (63 sectors) from the start of the disk"

As in many occasions we inevitablely have to provide core image with the size that goes beyond 31 KiB. For instance, diskfilter and crypto modules which are needed by root disk formatted with btrfs, lvm, mdadm and so on would add quite a lot space to the image.

So this misinformation would have people misguided and thought that it is still fine to use small MBR gap utill some point of time the update has grown the size too much that the grub-install can no longer embed the image to the mbr gap. In this case changing the partition layout is required but it is never easy to do so.

The patch tries to correct the paragraph with a more practical size that works for grub and also for modern computer systems in general.

[1] https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00025.html

---

Changes since v2:
* Rework a paragraph in commit message and also some places in manual to be more clear to read
* Correct some typos

 docs/grub.texi | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
docs/grub.texi +14 -6
index 83979af38..4614a2ee1 100644
@@ -845,12 +845,20 @@ only be used if the @file{/boot} filesystem is on the same disk that the
 BIOS boots from, so that GRUB does not have to rely on guessing BIOS drive
 numbers.
 
-The GRUB development team generally recommends embedding GRUB before the
-first partition, unless you have special requirements.  You must ensure that
-the first partition starts at least 31 KiB (63 sectors) from the start of
-the disk; on modern disks, it is often a performance advantage to align
-partitions on larger boundaries anyway, so the first partition might start 1
-MiB from the start of the disk.
+The GRUB development team generally recommends embedding GRUB before the first
+partition, unless you have special requirements. You must ensure that the first
+partition starts at least 1 MiB from the start of the disk; Additionally, on
+modern disks it is often a performance advantage to align partitions on larger
+boundaries and 1 MiB is the least common multiple of many used alignment sizes.
+E.g. SSD, it became crucial to have the partition correctly aligned to avoid
+excessive read-modify-write cycles and thus modern tools set to use 1 MiB as a
+standard practice.
+
+In case of legacy systems that cannot boot if first partition is not on the
+cylinder boundary, the fallback blocklist install method should remain working
+for them if the core image grows too much someday. Here we just can't advertise
+that 31 KiB (63 sectors) is a sensible size any longer as that would pose great
+constraint to include new features as time goes by.
 
 @heading GPT
 
Signature · 1 line
2.16.4
Reviewed-by on v2 1/1
#1 lore raw

Hello Michael,

Quoted 18 lines · Michael Chang

Further to the discussion about disabling btrfs zstd support for i386-pc[1], this paragraph in manual about mbr gap size doesn't seem to hold true any longer.

"You must ensure that the first partition starts at least 31 KiB (63 sectors) from the start of the disk"

As in many occasions we inevitablely have to provide core image with the size that goes beyond 31 KiB. For instance, diskfilter and crypto modules which are needed by root disk formatted with btrfs, lvm, mdadm and so on would add quite a lot space to the image.

So this misinformation would have people misguided and thought that it is still fine to use small MBR gap utill some point of time the update has grown the size too much that the grub-install can no longer embed the image to the mbr gap. In this case changing the partition layout is required but it is never easy to do so.

Quoted 8 lines

The patch tries to correct the paragraph with a more practical size that works for grub and also for modern computer systems in general.

[1] https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00025.html

---

Agreed with the patch.

Quoted 27 lines

Changes since v2:
* Rework a paragraph in commit message and also some places in manual to be more clear to read
* Correct some typos

 docs/grub.texi | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
docs/grub.texi +5 -6
index 83979af38..4614a2ee1 100644
@@ -845,12 +845,20 @@ only be used if the @file{/boot} filesystem is on the same disk that the
 BIOS boots from, so that GRUB does not have to rely on guessing BIOS drive
 numbers.
 
-The GRUB development team generally recommends embedding GRUB before the
-first partition, unless you have special requirements.  You must ensure that
-the first partition starts at least 31 KiB (63 sectors) from the start of
-the disk; on modern disks, it is often a performance advantage to align
-partitions on larger boundaries anyway, so the first partition might start 1
-MiB from the start of the disk.
+The GRUB development team generally recommends embedding GRUB before the first
+partition, unless you have special requirements. You must ensure that the first
+partition starts at least 1 MiB from the start of the disk; Additionally, on
+modern disks it is often a performance advantage to align partitions on larger
+boundaries and 1 MiB is the least common multiple of many used alignment sizes.

docs/grub.texi only be used if the @file{/boot} filesystem is on the same disk that the · line 862

Quoted 10 lines
docs/grub.texi +9 -0
+E.g. SSD, it became crucial to have the partition correctly aligned to avoid
+excessive read-modify-write cycles and thus modern tools set to use 1 MiB as a
+standard practice.
+
+In case of legacy systems that cannot boot if first partition is not on the
+cylinder boundary, the fallback blocklist install method should remain working
+for them if the core image grows too much someday. Here we just can't advertise
+that 31 KiB (63 sectors) is a sensible size any longer as that would pose great
+constraint to include new features as time goes by.
 

I think is also worth mentioning that most partition tools these days default to the optimal alignment for the disk. But could be done as a follow-up patch if you agree that adding this information would be useful.

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
Reviewed-by
#2 lore raw
Quoted 26 lines · Javier Martinez Canillas

Hello Michael,

Quoted 23 lines · Michael Chang

Further to the discussion about disabling btrfs zstd support for i386-pc[1], this paragraph in manual about mbr gap size doesn't seem to hold true any longer.

"You must ensure that the first partition starts at least 31 KiB (63 sectors) from the start of the disk"

As in many occasions we inevitablely have to provide core image with the size that goes beyond 31 KiB. For instance, diskfilter and crypto modules which are needed by root disk formatted with btrfs, lvm, mdadm and so on would add quite a lot space to the image.

So this misinformation would have people misguided and thought that it is still fine to use small MBR gap utill some point of time the update has grown the size too much that the grub-install can no longer embed the image to the mbr gap. In this case changing the partition layout is required but it is never easy to do so.

The patch tries to correct the paragraph with a more practical size that works for grub and also for modern computer systems in general.

[1] https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00025.html

Quoted 7 lines
Quoted 3 lines

---

Agreed with the patch.

...except some nitpicks which I fix before commiting the patch...

Quoted 32 lines
Quoted 32 lines

Changes since v2:
* Rework a paragraph in commit message and also some places in manual to be more clear to read
* Correct some typos

 docs/grub.texi | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
docs/grub.texi +10 -6
index 83979af38..4614a2ee1 100644
@@ -845,12 +845,20 @@ only be used if the @file{/boot} filesystem is on the same disk that the
 BIOS boots from, so that GRUB does not have to rely on guessing BIOS drive
 numbers.
 
-The GRUB development team generally recommends embedding GRUB before the
-first partition, unless you have special requirements.  You must ensure that
-the first partition starts at least 31 KiB (63 sectors) from the start of
-the disk; on modern disks, it is often a performance advantage to align
-partitions on larger boundaries anyway, so the first partition might start 1
-MiB from the start of the disk.
+The GRUB development team generally recommends embedding GRUB before the first
+partition, unless you have special requirements. You must ensure that the first
+partition starts at least 1 MiB from the start of the disk; Additionally, on
+modern disks it is often a performance advantage to align partitions on larger
+boundaries and 1 MiB is the least common multiple of many used alignment sizes.
+E.g. SSD, it became crucial to have the partition correctly aligned to avoid
+excessive read-modify-write cycles and thus modern tools set to use 1 MiB as a
+standard practice.
+
+In case of legacy systems that cannot boot if first partition is not on the
Quoted 8 lines

docs/grub.texi only be used if the @file{/boot} filesystem is on the same disk that the · line 861

Quoted 4 lines
docs/grub.texi +4 -0
+cylinder boundary, the fallback blocklist install method should remain working
+for them if the core image grows too much someday. Here we just can't advertise
+that 31 KiB (63 sectors) is a sensible size any longer as that would pose great
+constraint to include new features as time goes by.

I think is also worth mentioning that most partition tools these days default to the optimal alignment for the disk. But could be done as a follow-up patch if you agree that adding this information would be useful.

This is not a must. However, if you think it makes sense please send a patch.

Daniel