Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] How to do GRUB2 multiple partions on USB key?
Date: Sun, 22 Jan 2017 09:00:06
Message-Id: 1709202.8Wc137buuF@dell_xps
In Reply to: [gentoo-user] [OT] How to do GRUB2 multiple partions on USB key? by Walter Dnes
1 On Saturday 21 Jan 2017 00:44:15 Walter Dnes wrote:
2 > I've been using LILO for over 15 years, but I'm a total newbie at
3 > GRUB2, so the following may be totally out to lunch. Would the following
4 > setup work for a USB key with multiple partitions with a different OS or
5 > variant in each partition?
6 >
7 > GRUB2 in MBR
8
9 It can be the MBR of the USB key, or the MBR of the hard drive. It makes
10 sense it is in the MBR of the USB key of course, but bear in mind some older
11 PCs BIOS will not boot from USB keys.
12
13 > * extended partition 1 covers entire USB key
14 > * logical partition 5, ext2fs, 1 megabyte, containing directory /boot/grub
15 > containing file menu.lst
16 > * logical partition 6, ext2fs, containing an OS
17 > * logical partition 7, ext2fs, containing an OS
18 > * etc, etc
19
20 Or, you could just use GPT.
21
22
23 > Assuming that the key shows up as /dev/sdb, would the entries in
24 > menu.lst for partions 6 and 7 be (hd1,5) and (hd1,6), respectively?
25
26 I think you are confusing GRUB2 with the older GRUB legacy? There is no
27 menu.lst with GRUB2. Instead /boot/grub/grub.cfg is generated when you run:
28
29 grub-mkconfig -o /boot/grub/grub.cfg
30
31 taking its input from:
32
33 /etc/default/grub
34
35 and
36
37 /etc/grub.d/*
38
39 The nomenclature for partions 6 and 7 on the USB key will be (hd1,5) and
40 (hd1,6) respectively, as long as the USB key has been detected as the 2nd
41 drive on the PC (/dev/sdb).
42
43
44 > And
45 > what would be the command to install GRUB2 to the MBR of the USB key?
46
47 grub-install -v /dev/sdb
48
49 and then to create and install its configuration files mount your USB key and
50 run:
51
52 grub-mkconfig -o /run/media/walter/<USB>/boot/grub/grub.cfg
53
54 assuming that your USB key has been mounted under /run/media/walter/<USB>
55
56 and the directory /boot on the USB key is where you want your GRUB2 files
57 installed.
58
59 Should you need to have a look here as well for additional info:
60
61 https://wiki.gentoo.org/wiki/GRUB2
62 https://www.gnu.org/software/grub/manual/grub.html
63
64 HTH.
65 --
66 Regards,
67 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] [OT] How to do GRUB2 multiple partions on USB key? Neil Bothwick <neil@××××××××××.uk>