Better Dual Booting

I need Linux for development work, and Windows for software like Photoshop (sorry, Gimp). VMs have high keyboard latency and power consumption, and passing through a GPU is annoying. Default dual booting makes me reopen everything when I switch OSes, and is routinely broken when Windows Update overwrites GRUB. After years of tolerating this stuff, I finally have a setup that I'm quite pleased with.

The setup is dual booting, with two tricks. The first is that you can exploit the hibernate feature to get session restoration. The second is that by putting GRUB on the Linux partition (not the Windows one), you can avoid having it get periodically overwritten. Together, these combine the native hardware experience (no input lag, easy GPU configuration, reasonable power consumption) with the perks of virtual machines (save and restore sessions, no Windows Update shenanigans).

Session Restore

Session restore is actually quite simple. If you use 'hibernate' instead 'shut down,' the state of each operating system will be saved to its respective disk and seamlessly restored when it next starts up, with all your programs as you left them.

A quick reminder: When you tell your computer to hibernate, it writes the state of the RAM to disk, and then reads it back into RAM when the computer wakes up.

Here's how it works with a dual boot. When you hibernate Windows, the state of your Windows OS will be written to the Windows disk. Then you can boot into Linux, which will read its prior state from the Linux disk and resume your session, but leave your Windows session untouched on your Windows disk. Next time you boot into Windows, Windows will detect that it's resuming from hibernation, and drop you right where you left off.

I've noticed only one 'gotcha' with this setup: the file system is marked dirty during hibernation, so you can't modify files on your Windows drive while Linux is active, or vice-versa.

In Windows, hibernation is a simple as ticking a box and then selecting 'hibernate' from the power menu. In Linux, the s2disk command puts the computer into hibernation.

Stability & Windows Update

Usually, when you install Linux, GRUB is written to your Windows drive, which has the first boot priority. When your computer turns on, it loads GRUB from the Windows drive. From here, you can either boot Windows, or direct GRUB to boot Linux from the other drive. Unfortunately, when Windows updates, I find that it will occasionally overwrite your GRUB (which is on the Windows drive) with the Microsoft bootloader.

To avoid this, install GRUB to your Linux drive. Then, set your computer to prefer booting off your Linux drive. When the computer turns on, if the Linux drive is connected, you'll get GRUB, where you'll be able to select either Linux (continue booting on that drive) or Windows (switch to the Windows drive). If you unplug the Linux drive, the computer functions just like a normal Windows machine without GRUB. When Windows updates, it won't touch GRUB or anything else on your Linux drive. Stress free Windows updates!

And if I have a laptop?

My laptop solution is similar but simpler. I keep a Linux SSD in the sleeve of my laptop bag. When I need Linux, I plug it in and boot off it. It's slightly less elegant than slotting a second drive into a tower, but it gets the job done.

Notes

I do this with separate SSDs in my tower, and I carry around an external disk with my laptop. I wouldn't be surprised if you could do mirror this setup easily with disk partitioning.