Linux How to dual boot windows with Debian

TrexTom

Patron
Patron
I have read numerious articals about dual boot Linux with windows but not other way around. I already have installed Debian and want to install windows on it but all the sources tell that it will erase the grub bootloader.

Anyone have any idea about how to install windows after Debian then please tell me.
 
Yes. Windows is ******* like that. You need to install Windows first and then Linux. That's the easiest way.
 
can't format my linux as I have configured a lot of things on it.
 
Then you need to install Windows on an empty disk. (I am not sure if an empty partition will suffice but I have learned not to give benefit of doubt to Windows. Also, disconnect your Linux disk just to be safe.) Then, follow a guide which can tell you how to restore your grub bootloader after you have installed Windows and reconnected Linux disk.
 
run a windows VM inside Debian if it is just for some minimal usage.
 
If you are using uefi/gpt - then there is no issue as each os has its own place for bootloader. Worst case, you will need to select preferred bootloader after installing windows

---------

If its old format - mbr. Then yes windows will overwrite boot sector which is saved in first few bytes of the hard disk. One safe way to mange it is to install windows in a different hard disk / ssd. Can take out existing one for peace of mind.

If that is not possible, its still not a big issue. You just need to reinstall grub after installing windows.
Boot using livecd, then chroot into your linux partition and reinstall grub and update grub.

Script to change root - input is root of target linux partition which you will need to mount first.
All of this needs root acces ( just do sudo su )
Code:
#!/bin/bash mount -o bind /proc         $1/proc mount -o bind /dev          $1/dev mount -o bind /dev/pts      $1/dev/pts mount -o bind /sys         $1/sys cp           /etc/resolv.conf     $1/etc/resolv.conf  chroot $1 /bin/bash

Then install and update grub this way. replace sdx with your target drive. ( can get using blkid)

Code:
grub-install --recheck /dev/sdX grub-mkconfig -o /boot/grub/grub.cfg
 
yes, I have gpt partition. Will try to install but before that will take full drive backup with clonezilla.
 
Best option is what user Mr.J said, use a new disk which comes cheap these days and you will feel satisfied. Remove disk with windows while installing Linux.
I have done multiple dual boot installations, got into trouble several times, my colleagues vaguely copied my tricks and got into real trouble and blamed me for it later:p
Can consider Ventoy as an alternate option.
 
This is simple.

Install Windows on a new partition.

Reboot to Linux Installation media live session. Fire up the terminal and reinstall the grub-bootloader on the target EFI partition.

Many distros such as MX Linux, Mint come with GUI tools for this.

As simple as that.