[TriLUG] booting an external disk with grub 0.97

Steve Litt via TriLUG trilug at trilug.org
Tue Apr 21 12:52:57 EDT 2015


On Mon, 20 Apr 2015 18:38:24 -0700 (PDT)
Joseph Mack NA3T via TriLUG <trilug at trilug.org> wrote:

> (I thought this would be easy...)
> 
> I have a disk which boots and runs just fine attached to the SATA bus
> of a computer.
> 
> I now want to take it out and use it to boot a laptop (which the
> owner doesn't want me to open as it's under warrantee) as an external
> disk. For the moment I'm using one of my own laptops for the testing.
> The partitioning on the internal disk and external disk are the same,
> but the partitions sizes and kernels are different, so I can
> differentiate the disks at the grub prompt, but looking for the
> kernels.
> 
> The external disk, now on the usb bus, is recognised by the bios and
> the grub menu from the external disk comes up.
> 
> According to the docs, the external disk is hd0 and the internal disk
> is hd1 (because you told it to boot first from the usb bus). I can
> confirm this because the kernels on the internal disk and external
> disk are different and I can use the grub command line to check which
> disk they're on.
> 
> Here my menu.lst lines
> 
> root (hd0,2)
> kernel /boot/bzImage-3.5.3 root=/dev/sda3
> 
> (don't need an initrd)
> 
> device.map is
> (hd0) /dev/sda
> (hd1) /dev/sdb
> 
> all fine so far.
> 
> I boot and the machine boots off the 3.5.3 kernel on the external
> disk (as I expect), and then mounts the internal disk (which I don't
> want), which also has an /dev/sda3, as the root partition. There are
> no 3.5.3 modules on the internal disk, but the machine continues to
> boot through to login. After login, I find I'm running on the 3.5.3
> kernel, which only exists on the external disk, but I've got the
> filesystem from the internal disk.
> 
> What I don't understand is how the kernel mounted the internal disk
> as /dev/sda3, when the internel disk is (hd1) /dev/sdb.
> 
> If I change the kernel line above to root=/dev/sdb3, the boot crashes
> with "cannot mount root partition, available partitions
> are /dev/sda1... /dev/sda7". So I can only use /dev/sda3 as the root
> partition here; it's not like I get a choice.
> 
> I've tried hiding the internal disk with
> 
> hide (hd1,2)
> 
> and I've tried remapping
> map (hd0) (hd1)
> map (hd1) (hd0)
> 
> without effect.
> 
> Does anyone know if I should be able to boot an external disk with
> grub 0.97?

No idea. Grub sux, Grub2 sux worse. LILO isn't much better.

But here's an idea. Just for fun, next time you boot, within Grub
modify the kernel line to add or change the init line to:

init=/bin/bash

or, if you have one of those magical distros whose /bin is just a
symlink name to /usr/bin, 

init=/usr/bin/bash

I don't think it's the latter, because you said you have no initramfs.
Thank goodness for small favors!

Now, hopefully, you can come up using bash as a periscope to look
around just before your init would have run, and you can see what
things are called and the like.

You never mentioned why you need to boot your buddy's box with your
hard disk. Depending on the reasons, System Rescue CD might substitute
for your hard disk, or possibly, System Rescue CD could be used to boot
your hard disk, perhaps using System Rescue CD's kernel.

Please tell us what you see when you change your init to /bin/bash.
That should be interesting.

SteveT

Steve Litt 
April 2015 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28




More information about the TriLUG mailing list