I need to change MBR, switch to boot.ini, and maybe change active partition

Here is my situation.

I want to replace hard drive 0 (my 1st of 2 hard drives).

  1. I have 2 hard drives, drive 0 is noisy, so I bought a replacement (same size, different brand).

  2. Windows XP is on drive 0 (C; drive). There is also the Dell small FAT partition before C: on drive 0.

  3. drive 1 includes OpenSuse 11, on SDB5, SDB6, SBD7. There are some windows partitions before SDB5, SDB6, SBD7 on drive 1.

  4. SBD5 is the “active partition”

  5. My setup is such because when I installed opensuse 11, I accidentally let it install GRUB in the MBR (instead of using boot.ini). This has worked fine, but I want the computer to be able to boot with only my drive 0 in place (so I can put my new drive into the bay of drive 1, in order to copy my old drive 0 to this new one with xxclone.

  6. my goal is to keep the current drive 1 as it is, except to boot linux from boot.ini on the Windows XP C: drive, and to make C: my “active partition” so that drive 1 can be absent from the computer while I boot XP from my drive 0.

I have been trying the dd command as follows:
dd if=/dev/sdb5 of=/mnt/floppy/linsdb5.bin bs=512 count=1 to get a file to my C: drive and try boot.ini. I also tried sdb6 and sdb7. I also messed with Yast->system->boot options to place the boot stuff onto sdb5 or sdb7 as well as the MBR before the dd commands. I did this to experiment with booting the machine from Grub, selecting XP’s boot menu from Grub, then selecting a Suse option for one of these files (to test that I had boot.ini solution ready), but nothing I’ve tried for several days has worked. My plan had been that once boot.ini could boot Suse, I’d use fixmbr from my XP recovery CD to make my drive 0 sufficient to boot the machine (at least into windows) without drive 1 being present.

Today I realized that the active partition is SDB5 on drive 1, and figured this had to change also.

Can anyone help me. Thanks in advance.

If grub in installed on sdb5, then what you did should work. If not, then copy your mbr ( “/dev/sda”) using a similar “dd” command.

Copy that boot file to your C: drive for Windows.

Edit boot.ini on Windows. You might have to first turn off the hidden and system attributes with the “attrib” command.

Add a line to boot.ini, as follows:


where, in place of “bootsect.lnx” you use whatever you named that boot sector file.

To test: Boot Windows from the grub menu. You should get the “boot.ini” menu. From there, you should be able to select “linux” which will get you back to the grub menu.

If that all works, then make the windows partition active, run FIXMBR, and it should still work.

IF I remember correctly, been a long time.

You can not use boot.ini , it will not boot a non MS XP /7/vista on a second hdd.
You can use grub4dos. download and place grldr in root of XP . add to boot.ini


Then make a simple menu.lst in root of XP. can not say just what to put for Suse , need to see the current /boot/grub/menu.lst

color blue/green yellow/red white/magenta white/magenta
timeout 5

title hda2
root (hd0,1)
kernel /boot/vmlinuz root=/dev/hda2 nomce quiet splash vga=791
initrd /boot/initrd.img

do not use my title hda2, it is for my setup.

nrickert post would be correct IF XP and linux was on the same hdd.

Install Grub in MBR on drive 1 and give this drive boot priority in BIOS setup. That’s all you need. If you remove drive 1, Windows will boot. Is that not what you want? You can add an entry to boot Windows in your Grub menu and use

map (hd1) (hd0)
map (hd0) (hd1)

within the Windows boot entry in order to boot WIndows from there too.

OK, people, thanks very much so far.

I tried the dd command thing to boot.ini with both /dev/sda and /dev/sdb. the /dev/sba thing worked as nrickert said it would. If I boot and choose the XP boot.ini menu from Grub, then select my sda entry, I get back to the Grub menu (infinite loop if I wanted).

Now I assume that this means I am using the MBR of drive 0 (my 1st drive)?

Also, I failed to mention that my 3 linux partitions on drive 1 (2nd drive) are logical, within an extended partition (sdb4 I recall seeing under linux) (my linux drives are sdb5,6, and 7). The disk management XP shows my 3 linux drives as light blue (logical). Perhaps this is connected to the dd command to a linux.bin type boot.ini file failed regardless of what I tried in Yast->System->boot loader???

I am confused as to why my Window Disk Management shows sbd5 (1st logical linux partition) on my 2nd drive as “active partition”??? Does the Grub stuff in drive 0 (1st drive)'s MBR read sdb5 on drive 1 to boot the Grub menu, or is the Grub menu totally contained in drive 0’s MBR?

HOW DO I make the Windows partition active? The option to do this does not appear in the Windows Disk Management tool for any partition of drive 0 (which contains just the Dell little FAT thing and my C: drive windows XP partition). Yet the “Mark partition as active” choice DOES appear for the non-linux partitions of drive 1 (perhaps the active flag for what appears to be logical sdb5 is really for an extended partition starting with sdb5 that does not show up in Windows Disk Management.?

My questions above are to insure myself that if I find out how to mark my C: partition on drive 0 as active, and run fixmbr, that the computer will boot without drive 1 in the computer.

Also, when I get to the fixmbr stage, do I run that with any options, and need I run any other commands from the XP recovery disk?

Thanks greatly! Does all this make sense so far?

Please, post the output of

sudo /sbin/fdisk -l

in code tags, instead of enumerating your disks and partitions. That would make it much easier for everyone here to understand.

here is the output of fdisk -l :

root:/root>fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x9dc96e9e

Device Boot Start End Blocks Id System
/dev/sda1 1 5 40131 de Dell Utility
/dev/sda2 * 6 14589 117145980 7 HPFS/NTFS

Disk /dev/sdb: 123.5 GB, 123522416640 bytes
255 heads, 63 sectors/track, 15017 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb0409beb

Device Boot Start End Blocks Id System
/dev/sdb1 1 2550 20482843+ 7 HPFS/NTFS
/dev/sdb2 2551 7649 40957717+ 7 HPFS/NTFS
/dev/sdb3 7650 12748 40957717+ 7 HPFS/NTFS
/dev/sdb4 12749 15017 18225742+ f W95 Ext’d (LBA)
/dev/sdb5 * 12749 12761 104391 83 Linux
/dev/sdb6 14764 15017 2040223+ 82 Linux swap / Solaris
/dev/sdb7 12762 14763 16081033+ 83 Linux

Partition table entries are not in disk order

Thanks again.

So, sda2 is active on the first HDD, sdb5 is active on the second HDD (which doesn’t make sense btw). Which partition do you want to activate? If you want to activat sdb1, you can use:

sfdisk /dev/sdb -A1

To activate sdb2:

sfdisk /dev/sdb -A2

,etc. Use sfdisk rather than fdisk for this purpose. fdisk doesn’t toggle the bootflag. Thus, with fdisk, you have to use two commands instead of one … and you can end up with more than one bootflag if you don’t pay attention.

You can use findgrub (http://forums.opensuse.org/english/other-forums/development/programming-scripting/447138-looking-grub-windows-bootloader-all-partitions-16.html#post2443550) if you wonder where is Grub.

It is technically possible to set the active flag on a logical drive. It just doesn’t mean anything. If Windows reports that, it is a curiosity but probably not a concern.

Yes, once you have done the FIXMBR thing, it should boot with only Disk 0 present.

openSUSE and some other distros (such as Fedora) activate by default their root partition during setup, not matter if it’s a primary or a logical partition (http://unixversal.com/linux/opensuse/images/opensuse_vm_install43.jpg). You can call it a bug, because it is indeed totally useless. My guess is that they don’t care to check if this partition is a logical one. It has no influence on the boot process.

Grub doesn’t care about bootflags. A bootflag is only relevant if you don’t have a boot manager but a generic MBR instead, so that the active partition will be booted. Since a logical partition can not be booted at this stage, giving it the bootflag is pointless.

No the Grub menu is on the file system in the file /boot/grub/menu.lst.

Thanks again to everyone.

I think I understand you guys to be saying that both my disks have an active partition according to fdisk? Also to be saying that my MBR (which I believe is on sda (drive 0) points currently to GRUB code on drive 1 (sdb).

I want /dev/sda2 to be my active partition so that fixmbr on XP recovery disk will boot windows boot manager . I am concerned that XP Disk Management does not show /dev/sda2 as active. I understand, I think, that maybe I cna do this with : sfdisk /dev/sda -A2 using linux (but from fdisk -l this may already be done?). Like I said, XP’s Disk Management tools does not allow me to undo or do sda2 as active, but perhaps it has to be (and is) active partition on sda somehow… Does every disk have an active partition???

And yes, OpenSuse 11 install made sdb5 (my boot partition) to be the active partition, I think.

Are you (nrickert) saying that the FIXMBR will result in bootability even if I DO NOTHING TO CHANGE THE PARTITION ACTIVE FLAG(S)???

The contents of /boot/grub/menu.lst is (I can find no findgrub command):

root:/boot/grub>cat /boot/grub/menu.lst

Modified by YaST2. Last modification on Tue Apr 10 15:03:39 CDT 2012

###YaST update: former default image flavor: debug###
default 3
timeout 8
gfxmenu (hd1,6)/boot/message

###Don’t change this comment - YaST2 identifier: Original name: linux###
title Debug – openSUSE 11.0 -
root (hd1,6)
kernel /boot/vmlinuz- root=/dev/disk/by-id/scsi-SATA_IC35L120AVV207-_VNVD00G4G1UHYD-part7 devfs=mount,dall splash=silent showopts
initrd /boot/initrd-

###Don’t change this comment - YaST2 identifier: Original name: linux-
title openSUSE 11.0 -
root (hd1,6)
kernel /boot/vmlinuz- root=/dev/disk/by-id/scsi-SATA_IC35L120AVV207-_VNVD00G4G1UHYD-part7 devfs=mount,dall splash=silent showopts
initrd /boot/initrd-

###Don’t change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe – openSUSE 11.0 -
root (hd1,6)
kernel /boot/vmlinuz- root=/dev/disk/by-id/scsi-SATA_IC35L120AVV207-_VNVD00G4G1UHYD-part7 showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off x11failsafe
initrd /boot/initrd-

title XP Boot Menu
rootnoverify (hd1,6)
chainloader (hd0,1)+1

Thanks again!!

findgrub is not installed. It’s in my repo.
Open a terminal, then type:

su -l
zypper ar [noparse]http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_12.1/[/noparse]  PTA
zypper refresh -r PTA
zypper in updategrub

and post the output in code tags [noparse]


[/noparse]. It will show you where the boot loader is installed and where it looks for the menu.

But I don’t understand why you think that you need to use boot.ini to boot Linux. You can perfectly achieve what you want (see post #4) by using Grub in MBR of sdb, switching boot priority in the BIOS so that this disk will be booted first while leaving it connected to the second SATA port. If you remove that disk, Windows will boot since sda2 is your active partition (according to your fdisk output in post #7). All you need is a Windows generic MBR on your first HDD.

On 2012-04-12 01:36, odindba wrote:
> Thanks again to everyone.
> Also to be saying that my MBR
> (which I believe is on sda (drive 0) points currently to GRUB code on
> drive 1 (sdb).

No, all disks have an MBR, and no MBR can point to another disk.

> perhaps it has to be (and is) active partition on sda somehow… Does
> every disk have an active partition???

Each disk can have one (or none) active partition. Some software allow
marking two or more, but it is a bug and the result is undefined. Probably
only the first one is seen.

> And yes, OpenSuse 11 install made sdb5 (my boot partition) to be the
> active partition, I think.

Only partitions 1 to 4 can be marked active. If #5 is marked (a Linux bug),
then it is ignored, it is as if no partition is active.

Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

It probably will, but I am not sure. I would use “fdisk” to change the active flag first.

My understanding is that he wants to be able to remove sdb, and have it still boot. So using the MBR of sdb is a non-starter for that.

I gather he wants to remove sdb, and check that it boots. Then he wants to install a replacement disks as sdb. Then he wants to run cloning software to copy sda to the replacement disk. Presumably the replacement disk will eventually be installed to replace sda, with the old sdb reinstalled.

nrickert and others,

You are right in your last post about what I want to accomplish (booting from sda alone, cloning it, etc…),

Did you see my output from fdisk -l above in this thread? It shows sda2 as being active (I think???).

Someone above showed how to use fsdisk to mark a partition active, you suggest fdisk. Given my output above from fdisk -l, what arguments should I pass to fdisk to accomplish what I want? Also, is there any negative in leaving sdb5 active as well, for the future when I finish the sda clone, and put sdb back into place, using (now) boot.ini to boot linux via your /dev/sda dd copy to my C: drive for boot.ini?

Thanks yet again.

Yes, that looks fine. Using FIXMBR should be all that is needed.

On the contrary:

  • have the first HDD (sda) connnected to SATA 1
  • have the second HDD (sdb) connected to SATA 2
  • switch boot order in the BIOS, sot that the second HDD has boot priority (it might become sda under Linux, but it’s not sure and rather irrelevant).
  • From the BIOS point of view “sdb” becomes hd0 and “sda” hd1.
  • Never ever use device names anywhere (sda, sdb). I will never repeat it enough, since some people still believe that it’s just a matter of taste!
  • boot from Grub in MBR of sdb either Linux or WIndows (using the map option in Grub menu for Windows)
  • remove sdb and you can boot Windows on sda with Generic MBR and Windows partition active.

It’s as simple as that. I really don’t see where is the problem here and why you would need boot.ini. Ask @jdmcdaniel3! I think he’s using this method - except fro Grub in MBR, but the OP could install Grub stage1 in sdb4 (loading Stage2 from sdb5) and activate sdb4 if he finds it fun. it has no advantage though.

That would be sfdisk. But do you realize that you don’t need to activate any partition? They are fine. You just need to fix the MBR on sda if it doesn’t boot, forget about boot.ini and switch boot priority in order to boot from Grub in sdb if it’s there. And it you remove that disk, then your BIOS will be clever enough to boot the other disk (since it is physically the first one). Anyway, you don’t seem to believe it… and I won’t say it again.

Good luck.