Skip to content

Instantly share code, notes, and snippets.

@motorailgun
Last active June 18, 2024 06:22
Show Gist options
  • Save motorailgun/cc2c573f253d0893f429a165b5f851ee to your computer and use it in GitHub Desktop.
Save motorailgun/cc2c573f253d0893f429a165b5f851ee to your computer and use it in GitHub Desktop.
Installing Windows and Linux into the same partition

Installing Windows and Linux into the same partition

But WHY?

There was a reddit post about installing Arch on NTFS3 partition. Since Windows and Linux doesn't have directories with same names under the /(C:\), I thought it's possible, and turned out it was actually possible.
If you are not familiar to Linux, for example you've searched on Google "how to dualboot Linux and Windos" or brbrbr... you mustn't try this. This is not practical.

Pre-requirements

  • UEFI system
  • Any Linux live-boot CD/DVD/USB... with Linux kernel newer than 5.15
  • Windows installer USB

How-to

  1. Boot up Linux and create a EFI system partition. 1GB is enough (512MB may not be)
  2. Boot up Windows and normally install it. You may need to choose "Custom: Install Windows only" option.
  3. When finished, boot up Linux install USB and mount the NTFS partition Windows created. Note you need to specify -t ntfs3 on mount.
  4. Mount EFI partition and other needed ones (like swaps) and continue installing.
  5. Don't forget to "Add rootfstype=ntfs3 as kernel parameter"
  6. Done!

Known issues

  • ldconfig crashes for me, using Arch.
  • sometimes kernel panics on poweroff.
  • the pioneer says "the system will break after a few boots"
@QDelage
Copy link

QDelage commented Nov 22, 2021

How can I report this to proper authority?

@SeeMyPing
Copy link

image

@solsticedhiver
Copy link

solsticedhiver commented Nov 22, 2021

Capture d’écran de 2021-11-22 20-48-53

@bruno-brant
Copy link

Yeah, but your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.

@Issam28
Copy link

Issam28 commented Nov 22, 2021

Even if you can do it doesn't mean you should!

@Trumeet
Copy link

Trumeet commented Nov 22, 2021

Cursed, but it's a good attempt. Hope to see Windows and Linux in the same pattern.

@is0ss
Copy link

is0ss commented Nov 23, 2021

I am happy to be here to witness history.

@razmae
Copy link

razmae commented Nov 23, 2021

I'm here to support. For history.

@iBug
Copy link

iBug commented Nov 23, 2021

image

@halferty
Copy link

Next challenge: Create a bootable Linux environment entirely from within Windows. Somehow mount the EFI partition within Windows, drop the kernel there (with an embedded initramfs), set up a Linux root on your NTFS partition, reboot, choose the EFI stub, and go.

@gregopet
Copy link

One of these operating systems is a tortured animal! (and the other one is a mildly uncomfortable penguin)

@csolisr
Copy link

csolisr commented Nov 23, 2021

Next challenge: Create a bootable Linux environment entirely from within Windows. Somehow mount the EFI partition within Windows, drop the kernel there (with an embedded initramfs), set up a Linux root on your NTFS partition, reboot, choose the EFI stub, and go.

Windows 10/11 already setup an EFI partition on the default installation. So it would be easy to install the EFI stub in there, in fact I already installed GRUB in the same EFI partition as Windows for my current dual-boot installation.

@Tronic
Copy link

Tronic commented Nov 23, 2021

Now you can use Windows as the fsck tool for when your Linux drive gets broken. Epic!

@renelinked
Copy link

When you're at it and all into that - why not tweak and squeeze the little penguin a bit harder: enable "NTFS disc compression" to raise the heat at the north pole ...
https://www.windowscentral.com/how-use-ntfs-compression-windows-10

hint: another one bites the dust!

@aminvakil
Copy link

Brilliant!

@jae1911
Copy link

jae1911 commented Nov 28, 2021

angery

@heisid
Copy link

heisid commented Nov 28, 2021

Beautiful.
Now you can install wine and set wineprefix to /

@vvviperrr
Copy link

tight, tight, tight. oh yeah. ntfs, fat32, exfat - whatever man, keep doing it.

@ewnavilae
Copy link

🤢 🤮

@adam-arold
Copy link

Just because you can, doesn't mean you should.

@neonoxd
Copy link

neonoxd commented Dec 3, 2021

oh

@TCH68k
Copy link

TCH68k commented Dec 3, 2021

Good job. Maybe OS/2 can be installed as a third if it's directory names do not collide with either.

@iraizo
Copy link

iraizo commented Dec 6, 2021

burn it with fire i beg you

@r0b0
Copy link

r0b0 commented Jan 10, 2022

now I just need a windows port of debootstrap

@p0358
Copy link

p0358 commented Jan 30, 2022

I hope this will be a widely supported option in the future, this has the potential to make Linux installation really painless for both newcomers and more advanced users. Separate partition makes you need to think ahead of how much space and where you should have, resizing is annoying, and if users end up sitting more in Windows, Linux partition can easily end up as something to remove to quickly expand the Windows partition when need arises. Shared space will deal with all of that.

Windows itself upon any upgrades should not touch any files that doesn't belong to it. It goes pretty far in ensuring that actually. I guess reasons partially being users may keep their own files or even different Windows installations in the same partition and they should never get removed. It goes far enough that even when you restore Windows with its "delete everything" option, it will actually *keep all non-Windows files, and move Users directory into Windows.old. This state of things means such Linux installation would not normally be easy to accidentally remove under normal conditions.

Second, it might allow purely from-Windows installation. Diskpart can mount EFI partition into read-write mode, you could easily write GRUB to it. The only matters to consider would be how to get into boot menu or whether GRUB would automatically be recognized, that's the only thing user would need to figure out on their own. Oh, and Secure Boot key enrollment if using SB and not using a pre-signed kernel like one from Ubuntu.

I hope this kind of installation could get more stable in the future, it would benefit the Linux community greatly in the long run. Imagine when the new SteamOS gets released, people pissed off with Windows 11 and its performance might want to try out a Linux that also already runs most of their games out of the box, etc.

I'm curious what happened in the original OP's system that caused the system to become unbootable and what was the cause of the kernel panic as well...

It'd be nice to see some productive discussion rather than 200 shitposts calling it out as heresy xD
Future is now boomers
2022 can really become the year of desktop Linux

@Querela
Copy link

Querela commented Jan 31, 2022

@p0358 +1

Still not sure whether this is a good idea but the reserved partitions are a good argument. WSL seems like a good solution but it also reserves spaces and grows its VHD but doesn't shrink...

I did not know Windows was that careful about other files. Not sure how careful Linux is and whether those who reinstall Linux any X years for a fresh or other version will handle this setup. But might be a non-issue. (I also like to declutter by doing a fresh Win install.)

@zinjanthr0pus
Copy link

Now you have to try it on a btrfs partition!

@pachoning
Copy link

Is Internet Explorer working there?

@fadh1l
Copy link

fadh1l commented Nov 20, 2022

Witnessing some dark magic voodoo stuff right here

@OranWeb
Copy link

OranWeb commented Feb 17, 2023

meow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment