Skip to contentSkip to conversation

grub core size

DISCUSSION James Courtier-Dutton 3 participants 3 messages Sep 22, 2009 – Sep 24, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I am using grub 2.
The stage 1 bit of grub, that stores itself in the partition table and the following sectors, seems to be quite large.
I have a HP server system that only has 32 512-bytes sectors free before the first partition but the grub core does not fit in there. It seems to need more like 64 512-byte sectors.

Why does grub need so much space on that part of the hard disk ? My /boot/grub has been installed on an ext2 partition.

How difficult would it be to fit the stage 1 into 16384 bytes? USB sticks sometimes have similar problems.

How about two versions of the grub core, one that requires the rest of grub to be on an ext2/3 partition, and a larger one that can handle other options, e.g. lvm etc.
Obviously, it is only worth trying that if the ext2 one can get into 16384 bytes or 32 sectors.

Kind Regards

James

#1 lore raw

Am Dienstag, den 22.09.2009, 19:41 +0100 schrieb James Courtier-Dutton:

Quoted 12 lines

Hi,

I am using grub 2.
The stage 1 bit of grub, that stores itself in the partition table and the following sectors, seems to be quite large.
I have a HP server system that only has 32 512-bytes sectors free before the first partition but the grub core does not fit in there. It seems to need more like 64 512-byte sectors.

Why does grub need so much space on that part of the hard disk ? My /boot/grub has been installed on an ext2 partition.

Quoted 9 lines

How difficult would it be to fit the stage 1 into 16384 bytes? USB sticks sometimes have similar problems.

How about two versions of the grub core, one that requires the rest of grub to be on an ext2/3 partition, and a larger one that can handle other options, e.g. lvm etc.
Obviously, it is only worth trying that if the ext2 one can get into 16384 bytes or 32 sectors.

The stage1 equivalent from GRUB Legacy in GRUB 2 would be boot.img which is 512 bytes big.
What you probable mean is the size of core.img which usually gets embed between MBR and first partition, like stage1_5 from GRUB Legacy. core.img only contains the stuff which is needed to access your /boot and is created in the grub-install script with the grub-mkimage line. Just run it with `sh -x grub-install /dev/sda' and you see what modules get included.
Well not all kernel.img gets also included and all necessary dependencies of the modules.
And core.img is also compressed with LZMA to make it smaller. The problem of the size is the actual code.
GRUB 2's kernel.img is for me 31K
You can get it smaller if you remove the rescue mode and other stuff you personally don't need, but that's not a generic solution.

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer
#2 lore raw
In reply to James Courtier-Dutton
Quoted 12 lines · James Courtier-Dutton

Hi,

I am using grub 2.
The stage 1 bit of grub, that stores itself in the partition table and the following sectors, seems to be quite large.
I have a HP server system that only has 32 512-bytes sectors free before the first partition but the grub core does not fit in there. It seems to need more like 64 512-byte sectors.

Why does grub need so much space on that part of the hard disk ? My /boot/grub has been installed on an ext2 partition.

Quoted 8 lines

How difficult would it be to fit the stage 1 into 16384 bytes? USB sticks sometimes have similar problems.

How about two versions of the grub core, one that requires the rest of grub to be on an ext2/3 partition, and a larger one that can handle other options, e.g. lvm etc.
Obviously, it is only worth trying that if the ext2 one can get into 16384 bytes or 32 sectors.

Did you compile GRUB yourself?

Did you build core.img yourself? If you did, you should use grub-install instead.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."