Moving Grub?

So, here’s my problem. I have Windows 7 installed on my primary internal 500GB sata drive. I have an old 40GB sata drive that I’ve put in an enclosure and am using eSata. I installed Ubuntu 9.10 on my external drive in hopes to use linux only when I had my external plugged in, and windows when not plugged in. I don’t have the option to just load Linux only on my laptop as windows is still needed. However, as a standard install, my grub loader has installed on my internal drive and I can now only boot to windows or linux when my external is plugged in. Without my external, I get error code 21 with GRUB. How can I fix this so that Windows will boot like normal, and Linux will load when I plug in my external drive?

Put the /boot partition on a small partition on the internal drive. You may need to resize the Windows partition(s) to make some space. The MBR on the hard drive is pointing to the /boot on the removable. That is all it does. Grub is actually on the /boot not in the MBR. the MBR sector is just 512 bytes. It simply points to the next stage of the boot process.

/boot is 17.7 MB on my machine so a partition of 25-50 meg should be fine.

Post the output of fdisk -l (run as root ie su or sudo if Ubuntu) This will help us see what is currently the situation.

So, I created a new partition for /boot and I have transferred everything, still no luck pretty sure I need to edit which drive to start from.

here is what fdisk -l gives me

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe030c515

Device Boot Start End Blocks Id System
/dev/sda1 * 1 60789 488282112 7 HPFS/NTFS
/dev/sda2 60789 60802 101376 7 HPFS/NTFS

Disk /dev/sdb: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xd3525a41

Device Boot Start End Blocks Id System
/dev/sdb1 1 4659 37423386 83 Linux
/dev/sdb2 4660 4864 1646662+ 5 Extended
/dev/sdb5 4660 4864 1646631 82 Linux swap / Solaris

You can’t really do exactly as you ask. reason is. When you keep adding and removing a boot device it throws all the BIOS settings out and you would have to manually re-set it each re-connect.

Your best solution is to have the drives so each will boot independent of the other and use something like supergrubdisk. You could always dd it to a usb pendrive.

ok, so if I start from scratch, which isn’t a big deal, how could I set my grub to be on my internal HDD so that I can still boot to windows without having to use my ext HDD. also, as far as my bios, I have it set to boot from my internal hdd first and I have disabled auto boot from my ext hdd. that being the case, I should theoretically be able to load my grub off my internal, should I want to load linux, I could plug in my external, should i choose windows, I would just boot straight to windows.

Grub is on sda
But your remaining grub code is on sdb.

By far the simplest solution for you is to repair sda BOOTMGR
re-install Ubuntu on your external, with only the external drive connected

Use supergrubdisk on a cd or bootable usb to boot either OS when both drives are connected

Though with 500GB of space on sda
Trying to use a 40GB external is kinda flaky IMO:)

And you know this is a openSUSE forum

I’ll see what I can do then. as flaky as having the 40GB external sounds, its a waste to not be using it, and I don’t want multiple OS’s on my sinlge 500 GB drive. also, I realize this is an openSUSE forum, but I haven’t receive any replies for my problems in the ubuntu forums. Also, linux is linux. It all runs about the same. thanks though

I’ll see what I can do then.
OK.

Another option is to have a /boot partition on sda
A point already mentioned by one of our users. But I think you might find it a bit complex. Not my recommendation anyway

There are many ways to do things and one might not be any better then another.

Using caf4926 option will require as he says, a boot cd / floppy or bootable usb for linux.

Using gogalthorp option ‘the one I would use’ will work good but the small partition on sda must be a linux partition not NTFS to work. Will also require some other commands to be ran before it will work, just copying /boot/grub to partition is not good. Must run ‘grub’ and have it link up sdax to the MBR. Would also leave grub installed on the external hdd and have sda grub chainload to it, that way if you upgrade/change , there will be less of a problem. My 2 cents any way.

Can’t you use the bios and boot your external hd with grub in the root partition of sdb or even in the mbr of sdb

now off to install in an external drive and do some fiddling

Problem is @dale14846
The OP wanted grub on sda
and sdb would sometimes not be connected

First install gparted in ubuntu then start it with

sudo gparted

use it to reformat your boot partition to ext4. Then once more copy the files from /boot to this partition. Now rename /boot to /boot(old) and create a new /boot. Next add this line to fstab:
/dev/sda2 /boot ext4 defaults 0 2
Open a terminal and type

sudo su

then open a grub shell with

grub

from there do

find /grub/stage2

make note of the output which I am guessing will be (hd0,1). Now do

root (replace with output of previous command)

and

setup (hd0)

There you have it grub which will work with or without your external hard drive.

The above info is NOT correct as the OP is using Ub 9.10 which uses grub2, completely different.

I apologize for this misleading information, I have not used Ubuntu in a while and assumed that Legacy GRUB would still be in place.

Nope, using the bios didn’t work. even using the grub editor my system kept complaining about mounting issues.

adding sdb to my boot loader via yast bootloader did work
but adding another disk (usb stick) threw the order of the drives off sdb became sdc and boot to the external drive failed