LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub setup for Linux moved to 2nd HDD? (https://www.linuxquestions.org/questions/linux-general-1/grub-setup-for-linux-moved-to-2nd-hdd-297809/)

emendelson 03-04-2005 10:35 PM

Grub setup for Linux moved to 2nd HDD?
 
Here's a problem that may be impossible to solve, but I hope it isn't: I've installed SUSE 9.2 on the main hard disk in my ThinkPad T42, and put the bootloader on /dev/hda1. Now I want to take this HDD and put in a Second Hard Disk adapter so that I can put back the Windows HDD that was originally the main hard disk. I want to be able to write a GRUB menu that will let me boot from the SECOND (Linux) HDD and run Linux. I've tried various permutations of the map command in GRUB, but haven't got it solved yet. Can anyone help?

Here is what I've tried in menu.list:

<<first - the original setting for use when Linux is on the main HDD>>

title SUSE LINUX 9.2
kernel (hd0,0)/vmlinuz root=/dev/hda5 ...
initrd (hd0,0)/initrd

<<Then, my attempt at the new setting for use when it's on the 2nd HDD>>

title SUSE 9.2 from 2nd HDD
map (hd0) (hd1)
map (hd1) (hd0)
kernel (hd0,0) <<etc. as in the original>>

This doesn't work - Linux starts booting, then gives me a kernel panic when it doesn't recognize any file system on hda5.

Can anyone suggest a menu item that will work in this situation? Many thanks

bigrigdriver 03-04-2005 11:51 PM

Let's see if I understand this correctly.
You will reinstall the Win HDD as primary, and Linux will be secondary. Therefore, win will be on /dev/hda and Linux will be on /dev/hdb. Is that correct?
If so, then edit the grub.conf (or menu.lst, is that's what your distro uses) to point grub to /dev/hdb1. change the config lines to point to hdb1 (grub notation:kernel (hd1,0)/vmlinuz root=/dev/hdb5), initrd (hd1,0)/initrd.
Then edit the windows config lines (no need for the map options if win is on hda).
BTW, your example shows SuSE on both HDDs.
Finally, you need a backup means of booting into the Linux install so that your can re-install grub to the MBR of the Primary HDD (hda).

emendelson 03-05-2005 10:57 AM

Many thanks for your help!

Yes, I should have made this clearer. I don't have a USB CD/DVD drive for this laptop, so the only practical way to install Linux on its own HDD from a CD or DVD is by taking out the original Windows HDD, and putting in the Linux HDD as the main HDD.

What I want to do now is put the Windows HDD back in the main drive slot, and put the Linux HDD in the ThinkPad 2nd HDD adapter. With a little experimenting, I see that GRUB/Linux refers to the drive in the 2nd HDD as hdc (not hdb), so I've tried the following:


title SUSE 9.2 from 2nd HDD hd1
kernel (hd1,0)/vmlinuz root=/dev/hdc5 ...
etc etc.

Notice the hdc5 as the root. This starts the initial non-gui stage of booting going, but then it stops when it can't check the file system on hda5 (that's hda - the Windows disk). BTW, trying h0,0 instead of hd1,1 fails completely: Grub can't find anything to boot.

Anyway, this may or may not be possible, but if I could avoid buying a USB DVD (which would let me install directly to the second HDD), I like to be able to do so.


All times are GMT -5. The time now is 05:37 AM.