Tag Archive: MBR

When you are having OS and you are going to delete the OS through windows you have to download the software EASYBCD

Step 1 – Check where the bootmgr resides

Open Disk Management and find the partition that is marked “active”. That is the partition that contains the bootmgr.

The active partition is usually from the OS that was on the system first – e.g. if you installedWindows 7 on an XP system, the XP system would be the active partition. But there are also other cases.

If Windows 7 was the first OS on the system, then your bootmgr resides most likely in a separatesystem partition which is usually small.

If you installed Windows 7 as first OS to a disk that was not attached to the Sata port0, it can very well be that the bootmgr resides on an arbitrary partition on the disk that is attached to port0.

If you have e.g. a Dell system, your bootmgr may be on the recovery partition. Other OEMs may do the same, but I was not able to verify that.

This is the example of my current system. Note the two last partitions which are Windows 7 and Windows 8. The Windows 7 partition is marked as active. You also see that I have no small system partition because I have eliminated that partition after I moved the bootmgr from that small system partition to the Windows 7 partition.

Dual Boot - Delete a OS-pic-1.png

If I would delete the Windows 7 partition, my Windows 8 would not boot any more because it would have lost it’s bootmgr that is in cohabitation with the Windows7 bootmgr.

In order to avoid such an unfortunate situation, we launch the system that we want to retain and move the bootmgr to that system’s OS partitionHere is how.

Step 2 – Delete the unwanted OS partition and reuse the space

Stay in the OS that you want to keep and open Disk Management. Right click on the partition that contains the OS you want to delete and Delete Volume. Then right click on the deleted volume and Delete Partition. Now you should have “Freespace” where this partition originally was.

With Disk Management, you can define a new partition in that freespace or you can add it to the partition that shows to the left of that freespce. Just click on the partition which is to the left and Extend Volume.

If, however, you want to add that freespace to a partition that is to the right of the freespace, then you have to use an external tool. I suggest the bootable CD of Partition Wizard. Here is how.

A word of caution: before you manipulate partitions with Partition Wizard, make an image of all partitions on that disk. I once lost all my partitions on a disk because I made a small mistake manipulating one partition with Partition Wizard. For imaging I recommend Free Macrium. Here is how.

Step 3 – Cleanup the bootmgr

Now that we removed one OS, we have a surplus entry in the bootmgr. We will remove this entry with EasyBCD. As you can see in the picture, the operation takes only 4 clicks.

EasyBCD is a very handy tool for a variety of operations on the bootmgr. You should have that in your toolkit anyhow.

Dual Boot - Delete a OS-pic-2.png

If you stop at this step, the MBR is still in a double boot configuration and when you boot, the BIOS will present you the black screen where you have to choose the operating sytem – although only one operating system is present. This is not a disaster, but it is an unnecessary step that requires your intervention.

The next two steps will reset the MBR to your current OS and then your system will automatically boot into that.

Important: You absolutely have to execute both Steps 4 and Step 5. If you only do Step 4, your system will not boot any more. 

Step 4 – Clean the MBR

Dual Boot - Delete a OS-pic-3.png

Step 5 – Reset MBR with the entry of the current OS

Dual Boot - Delete a OS-pic-4.png

GRUB got deleted; how to restore?

This will often happen if you install Windows after Linux. Windows assumes it’s the only operating system in the world and does not try to live with existing information present in the MBR; it overwrites it. For people with dual-boot and very little knowledge of Linux, this is a disaster. Luckily, it’s very easily recoverable one.

  • Boot from floppy disk or CD (any Linux live CD should do).
  • Get to the grub command line.
find /boot/grub/stage1 (optional)
root (hdX,Y)
setup (hd0)

The same as before!

Windows is installed on a non-first hard disk (Swapping)

GRUB cannot directly boot Microsoft operating systems. And sometimes, even chainloading may not work, especially if Windows is not installed on the first hard disk. Once again, you should remember that you should always install Windows first, on the first hard disk, on the first partition (the rule of three first). Nevertheless, even if you have Windows installed on a separate disk, you can solve the problem by swapping.

You need to perform a virtual swap between hard disks. Like this:

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

After you add these two lines, you should be able to boot into Windows (or DOS, for that matter).

There is more than one Windows operating system installed on one hard disk (Hide/Unhide)

Again, Windows can cause problems if there’s more than one instance present on a hard disk, especially if installed on primary partitions. When you use the chainloader command, the control is transferred to the Windows boot loader, but which one?

The problem is easily solved by hiding and unhiding partitions. If GRUB hides a partition, it will not be visible by Windows and prevent a possible confusion. Vice versa, if you unhide a partition, Windows will detect it and be able to boot from it, without getting confused.

Here’s the example taken from the Manual that demonstrates this point.

Let’s say we have Windows installed on the first and the second partition of your hard disk. We wish to boot the first instance of Windows. Then, we need to execute the following set of commands to make it all work:

unhide (hd0,0)
hide (hd0,1)
rootnoverify (hd0,0)
chainloader +1

You resized a partition; GRUB is gone

This is an interesting case. It can happen after you use a partitioning or an imaging software to make changes to the Partition Table. Usually, this will happen when you make such a change in Windows. Linux will not be informed of the change, because Windows is blind to anything else on the machine save Microsoft thingies. Consequently, GRUB will suffer.

The solution is that most likely the filesystem is damaged and needs to be repaired.

Boot from a live CD and execute the following commands, assuming you know where Linux partitions are.

Check the filesystem:

fsck.ext2 /dev/hdXY

Replace X and Y with hard disk letter and partition number that you want to check (hda2, hdb3, etc.).

Create the ext2/3 filesystem parameters again.

tune2fs -j /dev/hdXY

Now mount the root filesystem on /mnt/sysimage and run grub:

mount -t ext2 /dev/hdXY /mnt/sysimage
mount -t ext2 /dev/hdXY /mnt/sysimagecd /mnt/sysimage/sbin

You’re back to the familiar grounds.

%d bloggers like this: