Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Assume I have a Linux host, with Windows-7 installed in a partition on the same drive.

Is it possible to boot into Linux, save its state to memory (Hibernate, essentially) then boot up Windows right beside it, close windows when I'm done and restore Linux (All without rebooting).

The goal is to use Linux as my primary OS, and when I need a windows app use snapshot software to load a windows system state snapshot to use the app, then when I'm done close it down and continue working in linux.

I am avoiding the use of virtualization technologies at all costs as I'm also using the windows installation to run games (Unless you can find me an open-source virtual solution that has 100% access to the host hardware, no ifs, ands, or buts) else please avoid suggesting virtual technologies.

share|improve this question
    
This should be possible in theory, because linux saves the hibernation data into the swap partition, which windows does not use. You might however run into trouble when your windows partition is mounted during hibernation. Also you would have too boot and shutdown windows, which means you probably lose a lot of time booting anyway. –  Tim Sep 10 '13 at 13:12
    
This a problem you actually have? What you want exists in hardware virtualization, but the software that implements this hardware support, is not free and VirtualBox isn't at the same level as VMWare and Hyper-V. Hibernate support entirely depends on what distrubution of Linux your using. –  Ramhound Sep 10 '13 at 13:20
    
Windows boot timing won't be an issue, as I'm on the prowl for a bootloader that loads both a windows image & a system snapshot of current-running state. As for windows mounting, do you mean it may be troublesome when mounting or troublesome when windows itself hibernates? (as it will not) –  user252921 Sep 10 '13 at 13:20
    
@user252921 - I am saying that without virtualization you will find it tough to find a solution that allows you to do instance swap between two operating systems. –  Ramhound Sep 10 '13 at 13:28
    
@user252921 If Windows hibernated you would be unable to mount its partition, but that's not what I meant. If you have the windows partition mounted while linux is hibernating and you change data on it (which will always happen if you boot windows), you might get unexpected behaviour when returning to your linux session. –  Tim Sep 10 '13 at 13:32

3 Answers 3

Maybe 'kexec' is what you are looking for. Kexec simply loads a new kernel + arguments and an optional initrd, then jumps to the kernels execution point. It should be possible to softboot Grub (at least Grub4Dos).

Have a look at https://wiki.ubuntu.com/RapidReboot#Reboot_into_GRUB

The scripts may need some tweaking to do hibernation instead of a reboot, but this does roughly what you wanted: softboot another OS/Kernel

This will probably only work in one direction, from Linux to Windows. The other direction will be a bit more complicated if not impossible.

share|improve this answer

"In computing, kexec (kernel execution) is a mechanism of the Linux kernel that allows "live" booting of a new kernel "over" the currently running kernel. kexec skips the bootloader stage (hardware initialization phase by the firmware or BIOS) and directly loads the new kernel into memory, where it starts executing immediately. This avoids the long times associated with a full reboot, and can help systems to meet high-availability requirements by minimizing downtime." -wikipedia

but i hope it doesn't support NT kernals even though the resources here point out that kexec loader supports Linux/multiboot.

i hope there is not any well developed mechanism that could boot the linux & nt kernals without going through reboot.

if you prefer to go through warm boot ,if you have both linux/windows partition on the same drive & if you are using a windows loader it will resume windows without showing the boot menu.

i can't say the same situation with linux loaders since i haven't tested them.I will update this as soon as i find out.

if you prefer to go through warm boot and if you could use two separate disks for each partition you may use suspend to disk which is to my knowledge is the only method that may work successfully.(as long as you wouldn't prefer visualization techniques.)

share|improve this answer

The main problem will be Windows:

Under Vista (I have not tested this under Windows 7, yet) there is the following behaviour:

If you use the Windows boot manager for switching between Linux and Windows then Windows will automatically be booted after hibernating Windows. This means: You cannot hibernate Windows and switch to Linux.

When using GRUB as boot manager Windows (Vista, but maybe also 7) refused going to hibernate state. Only if the MBR contained a "standard MBR" (that boots the active partition) and if the active partition was the Windows partition then hibernation worked.

However there was a workaround that worked on my system:

  • GRUB was installed in the (primary) Linux partition, not in the MBR
  • Before hibernating I made the Windows partition active (using the "diskpart" command)
  • Then I ran "bcdedit" without command line arguments. This was necessary for Vista to "see" that the Windows partition is active (so hibernating was not refused)
  • I switched back the active partition to the Linux partition (using "diskpart")
  • Because of not running "bcdedit" again Vista did not mention that the Windows partition is no longer active
  • The result: Hibernating worked and GRUB was booted the next time!

I wrote a program that did all these steps but it was very specific to my system. Unfortunately I do not know if this workaround works under Windows 7 or only under Vista.

The machine goes to "Hibernation" state. I don't know if this meets the requirement "no re-boot required".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.