How to install Windows and Linux on the same computer and make GRUB to work: step-by-step
The best strategy:
- Partition the disk with linux fdisk
- Set the Windows system partition type to NTFS
- Make ALL other partitions invisible to Windows (e.g. type ext3)
- Install the Windows and under no circumstances let it change the partition table (let it just format the system partition)
- Begin the Linux installation and change, if you want, type of some other partitions to make them visible to the Windows (e.g. from ext3 to FAT32 or NTFS)
- Proceed with the Linux installation and in appropriate place confirm, that you do want to install the GRUB boot loader in Master Boot Record.
- You are almost done. Everything should be working, you have the choice to boot either to Windows or to Linux.
- The only thing which is left to do is formatting of non-system partitions under Windows. You can do this easy using the windows system tools.
If you have Windows and Linux already installed and lost GRUB loader from MBR:
- Boot from CD-based Linux (e.g. Morphix)
- Mount the Linux root partition (e.g. mount /dev/hda5 /mnt/hda5 )
- Change directory to 'usr/sbin' (e.g. cd /mnt/hda5/usr/sbin ) There should be a 'grub-install' script there.
- Find and edit line "prefix=/" --->>> "prefix=/mnt/hda5" e.g. to the place where you mount the Linux root partition
- Stay in the directory where 'grub-install' script is ( e.g /mnt/hda5/sbin).
- Run the script as follows:
./grub-install --root-directory=/mnt/hda5 --grub-shell=/mnt/hda5/sbin/grub /dev/hda
- Reboot and enjoy.
P.S. Do not forget to roll back the changes in the 'grub-install' script if you have done some.
P.P.S. Last time (with "Debian/lenny" installed) the above procedure failed. So I did the following:
- 1) mounted the partition and gone to usr/sbin as above
- 2) started the GRUB shell directly
./grub --device-map=/mnt/hda5/boot/grub/device.map
grub> root (hd0,4)
grub> setup (hd0)
grub> quit
I did not changed anything in the grub-install script. So I just...
Rebooted and enjoy.