Linux How to dual boot windows with Debian

TrexTom

Patron
Disciple
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.
 
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.
 
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
 
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.
 
The current installation linux is not letting me reduce the size of my root partition. Will try with live debian and install windows on that partition and reinstall bootloader.
 
Dedicated SSD for each operating system + it's own bootloader. Switch boot drive for switching OS.
Similar to seperation of concerns and utilizing bios booting when you want to switch. This would cost you now for a drive, but will help you from headaches later on.
 
The current installation linux is not letting me reduce the size of my root partition. Will try with live debian and install windows on that partition and reinstall bootloader.
Yeah, cannot resize live partition. Just boot gparted / KDE partition manager from live cd and it will work.
I usually keep root partition small and have a separate Data partition. Same with windows.

Since its uefu/gpt, you should not need to reinstall bootloader. Just select the os from bios.

Dedicated SSD for each operating system + it's own bootloader. Switch boot drive for switching OS.
During mbr days, yes. But with uefi, so far i dont think i have ever had any issue. Its not longer a problem.
Maybe had to resize EFI partition once, not sure.
 
As others have pitched in, this is no longer an issue with uefi, windows and (most) distros use their own directory inside the efi partion, and I've never (in the last 12 years that I've been dealing with uefi) had an occurrence of windows wiping the efi partion unless instructed to do so. All windows does is sets itself as the primary boot option from the list, which can be changed from the uefi menu, or using efibootmgr from live linux.
 
these days there are simpler solutions with modern bios, just buy a new hdd and install windows. use bios to switch boot device. or buy a usb key abd make ubuntu live usb and do the same.
 
Thank you all for your inputs. I was able to successfully install Windows 10 alongside Debian 12 without losing any data.

Here's how I did it:
  • Installed Ventoy on USB and put Windows iso and Gparted live iso
  • resized the root partition with Gparted to make a new partition for Windows installation.
  • installed windows on a newly created partition
I can boot to different OS during the boot process while pressing F9 on my HP laptop.
 
@TrexTom if you want you can run "sudo grub-install" then "sudo update-grub" in Debian so that you dont need to press F9 everytime (save some time) because the GRUB bootloader will present a menu to select Debian (default) or Windows everytime you bootup. Nice thing is you can apply some nice theme to the plain GRUB boot menu to make it look fancy.
 
Back
Top