Is it possible to:

  1. hibernate Ubuntu,
  2. run secondary OS (say Windows 7),
  3. shut down secondary OS,
  4. resume hibernated Ubuntu,

or not? Ubuntu should (AFAIK) hibernate to SWAP partition, which is not used by Windows. Would it work? If not, why?

  • FWIK it should work, if the secondary OS will not change things that survive a reboot (like for example NVRAM configuration). For most safety, I would power off (not reboot) in step 3. – Rmano Mar 31 '14 at 19:11
  • reference: superuser.com/questions/39532/… – Rinzwind Mar 31 '14 at 19:14
  • Would any of the drives used by Ubuntu be mounted by Windows? For myself, I run Ubuntu as my primary OS and run Windows when I need it in a VirtualBox VM. It probably slows windows down some but it is actually fairly reliable and I can switch back and forth quickly. I am however running windows XP which needs less RAM... – maddentim Apr 1 '14 at 12:42
  • @maddentim: No the OSes would be completely separate. I do run Windows in virtualbox myself, but I intend to do some gaming, which is why I need dualboot. – mreq Apr 1 '14 at 16:38

Absolutely it should work. I was doing that ages for gaming purposes as well, although now with the Steam-Linux revolution I haven't booted Windows up for months.

I had my OS partitions totally separate, as you intend to, and had no problems at all. There were no shared partitions. My swap partition is 36 GB, slightly more than twice my RAM (16 GB).

The only problem is that hibernate is slightly unstable on Linux sometimes. Probably 20% of the time, it would crash when hibernating or resuming. (This was a year ago, so things might have changed, or be different on your system. After I bought an SDD, and startup time were reduced greatly, I just restarted instead of hibernating.)

I even have a script that might be useful. You might need to change the name and location of the Windows partition.

#!/usr/bin/env bash
# hibernate and restart in Windows for only the next time.
# requires /etc/default/grub has "GRUB_DEFAULT=saved"

# get the correct name from /boot/grub/grub.cfg
sudo grub-reboot "Windows 7 (loader) (on /dev/sdb2)"

# or use the number, i.e.
# WINDOWS_ENTRY=`grep menuentry /boot/grub/grub.cfg  | grep --line-number Windows`
# MENU_NUMBER=$(( `echo $WINDOWS_ENTRY | sed -e "s/:.*//"` - 1 ))
# sudo grub-reboot $MENU_NUMBER

sudo dbus-send --system --print-reply --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

# if this fails, you can try ---> sudo pm-hibernate
| improve this answer | |
  • Is that much swap space necessary? I have 16GB RAM and thought I should be fine with 18GB. Is that wrong? – lucidbrot Mar 14 at 11:58
  • 1
    @lucidbrot Depends on your usage I guess. The old "rule of thumb" was 2x RAM, but yes, I think that is probably overkill nowadays. For hibernation, you'll need more swap than the RAM of course, then (probably?) a bit more for the normal swap function, i.e. if RAM runs out. (FWIW I now use zero swap for my 32-GB RAM systems, and I've never filled the RAM.) Back when I wrote this answer, it was an easy decision to use a bit more than 2x RAM, because I had so much hard drive space. – Sparhawk Mar 14 at 23:21

I am probably repeating similar answers, but It should be possible as long as where your hibernation files are saved is separate from, as in your example Windows 7. (Windows 7 likes to take control of the partition, or disk it is on, so it is best to keep Ubuntu to it's own area anyway).

I would test just a regular hibernation with a hard reset (or maybe even pull the plug/battery), and see if you can recover your hibernation "before-state" from that.

For more on hibernation for Ubuntu I looked here: https://help.ubuntu.com/community/PowerManagement/Hibernate

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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