| Bootprobleme mit Windows und Linux/Bootproblems when Windows and Linux are installed together |
|
|
|
| Samstag, 05 Februar 2011 | |
|
Wenn man entweder erst Windows installiert hat und dann Linux zusätzlich installiert oder auch erst Linux installiert hat und dann nachträglich Windows installiert gibt es verschiedene Dinge zu berücksichtigen. Hat man dieses nicht so treten Probleme auf, dass man nicht mehr das Windows und/oder das Linux starten kann. Auf den folgenden Seiten habe ich mal zusammengeschrieben was man beachten muss wenn man eines der beiden Betriebssysteme nachträglich zusätzlich installieren will, wie man Bootprobleme korrigieren kann und was man beachten muss, wenn man eines der beiden Betriebssysteme wieder löschen möchte.
===> English <===
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 ist installiert und Linux wird nachträglich installiert
Dieses ist die einfachste Variante. Die Linuxinstallation wird den MBR der Platte mit GRUB überschreiben und dabei automatisch die Windowspartition erkennen und in dem grub Bootmenu Bootmenu einen Eintrag hinzufügen, so dass man auch das Windows starten kann. Will man dann das Windows löschen muss einfach nur die Windowspartition gelöscht werden und der Eintrag im Bootmenu entfernt werden. Will man dagegen das Linux wieder löschen muss man etwas aufpassen. Wenn man einfach die Linuxpartition löscht wird nicht mehr das Windows gestartet. Man muss dazu den MBR wieder überschreiben. Entweder startet man eine WindowsInstallations CD und wählt die Reparaturoptionaus. In einer Befehlszeile gibt man dann den folgenden Befehl ein:
bootrec /fixmbr.
Danach startet das Windows wieder und man kann die Linuxpartition löschen. Alternativ kann man auch aus dem Linux heraus mit dem Befehl(Annahme: Die Bootplatte ist die erste Platte /dev/sda)
cat /usr/lib/syslinux/mbr.bin > /dev/sda
den MBR neu schreiben. Dabei muss /dev/sda entsprechend angepasst werden (/dev/sdb, /dev/sdc, ...) , wenn nicht die erste Platte die Bootplatte ist.
Linux ist installiert und Windows wird nachträglich installiert
Hierbei ist zu berücksichtigen, dass Windows den MBR in dem der Linuxbooloader steht, bei der Installation überschreibt. Man muss nun den GRUB wieder installieren. Dazu bootet man nach der Windowsinstallation eine Linux LiveCD und gibt danach die folgenden Befehle ein (Annahme: Das Linux liegt auf der /dev/sda5 Platte und die Bootplatte ist die erste Platte /dev/sda):
mount /dev/sda5 /mnt
mount -t proc none /mnt/proc
mount -o bind /dev/ /mnt/dev
chroot /mnt
Falls man eine separate Bootpartition benutzt mus diese noch mit
mount /boot
einbinden.
Danach
grub-install /dev/sda
und es ist wieder ein GRUB im MBR. Danach muss man noch die /boot/grub/menu.lst mit einem Eintrag für das Windows versehen und es können beide Betriebssysteme gestartet werden.Alternativ kann man auch den aktuellen MBR vor der Windowsinstallation sichern (siehe unten) und nach der Windowsinstallation mit einem LiveLinuxzurückspielen.
Will man nun das Windows wieder löschen reicht es die Partition zu löschen und den entsprechenden Bootmenueintrag zu löschen. Will man das Linux löschen muss man so verfahren, wie es oben beschrieben ist, wenn man erst Linux und dann Windows installiert hat.
Weitere hilfreiche Befehle
Sichern eines MBRs in einer Datei (Achtung! bs muss 446 sein!. Ansonsten kann man sich u.U. die Partitiontabelle beim zurückschreiben des MBRs zerstören!)
Annahme: Der MBR der ersten Platte soll gesichert werden.
dd if=/dev/sda of=/home/framp_020411_Backup_MBR bs=446 count=1
Zurückschreiben eines gesicherten MBRs aus einer Datei (Achtung! bs muss 446 sein!. Ansonsten kann man sich u.U. die Partitiontabelle beim zurückschreiben des MBRs zerstören!)
Annahme: Die erste Platte soll den gesicherten MBR bekommen (dev/sda):
dd if=/home/framp_020411_Backup_MBR of=/dev/sda bs=446 count=1
Links:
Supergrub Von CD, USB oder Diskette bootables Medium um diverse Grub Reparaturen vorzunehmen
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
Links:
Supergrub
Bootable CD, USB or diskette to simpilfy various grub repair activities.
|
|
| Last Updated ( Sonntag, 29 Mai 2011 ) |
| < Prev | Next > |
|---|







