Please cc: me, I am not subscribed to bug-grub.

As we all know, you cannot install grub into an XFS partition because
the XFS superblock is in sector 0 of the partition.  grub-install must
not overwrite sector 0 which means that you cannot use 'chainloader +1'
to boot a secondary grub menu from an XFS partition.

This is frustrating when testing multiple distributions in separate
partitions.  It is so much easier to have a top level grub menu that
boots from the MBR and lists the available distributions, then uses
chainloader to boot from each distribution.  Each distribution's
partition contains its own specific second level grub menu.

It turns out that this process can be made to work, even for an XFS
partitions :-

* Create a partition to contain the top level menu.  menu.lst contains
  a list of distributions and uses chainloader to boot from each
  partition.  MBR points at this top level menu.  The partition can be
  any format, and it can be as small as one cylinder.

* For partitions that do not use sector 0, do a normal grub-install
  using that partition's local /boot and writing to sector 0 of the
  partition.  No change.

* The top level menu uses 'chainloader +1' for partitions when the
  secondary stage1 is in sector 0.  No change.

* For partitions that do use sector 0 (e.g. XFS), do grub-install using
  that partition's local /boot.  Instead of overwriting sector 0 of the
  XFS partition, tell grub-install write to sector 0 of any partition
  that is not being used as a secondary stage1.  I use sector 0 of the
  partition that contains the top level menu; its sector 0 is free
  because the MBR contains the stage1 file for the top level menu.  Say
  you write to sector 0 of /dev/sda1.

    grub-install --root-directory=/mnt/xfs /dev/sda1

* dd if=/dev/sda1 (say) bs=512 count=1 > /mnt/xfs/boot/grub/stage1.copy

* The top level menu uses 'chainloader (hd0,n)/boot/grub/stage1.copy'
  for partitions when the secondary stage1 cannot be installed in
  sector 0.  IOW you chainload from a file instead of sector 0.

AFAICT, there is no requirement that _any_ secondary stage1 must be in
sector 0, it is just an historical convention.  Writing the XFS stage1
to a spare sector then copying the result to a file in the XFS
filesystem works for me (TM).

Now for the RFE.  Could grub-install be enhanced so it can optionally
write the updated stage1 data to a file instead of only being able to
install in sector 0 of a partition?  That would remove the need to
write to a separate partition then dd the result to a file.  IOW

  grub-install --root-directory=/mnt/xfs /mnt/xfs/boot/grub/stage1.copy



_______________________________________________
Bug-grub mailing list
Bug-grub@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-grub

Reply via email to