Posts Tagged bcdedit
Windows 7 and Linux Can Coexist.
Until I got my laptop last year, I had been using Linux almost exclusively for almost two years. The main reason was that I was too cheap to buy a legitimate copy of Windows XP or Vista. When I got my new laptop, however, it came preloaded with Windows Vista. Admittedly, I didn’t exactly love it, but I didn’t find it to be quite so unappealing as many other’s did. Nevertheless, I quickly repartitioned the hard-drive and dual-booted my system with my favorite flavor of Linux at the time. All was wonderful.
Despite the fact that things seemed to be working rather well, I had come to the realization that my computer was a 64-bit system, and the versions of Vista and Linux I had been running were only 32-bit, so I decided to do some upgrading. I got the 64-bit version of Windows 7, and switched to the 64-bit distribution of Ubuntu. Unfortunately, after installing both in the traditional fashion, allowing GRUB to manage the boot process, Windows 7 decided that something was wrong and kept uninstalling all my programs—even Microsoft Office 2007. It turns out that Windows 7 would not accept anything in the MBR except the Windows Boot Loader. This made dual-booting with Linux a little tricky, but not impossible. I will now provide you with the steps I had to use to get Windows 7 and Linux to coexist peaceably. Using the following configuration, you can successfully have Windows 7 and Linux on the same machine, and Windows 7 will remain content and not think that something is wrong, because Windows Boot Loader will still be in control. Whether or not everyone out there has this problem, I don’t know, but I do know that I am not the only one to have experienced it.
**NOTE** This is written under the assumption that Windows 7 is already installed to a primary partition, and that unpartitioned space has been allotted on the hard-drive for the Linux installation.
Step 1: Make sure you have a separate boot partition for your Linux install. Typically, when I set up a normal Linux desktop install, I use 3 partitions. One 50 – 100 MB ext3 partition for /boot, another partition equal to the amount of system RAM for the swap partition, and a final ext3 partition for the root (/) directory. These are naturally in addition to the NTFS partition for Windows. This is the type of setup I would recommend. Naturally, your exact partition structure should be customized to meet your specific needs, but for dual-booting a desktop/laptop system, this will accomplish the installation with the use of four primary partitions, and provide you with the separate boot partition.
Step 2: Install your Linux distribution as usual, until it asks about configuring GRUB. For the most part, this is a by-the-book installation for Linux. Use all the typical settings and preferences that you would normally use for your system, except for where you install GRUB. I’ll talk about that next.
Step 3: Install GRUB to the /boot partition. Assuming you’ve followed my advice, and created all your partitions as primary partitions, most likely, your NTFS partition is /dev/sda1, /boot is /dev/sda2, the swap partition is /dev/sda3, and the root (/) partition is /dev/sda4. (It is possible that it might be /dev/hda instead of /dev/sda.) The default location for GRUB to install is to the master boot record (MBR) of the disk on which you are installing Linux. This is most likely going to be identified as /dev/sda0 (or possibly /dev/hda0). Change this to /dev/sda2 (or to whichever partition you have assigned /boot). This will install GRUB without overwriting the MBR. Once Linux is done installing, you’ll need to reboot into Windows 7 and make some changes.
Step 4: Change the Windows Boot Loader to offer your Linux install as an option. After your system reboots, it will load straight into Windows 7. While it is possible to edit the Windows Boot Loader manually using bcdedit from the command line, the better thing to do is download EasyBCD from NeoSmart.net. This handy-dandy little tool will give you a GUI to edit the Windows Boot Loader, which is far easier. Simply install the program, start it up, select Add/Remove Entries, pick the Linux tab on the bottom, choose GRUB and the appropriate partition, type in the name of your distro, and click Add. Once back on the first screen, click the Change Settings button. Then adjust the bootloader timeout length and the default OS option if desired. Once you apply your changes, you can reboot.
You should now see your newly added Linux entry on the Windows Boot Loader. Select that option and hit the enter key. This should take you to the GRUB menu. Now press enter to load Linux. Once you have loaded into Linux, you can make changes to the GRUB menu so that Winows 7 isn’t listed in GRUB, and/or you can remove the timer delay altogether, and have GRUB automatically load the default option once it takes over, though often, there are multiple boot configurations for Linux, so this may not be such a good idea.
