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"
@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

@KyleGospo
Copy link

My disappointment is immeasurable and my day is ruined

@stygia-dev
Copy link

One day you will have to answer for your actions and god may not be so merciful

@fadh1l
Copy link

fadh1l commented Apr 10, 2023

my broke ass without any extra space on my shitbook. Believe me it looks very compelling for a uni student setup 🤧

@OranWeb
Copy link

OranWeb commented Apr 10, 2023

lmeow

@Endeade
Copy link

Endeade commented Jun 8, 2023

image
I'll see yall soon

EDIT: https://youtu.be/fNdqEDBrrag here it is!

@p0358
Copy link

p0358 commented Jul 2, 2023

One thing occured to me

the pioneer says "the system will break after a few boots"

Did you ensure to disable the "Fast Startup" functionality on the Windows installation? See the red warning here: https://wiki.archlinux.org/title/Dual_boot_with_Windows#Fast_Startup_and_hibernation (as Windows actually hibernates when you press shutdown, and then booting into Linux and mounting such NTFS partition with unsynced metadata cache can mess it up)

@fabiscafe
Copy link

@p0358 This wasnt the problem. At the first few releases of ntfs3 it would fail to unmount cleanly at shutdown/or at unmount. This alone was enough to render the filesystem at some point non working, in parts or at full. This seems however to be fixed by now. You dont even have to have a windows installed in that ntfs.

@p0358
Copy link

p0358 commented Jul 2, 2023

Okay so I tried it on a VM, and managed to go through the installation, it booted up. Then I realized I actually didn't set the user account properly and couldn't log in. So out of habit, I just did "Reset" on the VM to boot it back up to Arch ISO. And... apparently that already corrupted the filesystem beyond saving, it couldn't be mounted anymore, and moreover, it seems that Windows's diskpart doesn't even seem to recognize the partition as NTFS anymore, wow...

I'll probably try one more time or still poke around to see if I can save it, but if even Windows gives up, then I think doing this (or even using NTFS3 driver in the first place) may still be a bad idea

@teamgroove
Copy link

I summarize my feelings about your pioneering and advancing this: I thought we all agreed that this is a terrible joke and a very, very bad idea and a ridicolous way to waste your precious lifetime. Please, please move on to things that matter in any way.

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