Fix bootloader problem with Linux in windows
If you install windows after you installed Linux, the Linux bootloader will be “overwritten”.
To fix this, you don’t have to reinstall grub or syslinux or any other bootloader you are using. Just boot into windows, figure out on which partition the bootloader is and set the active partition flag on this partition.
set the active partition
to set the active partition, you simply can use diskpart. Run diskpart:
diskpart
then navigate to the disk, containing the Linux partition with the bootloader. For example:
select disk 0
select partition 3
active
exit
in this case, the bootloader of my Linux installation was on my first disk on partition three.
update problems
For some updates in windows 7, the active partition needs to be the partition with the windows bootloader on it. The windows 7 bootloader partition is usually 100MB big and is the partition right before the partition with your windows 7 system.
scripts
to make life easier, I wrote some scripts which set the active flag on either the partition with syslinux or the partition with the windows bootloader.
file arch
select disk 0
select partition 2
active
exit
file windows
select disk 0
select partition 3
active
exit
file set_boot_loader.bat
diskpart /s "%~dpnx1" > logfile.txt
file set_boot_loader_arch.bat
set_boot_loader.bat arch
file set_boot_loader_windows.bat
set_boot_loader.bat windows