What you should have ready:
- A live-linux cd or dvd of your choice containing the version of GRUB you have on your system. I prefer Xubuntu 8.10
- The Windows 7 installation DVD, 32bit or 64bit depending on your OS.
- Windows and Linux installed
- A USB stick or write-access to one windows-readable partition within your Linux installation
Normally, you will have installed Windows first, then Linux and then have repaired your Windows Boot using the Automatic Repair of your Windows 7 installation DVD, which means, you cannot access your Linux any more. Therefore you will need to reinstall GRUB.
- Boot the live-linux of your choice
- Open a console and become root (according to the live-linux distro)
- Cast grub on the console and you will getgrub>You are in the "interactive mode" of grub.
- Find the partition where GRUB resides by casting find /boot/grub/stage1 to grub - you will get something like:grub> find /boot/grub/stage1
(hd0,5)
grub> - Tell grub to take the partition (in my case (hd0,5) ) as root partition, install the boot loader and quit afterwards:grub>root (hd0,5)
grub>setup (hd0,5)
grub>quit - After successful isntall you can restart and boot into your Linux system.
Great, Linux starts and Windows 7 will, if you had an entry for it in your GRUB menu, tell you "BOOTMGR missing" if you try booting into it.
To include GRUB into the Windows 7 boot loader, it has to be installed in the root partition of your Linux installation:
- boot into your installed Linux (if not already done so) and open a root console
- find the partition where your Linux resides using fdisk -l. The response will look somewhat like /dev/sda5.
- install grub into that partition with the command grub-install /dev/sda5(change the /dev/section to meet your output.) There might be minor errors which are marked "non fatal". You should get a successfully installed message in the end.
- Export the Linux boot sector using (again change /dev/sda5 to the device where your Linux resides):dd if=/dev/sda5 of=/tmp/linux.bin bs=512 count=1and copy the file /tmp/linux.bin to a location which you can access via Windows 7cp /tmp/linux.bin /yourmountpoint/
Add Linux to the Windows Boot loader
- boot into your Windows 7 installation, if not already done so
- copy linux.bin created before into the root directory of your Windows installation (normally C:\)
- start a command prompt with administrative rights: to do so, click start, type cmd into the start text field, DON'T press RETURN, but press CTRL+SHIFT+RETURN.
- in the command prompt cast bcdedit /create /d "GRUB" /application BOOTSECTOR This will give you back an SID like {63ea1432-234ff-44da-bd24-ceb4e3230e14} which I refer to as {yourSID}
- cast bcdedit /set {youSID} device boot - which sets the destination of the Linux boot
- cast bcdedit /set {yourSID} PATH \linux.bin - which sets the path for the destination
- cast bcdedit /displayorder {yourSID} /addlast which sets the menu entry
- optionally, set the waiting time using bcdedit /timeout 15 or whatever waiting time you want.
Side note: this should work for almost any Linux distribution out there, which uses GRUB as boot loader.
No comments:
Post a Comment