If you want to install Windows on a system which runs a Linux or you want to install a Linux on a box which runs Windows you have to be carefull. Otherwise you may not be able to start Windows or Linux any more. The next few pages contain instructions which you should follow in order to be able to boot both operating systems and which steps to execute if you want to delete one of the operating systems later on.

Windows is installed and Linux will be installed afterwards
That's the easiest way to have both operating systems on your box. The linux installation will write GRUB in the MBR and detect the windows partition and add an entry in the grub bootmenu for Windows. Do you want to delete Windows then you can just delete the windows partition and remove the entry in the bootmenu. Do you want to delete Linux you have to be careful. If you delete the Linux partition Windows cannot be started any more. You have to restore an initial MBR. Start your system from a windows installation CD and select the repair option. Then enter following command in a command window:
bootrec /fixmbr.
Now you can start Windows again and delete the Linux partition. Another option is to restore a MBR from the Linux system (Assumption Bootdisk is the first disk /dev/sda)
cat /usr/lib/syslinux/mbr.bin > /dev/sda
You have to adapt /dev/sda to your environment (/dev/sdb, /dev/sdc, ...) , if you don't use the first disk as the boot disk.
Linux is installed and Windows will be installed afterwards
Windows will delete the Linux MBR during installation and you have to install GRUB again in the MBR when windows was installed. Boot a LiveLinux and enter following commands: (Assumption: Linux is installed on /dev/sda5 and the boot disk is the first disk /dev/sda):
mount /dev/sda5 /mnt
mount -t proc none /mnt/proc
mount -o bind /dev/ /mnt/dev
chroot /mnt
If you use a separate boot partition you also have to mount boot
mount /boot
Now enter following command
grub-install /dev/sda
and you are done. There is a new GRUB in your MBR. Now update /boot/grub/menu.lst and insert an entry so you can boot Windows. As a second option you can save the old MBR before you install Windows and restore the MBR afterwards. You have to start a LiveLinux and restore the saved MBR (See below).
To delete Windows just delete the windows partition and remove the additional entry in the boot menu. Do you want to delete Linux then follow the instructions in the previous paragraph.
Additional helpful commands
Save a MBRin a file (Attention! bs has to be 446!. Otherwise you may destroy your partitiontabelle during restore!)
Assumtion MBR of the first disk should be saved (/dev/sda):
dd if=/dev/sda of=/home/framp_020411_Backup_MBR bs=446 count=1
Restore the saved MBR from a file: (Attention! bs has to be 446!. Otherwise you may destroy your partitiontabelle during restore!)
Assumption: The first disk should get the saved MBR (/dev/sda):
dd if=/home/framp_020411_Backup_MBR of=/dev/sda bs=446 count=1
Supergrub Bootable CD, USB or diskette to simpilfy various grub repair activities.
Add comment
eMail is hidden and not visible to the public. It's used to inform you about new comments.