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.