3

I have Windows Vista on my notebook's internal hard drive and Kubuntu Linux on the external hard drive.

My notebook has lost all portability because it cannot boot into Windows without the external hard drive attached (and the external hard drive is not portable). It gets GRUB error 21, because I believe it tries to load the master boot record from the external hard drive, in other words, I'm brought to the GRUB menu without problems when the external hard drive is attached during power up.

I want to make my notebook portable again, even if it means removing the Linux partition from the external hard drive. I thought I could just remove GRUB so I installed EasyBCD but it only shows Vista in the Windows bootloader.

2 Answers 2

1

When you install Linux dual-booting with Windows, the Linux installer installs GRUB (the bootloader itself) on the same drive as Linux, allowing easy configuration even if you are not mounting the other drive. But, to prevent you having to make BIOS changes, it changes the MBR on the drive with Windows (the bootable drive) with a small 'stub' program that points to GRUB.

What's happening is that all the drive in the laptop has is this 'stub' program which attempts to load GRUB from the external drive. GRUB error 21 indicates that GRUB itself could not be loaded, because the device it is on could not be found.

Unfortunately, fixing this problem is not completely easy. First, you'll need to restore the MBR on the laptop's drive to its original state, loading NTLDR (the Windows boot loader). To do this, boot the computer off of a Windows disk.

  • For NT5 (2000/XP): When prompted, press R to repair a Windows installation. Select the Windows installation. It will load the Windows Recovery Console. When prompted, enter the password for the Administrator account in the Windows installation (this is probably blank, even if you changed the password to your own user account). After a moment you will see a standard DOS prompt. Run the commands fixmbr and then fixboot to replace the Windows MBR entry and reconfigure NTLDR.
  • For NT6 (Vista/7): When prompted, select your language and keyboard layout. At the next screen, click Repair a Windows Installation. Wait while the Startup Recovery tool runs. This may take several minutes, but it will automatically set the MBR and configure NTLDR appropriately. Your computer should reboot automatically. In some cases (depending on drive configuration), you may need to do this more than once.

Once you have Windows booting again, we'll need to get Linux installed the right way. Here's how we can work this out:

  • Start the Linux install as you normally would, with the external drive plugged in.
  • When you are prompted for the disk/partition configuration, choose 'Manual' or 'Custom' rather than the automatic options.
  • Once the installer's partitioning tool loads, you will need to do a few things. If you're not familiar with disk partitioning, this might be a bit confusing. We'll need to create three partitions:
    • The boot partition. Select the drive in the laptop, and create a very small partition. You will probably have enough free space without having to resize Windows, the boot partition will only need to be around 10MB. In the partitioning tool, tell it that this partition should be mounted as /boot. You should be able to leave its filesystem as the default - ext3/ext4/reiser/whatever is fine.
    • The swap partition: Linux will use this as a space to store things that programs want to put in memory but don't really fit in memory (this swap space is why we don't see "out of memory" errors all the time these days). In Windows, the swap space is just a file (swapfile.sys in the drive root, iirc), but in Linux a seperate disk partition is used for this. Switch back to the external drive and create a new partition. Tell the partitioner to use the filesystem type 'swap'. The recommended size for a swap partition is generally twice your physical memory, but I usually just set it as 4GB regardless. You might make it larger if you expect to deal with very large things in memory (video editing is probably the only case), or set it smaller if you have lots of physical memory or don't expect to run many programs or load very large files.
    • Finally, we need the actual partition that the OS will be installed to. On the external drive, make a large partition (might as well be the whole remaining size of the drive), set its filesystem as the default or whatever you want (if you aren't familiar with the Linux filesystem choices, just go with the default), and set its mountpoint as /.
  • Proceed with the Linux install as you normally would. It will install Linux to the external drive, but will install the boot components (mostly GRUB) to the laptop's own drive. Now, when you boot the laptop without the external drive, GRUB will still load and you can choose Windows. If you choose Linux, of course, it will try to load files that aren't available and give you an error.
2
  • Your answer does seem like it should work and I tried but I still could not get it to work. I think the issue lies in the Windows System Recovery on the Vista CD. It prompts me to select an OS to fix but there is none listed, yet I can still click next and do the repair (but I'm guessing it doesn't repair anything). I also tried a chkdsk but that didn't help. I think I'm going to just back up my data and reformat both hard disks.
    – Dennis
    May 19, 2011 at 20:04
  • Hm. Usually it will locate the partition without trouble even if the bootloader is not in place. Perhaps you could try setting the Windows partition as bootable and then running Startup Recovery. I had this work once, although I don't understand why. May 21, 2011 at 5:37
1

Have you tried to set your internal hard drive as the first boot device in BIOS?

1
  • I have, but error 21 still appears.
    – Dennis
    May 17, 2011 at 5:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .