Features

  • Image compression (LZF – very fast and highly recommended).
  • Full asynchronous I/O and readahead for synchronous I/O for maximum throughput.
  • Support for any number of swap partitions and/or files.
  • The ability to cancel a suspend cycle (during suspending) by pressing escape.
  • The ability to specify a maximum image size.
  • Support for saving a full image of your memory, resulting in a fast, responsive system after resuming.
  • Support for plugins: data transformers (compression, encryption) and new storage backends (NFS support is planned).
  • Works out of the box for most configurations.
  • Nice user interface (GenSplash compatible).
  • Support for Highmem (up to 4GB), SMP and preemptive kernels.
  • Scripting support.
  • Speed and reliability – Software Suspend has been extensively tested in a variety of configurations over many months. It is not guaranteed to be perfect, but bugs found will be hunted and fixed quickly.
  • Can be configured to be a drop-in replacement for swsusp (for swap partitions – swap files are configured more simply with Suspend2).

Suspend-to-disk implementations explained

Since the original Software Suspend code was written by Gabor Kuti and Pavel Machek back in 1998, four different implementations have been created for the 2.6 kernel, all forks of the same original codebase. Here is a quick comparison between the three that still exist. The first column refers to CONFIG_SOFTWARE_SUSPEND in the 2.6 kernel. pmdisk has been merged back into the original “swsusp” implementation in the kernel, and hence is no longer listed here. The second column refers to what is now commonly called “Suspend2” and is what this site largely deals with. The third is userspace swsusp, developed by Rafael Wysocki.

NameswsuspSuspend2uswsusp
Available in kernel2.6.xpatch against 2.6.xsince 2.6.17
Kernel config optionCONFIG_SOFTWARE_SUSPENDCONFIG_SUSPEND2CONFIG_SOFTWARE_SUSPEND
Principle authorPavel MachekNigel CunninghamRafael Wysocki
PM subsystem requirednonenonenone
Telling kernel at boot where to save imageresume=/dev/hda#resume|resume2=<file:|swap:>/dev/[node]<:sector></file:|swap:>
How to activate suspendecho -n disk > /sys/power/stateecho > /sys/power/suspend2/do_suspend or echo disk > /sys/power/state if replacing swsusp is enabled.Userspace program
Telling kernel not to try and resume in case of a problemnoresumenoresume2 and noresume if replacing swsusp is enabled.?
Architecture supporti386, ppc, x86_64, ia64i386, ppc, x86_64, ia64i386, ppc, x86_64, ia64
Max. Image size1/2 memorySee below1/2 memory
Highmem supportYes (up to 4GB)Yes (up to 4GB)Yes (up to 4GB)
Discontiguous memory supportYesYesYes
SMP supportYesYesYes
Preemption supportYesYesYes
CompressionNovia cryptoapi – LZF recommendedYes, with libraries
EncryptionNodirectly via cryptoapi,
or by writing to dm-crypt partition
With libraries
Suspend-to-swapfile supportNoYesYes?
Suspend-to-multiple swap partitions/filesNoYesNo
Suspend-to-file supportNoYesNo
Modular supportNoYes (post 2.2.9)No
Initrd support (needed for LVM/dm-crypt)YesYesRequired
UML supportNoNoNo
Suspend-over-NFS supportNoNo (also planned 😉No

Suspend2 saves the image in two parts. The first part consists of the page cache, and is generally 70%+ of the memory in use. Suspend2 saves this first, since it’s not needed while saving the remainder. It then makes an atomic copy of the remainder, using the pages previously saved, and stores the atomic copy. Working in this way, Suspend2 can normally save a full image of memory. Only if the page cache is smaller than 50% and there is no other free memory will Suspend2 be unable to save a full image of memory.