Saturday, January 8, 2011

Wubi and hibernation

Wubi doesn't support hibernation... out of the box. But as Agostino Russo (all hail the creator) points out this is only because Wubi uses swap files, not partitions (if you could partition, why use Wubi?)

So yes it's true you can hibernate a Wubi install. And if you're just using it to test, you may well already have a swap partition lying around, so why not use it? Especially with 10.04 and 10.10 that seem to be a bit heavier on memory use than 9.10.

To set up hibernation on Wubi is the same as on a regular install. Just take the UUID of the swap partition and make sure it's in /etc/fstab and /etc/initramfs-tools/conf.d/resume. Then run "update-initramfs -u" to update the initial ram disk to point to it and look for it to resume from hibernation.
For example, assuming your swap is /dev/sda7:
$ sudo blkid /dev/sda7
/dev/sda7: UUID="xxxxxx" TYPE="swap"

$ cat /etc/fstab | grep swap
UUID=xxxxxx none swap sw 0 0

$ cat /etc/initramfs-tools/conf.d/resume

# if that's all good
$ sudo update-initramfs -u

Hint: if you are already using the Swap partition elsewhere don't run mkswap again or it will change the UUID.

Note: if you don't have a swap partition lying around and want to create one, make sure that it's big enough - to be safe I'd say the size of your RAM plus 1GB for overflow. Then run "sudo mkswap /dev/sda#" substituting # for your new swap partition and continue with the instructions above.
But if you're going to start creating partitions, I'd just take it one step further and migrate the Wubi install.


  1. Hi, is it possible to use a flash card for swap? If so, could it be set up just for hibernation and continuing using the loop-mounted swap file for normal operation?
    Thanks, D-E

  2. Could you please a more detailed step by step tutorial. I am new to linux and did not get any of the above :D I have done the wubi installation on 11.10.

    1. For support you can post a question on launchpad. Add links to pastebin for your diagnostic output. Also specify the sizes of your RAM and your swap partition. Thanks