for an successful
grub2 installation you need to pay special attention to two config files:
path_to_external_hdd_mount_point/boot/grub/device.map
path_to_external_hdd_mount_point/boot/grub/grub.cfg
is all you need ..
grub.cfg is usually the easy part because
grub2-install auto-regenerate this file at each grub setup .... but
device.map can be tricky .... for my laptop, when i boot from an usb flash pendisk with only one internal hdd is:
- Code: Select all
(hd1) /dev/sda
(hd0) /dev/sdb
/dev/sda is laptop internal hdd and
/dev/sdb got to be my usb flash pendisk ... with an internal hdd and an external usb hdd should be the same ... but for an laptop with one internal hdd, one internal dvdrw device and one usb external hdd connected as the boot device, it should got a /dev/sdc* label .... you can check that ... if this is true, then you
device.map should be:
- Code: Select all
(hd1) /dev/sda
(hd2) /dev/sdb
(hd0) /dev/sdc
and that's it all you need for an working external hdd boot setup ... this is because when you select an external usb device at boot to be you boot medium this means is first device detected, and automagically got
(hd0) status no matter how many internal devices you laptop have ... is the first thing to start all other things moving ... the
boot device ... this is why is so dificult this part of booting process ... you got a selected boot device, you find an correct MBR
grub2 signature, then from this signature you can jump
only on that device at address
blablabla ... on this
blablabla adress you find a second, bigger,
grub2 signature like a very crude os, but more capable than the first signature because is no more that 440
MBR bytes code size constraints ... this tinny os is at an absolute address on boot device put in
MBR code ...
this tinny os can have readonly ext2 filesistem capabilities ... or aes crypto muscles ... or lvm prescience ... from this tinny os image
grub2 code first read boot device
mbr partition table, find an active boot partition, jump to that boot partition, find
/boot/grub path, and here grub.cfg file, read this file, and here what they see?
root device is set as
/dev/sdc device because when you install grub at you external hdd, that hdd is
/dev/sdc not so? and
/dev/sda is you laptop internal hdd ... but now, because you boot from you external hdd, that external hdd is now you first device ... and now you have an broken setup ... damn!
in that little grub2 shell, is exactly that tinny grub2 os, from an broken boot attempt, you can check how is you partition permuted now, with an command like this:
- Code: Select all
search --no-floppy --fs-uuid external_hdd_boot_partition_uuid
my bet is to be always:
(hd0,1) ... almost ... if you boot partition is you first partition on you external hdd mbr table ... can be
(hd0,2) .. or
(hd0,3) ... but always
(hd0,*) ... because you boot device is you first device detected ...
in my case, i can delete
path_to_external_hdd_mount_point/boot/grub/device.map because is a little redundant is here only for safety, but for some configurations can be useful ... i think
grub2 style:
- Code: Select all
search --no-floppy --fs-uuid --set external_hdd_boot_partition_uuid
to find and set correct boot partition is enough to forget about
device.map mumbling jumbling ... just use
UUID labels in
grub.cfg instead of /dev/sd* device paths and you are on safe side ....