[arch-general] Quick question about post-MBR gap?

Christian Hesse list at eworm.de
Wed Jul 18 17:58:04 EDT 2012


mike cloaked <mike.cloaked at gmail.com> on Wed, 2012/07/18 19:40:
> I am planning a test install using the new arch-install-scripts via
> the latest netinstall images from releng (from today's date).
> 
> I know that for a system where I blow away all previous disc
> partitions and partition from scratch I can create a 2MiB partition
> (using MBR and NOT GPT partitioning) before the first formatted
> partition on the HD and install grub2 during the base install.
> However can someone please tell me explicitly if, for a system with
> only BIOS (no UEFI at all), and no GPT partitioning but just plain old
> MBR partitioning - is the recommended 2MiB post-MBR gap still a
> "requirement" for that specific situation for grub2 to work? I can't
> find that as an explicit statement in any of the documentation that I
> have read for installs/grub2/partitioning! i.e. does grub2 still need
> to embed the core.img file in the post-MBR gap as the preferred and
> dev recommended approach in this case?
> 
> The reason I would like to have that explicit answer is that if I want
> to install arch on a machine which has a pre-existing NTFS partition,
> and possibly host-protected partition as well for Windows recovery, at
> the start of the drive, then if the 2MiB post-MBR gap is a requirement
> (rather than a nicety) for grub2 with BIOS and MBR partitioning (but
> no GPT partitioning or UEFI) then unless the drive is re-partitioned
> and the NTFS partition reduced in size and moved out by 2MiB then
> there could be problems? However doing that partition jinking about
> might itself lead to a few issues!
> 
> I am going to do an install with new partitioning on an old laptop to
> check that I can successfully use the new install system (without AIF)
> and hopefully that will work, but I also have other machines with
> existing and important (to me) Windows partitions that I would really
> like to NOT corrupt when installing arch to the partitions on their
> drives.
> 
> The other reason I am asking this question is that I also have
> existing dual boot laptops with Windows XP and arch with BIOS and MBR
> partitioning - and at some point it would presumably be sensible to
> move from the existing grub to grub2 - and on these systems where I
> have already checked that there is only a 64 sector post-MBR gap -
> will this lead to problems if I change from grub to grub2 if I don't
> change the partitions to have a 2MiB post-MBR gap?
> 
> Thanks for any help on this - I have been doing reading and trying to
> prepare without looking an idiot and being a good arch admin, but
> there is quite a lot to read and I still can't find the answer to the
> explicit question above!

Grub 2.x is fine with embedding its core.img into about 31kB. That is
starting sector 2 directly after the MBR and having first partition start at
sector 63. (Old disk alignment to cylinders, you should not use that -
especially with hard drives with 4k blocks or SSDs.)

However this could become a problem if core.img increases with time. I think
even the wrong compiler flags are enough to exceed the limit.

You are perfectly fine if your partitions are aligned to 1MB-Boundaries. Grub
has 1023 sectors to embed its core.img.

Having GPT partition table you need a BIOS boot partition (type EF02) that
Grub uses to embed its core.img. Note that the GPT partition table itself
starts from sector 2, so you should not write anything there!
However you should note that only Windows 7 64 Bit can boot from GPT
partition table on UEFI Hardware. Every other MS OS is out of luck. (At least
without faking anything, you could use gptsync for example.)

Hope that helps...
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}


More information about the arch-general mailing list