On Saturday 21 Jan 2017 00:44:15 Walter Dnes wrote:
>   I've been using LILO for over 15 years, but I'm a total newbie at
> GRUB2, so the following may be totally out to lunch.  Would the following
> setup work for a USB key with multiple partitions with a different OS or
> variant in each partition?
> 
> GRUB2 in MBR

It can be the MBR of the USB key, or the MBR of the hard drive.  It makes 
sense it is in the MBR of the USB key of course, but bear in mind some older 
PCs BIOS will not boot from USB keys.

> * extended partition 1 covers entire USB key
> * logical partition 5, ext2fs, 1 megabyte, containing directory /boot/grub
>   containing file menu.lst
> * logical partition 6, ext2fs, containing an OS
> * logical partition 7, ext2fs, containing an OS
> * etc, etc

Or, you could just use GPT. 


>   Assuming that the key shows up as /dev/sdb, would the entries in
> menu.lst for partions 6 and 7 be (hd1,5) and (hd1,6), respectively?

I think you are confusing GRUB2 with the older GRUB legacy?  There is no 
menu.lst with GRUB2.  Instead /boot/grub/grub.cfg is generated when you run:

 grub-mkconfig -o /boot/grub/grub.cfg

taking its input from:

 /etc/default/grub

and 

 /etc/grub.d/*

The nomenclature for partions 6 and 7 on the USB key will be (hd1,5) and 
(hd1,6) respectively, as long as the USB key has been detected as the 2nd 
drive on the PC (/dev/sdb).


> And
> what would be the command to install GRUB2 to the MBR of the USB key?

grub-install -v /dev/sdb

and then to create and install its configuration files mount your USB key and 
run:

grub-mkconfig -o /run/media/walter/<USB>/boot/grub/grub.cfg

assuming that your USB key has been mounted under /run/media/walter/<USB>

and the directory /boot on the USB key is where you want your GRUB2 files 
installed.

Should you need to have a look here as well for additional info:

https://wiki.gentoo.org/wiki/GRUB2
https://www.gnu.org/software/grub/manual/grub.html

HTH.
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to