Another Ubuntu on external drive question

Derek Broughton news at pointerstop.ca
Sun Dec 30 14:36:41 UTC 2007


Peter Garrett wrote:

> On Sat, 29 Dec 2007 09:27:49 -0400
> Derek Broughton <news at pointerstop.ca> wrote:
> 
>> If I go into grub:
>>  grub> root (<TAB>
>> the tab-completion shows only hd0 as an option - so grub doesn't see the
>> drive (the light is on, but apparently nobody's home :-))
> 
> Grub is a finicky little beast :)
> 
> I have recently had to give it several kicks to make it recognise a drive
> here ( trying to write an install script for my live CD) I am no grub
> expert, far from it, so what follows is probably a horrible hack... and
> may not even work for you.
> 
> Check what is in /boot/grub/ on the drive concerned. It should look
> something like this:
> 
> default     e2fs_stage1_5  installed-version  menu.lst
> minix_stage1_5     stage1  stage2_eltorito device.map  fat_stage1_5
> jfs_stage1_5       menu.lst~  reiserfs_stage1_5  stage2  xfs_stage1_5
> 
> Most of this is of course superfluous, but note the "device.map".

That's all there, and device.map =
(hd0)   /dev/sda
(hd1)   /dev/sdb

> In my case I needed to do:
> echo "(hd0)   $DRIVE" > /mnt/boot/grub/device.map
> 
> ( DRIVE being the whole target drive of course, à la /dev/hda, /dev/sda
> etc. and the /mnt is the mountpoint of my chroot, that is, the file
> system we are installing to.)

Now, part of the problem (for me at least) is that I'm never sure what that
drive should be - right now, while running off my hard drive (/dev/sda)
it's /dev/sdc, but on a fresh boot it would be /dev/sdb

>  chroot to the relevant file system,  ( sudo chroot /mnt ) and run grub:
> 
> grub> root (hd0,1)
> #  ( substitute according to your device/partition. Note that hd0 refers
> #  to the $DRIVE that grub is *on* i.e. it doesn't care that the drive
> #  might actually be /dev/sdb from your viewpoint, or whatever)

That's never made any sense to me.  Surely, hd0 points to whatever drive the
device.map file calls hd0 - and if we are actually booting direct from the
USB (rather than chaining to the USB from the grub on the internal drive),
I have no idea what the device map should contain - should the external
drive be /dev/sda?

> grub> setup (hd0)    # this blats the MBR on $DRIVE - you have been
> warned. Adjust as needed. grub> quit
> 
> Hopefully, now that grub has a device.map that makes sense, this will
> work... you may see some "non-fatal" errors.

Ah well, off to try another boot...
 
> If the above incantations work, you should now have a working grub, and it
> should boot... I suggest sacrificing a goat and a chicken at the full moon
> at about this point...

Damn, Peter, I should have asked this a week ago - it's going to be a while
to the next full moon!

-- 
derek





More information about the ubuntu-users mailing list