Jump to content

Dual-booting Linux and Windows

I'm planning on buying a new laptop (maybe a 2-in-1) and a lot of laptops only have one m.2 storage drive, but i plan to run both Linux and Windows. On my desktop, i dual-boot but use two separate drives to avoid many of the issues I've had in the past, the main problem was having Windows keep on overwriting the boot-loader when ever it needed to update. Since a lot of these laptops do have some sort of an SD or micro SD slot, which probably wouldn't be best for use for an OS itself, being slower and over time the number of writes to it probably would eventually kill it, but I'm curious is it possible / feasible to run a boot-loader from the SD card, (assuming the laptop in question supports the ability to boot from the SD card) so therefore when Windows inevitably updates and overwrites the boot-loader on the m.2 drive it won't matter because the main boot-loader is on the SD card. Would this work and how difficult would this be to do?

Thanks.

Link to comment
Share on other sites

Link to post
Share on other sites

You could probably tell Linux to set up grub on your SD card, but the issue is that I'm pretty sure you can't boot from SD cards on most PCs. Try it out

Ryzen 7 3700X / 16GB RAM / Optane SSD / GTX 1650 / Solus Linux

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, NunoLava1998 said:

You could probably set up Linux to set up grub on your SD card, but the issue is that I'm pretty sure you can't boot from SD cards on most PCs. Try it out

True, But couldn't you do the same with an USB slot if it wouldn't work with SD, though i do hear that some laptops do allow booting from SD, which would better better than using one of the USB slots, and since i wouldn't be using an SD slot much for anything else anyway. 

The big question is how would be the best way to accomplish this, i would think the best way would be to just have a separate boot-loader on the SD card and avoid tinkering with the default ones, but that might not be possible, it might be that that the built-in grub boot-loader might have to be used and directed to the SD card, which would also work but it would take some tinkering about a bit to figure out how to do that.
 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...
On 9/23/2021 at 8:44 PM, Excalibur. said:

True, But couldn't you do the same with an USB slot if it wouldn't work with SD, though i do hear that some laptops do allow booting from SD, which would better better than using one of the USB slots, and since i wouldn't be using an SD slot much for anything else anyway. 

The big question is how would be the best way to accomplish this, i would think the best way would be to just have a separate boot-loader on the SD card and avoid tinkering with the default ones, but that might not be possible, it might be that that the built-in grub boot-loader might have to be used and directed to the SD card, which would also work but it would take some tinkering about a bit to figure out how to do that.
 

If your laptop does allow booting from an SD card you can install os-prober and then uncomment GRUB_DISABLE_OS_PROBER=false from your /etc/default/grub so when you run grub-mkconfig -o /boot/grub/grub.cfg it should detect both Windows and Linux.

 

Note: I'm pretty sure you also need to install ntfs-3g (at least that's the package on arch) so you are able to read/write NTFS partitions on linux, you will also need to mount the windows paritition somewhere on your system so os-prober can detect it.

Link to comment
Share on other sites

Link to post
Share on other sites

You don't need a separate physical disk to avoid your MBR-overwriting woes if you dont have an MBR— you can dodge some of Windows' bad boot behavior even with just a single physical disk if you rely exclusively on UEFI booting. Create your Windows install, let it do its thing, then for your Linux installation, create a separate EFI partition. If you want to use EFI variables to tell your firmware which bootable files are your operating system and what they're called, you'll use the efibootmgr command to do so, so peep its (very short) manual. If you're worried that Windows will nuke your EFI variables, you can configure the Linux bootloader as a removable disk by naming the EFI boot image file something generic which your motherboard's firmware will always pick up. If you use GRUB, grub-install will handle this automatically for you if you pass it the --removable flag. For booting without a bootloader (see EFI stub booting below) you'll need to name your EFI stub something appropriate, probably EFI/boot/bootx64.efi.

If you go this route, you can also bypass fucking around with os-prober or similar and just use your UEFI to select operating systems by choosing the appropriate ‘boot disk’. In that case, you can forego GRUB entirely and use the Linux kernel as your UEFI image (e.g., on Debian-based distros, Arch-based distros, Gentoo, etc.). Then you can just select your boot image with F12 at boot time or whatever and not bother with a menu-bearing bootloader.

If you're confident that Windows won't nuke your EFI variables (I wouldn't know; haven't booted Windows on real hardware in a decade, you can use a single EFI partition and just use efibootmgr to tell the UEFI which UEFI files are your Linux OS. You can find a generic (multi-distro) overview of UEFI multibooting here.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×