Setting up a dual-boot system on a PC typically requires installing Windows first and then Linux. This sequence is recommended because Windows tends to overwrite the bootloader (like GRUB) during its installation, which can complicate a pre-existing Linux setup. However, I successfully reversed the process—installing Windows after Linux—by employing a series of workarounds. In this post, I’ll document the method, explaining the technical challenges and how I addressed them so others can replicate them.
To summarize the tutorial: You will Install Windows on top of the old Linux, Install the new linux, and clone data from the old linux to a new one.
I assume you have installed Linux; otherwise, do not bother and install it in the usual order.
Use the following commands to identify your disk's EFI, swap, and root partitions, and write them somewhere.
lsblk -l sudo blkid
Now, you cannot boot into the original Linux, but you should be able to boot into Windows.
We will install a second linux to have a functional bootloader and restore data from the original OS.
sudo su
# if original disk encrypted, decrypt it.
cryptsetup luksOpen /dev/<ORIGINAL-OS-DISK> cryptdisk
mount /dev/mapper/cryptdisk /mnt
#If disk is not encrypted, just mount it directly
for i in /opt /usr /home /.config /.local /bin /root ; do rsync -avz /mnt$i $i ;done
Well, this means the disk is not cloned; only data are.
This command is safe. You also can mount the whole “/” root system. However, you will encounter errors, which you will have to resolve.
To give an example: /etc/fstab
cannot be copied because the partitions do not exist anymore.
initramfs
file on Manjaro, use mkinitcpio
update-grub
command to regenerate GRUB config.You have successfully installed Windows on the existing Linux and restored the original data.