← Back to team overview

sony-vaio-z-series team mailing list archive

Suspend to ram and disk (Quick how to)

 

Hello guys, 

I have seen quite  a lot of people that can't get suspend to ram and disk to work. For myself it was working out of the box with kpowersave as I'm a KDE user however, for those using another wm here is a quick how to that I found there http://www.claudiocamacho.org/tech/sr11m_debian.php Lots of helpful information concerning the SR which is very similar with the Z.

Here is what you have to try:

Suspend to RAM

Suspend to RAM works out of the box, both from the console and from the X-Window system. In order to put the computer to sleep, we need the following options in the kernel:

CONFIG_PM=y
CONFIG_SUSPEND=y
CONFIG_ACPI=y
CONFIG_ACPI_SYSFS=y
CONFIG_ACPI_PROC_EVENT=y
CONFIG_ACPI_BUTTON=y

After setting these options and booting the new kernel, it is possible to perform the following operation to sleep the computer:
~$ sudo echo "mem" > /sys/power/state

However, you probably want to automatize your SR11M so that it goes to sleep when the LID is closed. Therefore, you have to do the following: first, install the acpid package; then, create the file /etc/acpi/events/lid and put the following contents:
event=button/lid.*
action=/etc/acpi/actions/lid.sh "%e"

Now we will create the file /etc/acpi/actions/lid.sh and we will give execution rights to it: sudo chmod +x /etc/acpi/actions/lid.sh. The, you may do whatever you want in your script, but this is my simple example:
#!/bin/sh

# Easy way to send the laptop to sleep
echo "mem" > /sys/power/state

Please notice that you may perform any operation when the LID is closed, but for this article, it is enough to send "mem" to /sys/power/state, in order to put the laptop in sleep mode.


Suspend to Disk

Suspend to disk also works out of the box. When putting the laptop into suspend to disk mode, you will need as much swap as RAM memory, since the whole memory is written as an image in the swap partition. For instance, I have 4GB of RAM, so I created a swap partition with 4GB, so that the suspend to disk can be performed properly. In the kernel, you will need the following options:

CONFIG_PM=y
CONFIG_HIBERNATION=y 
CONFIG_PM_STD_PARTITION=/dev/sda2

/dev/sda2 should be changed by the device of your swap partition. Also, in the kernel, at boot time, an option must be passed so that the kernel resumes from the swap, instead of booting a fresh system. The option is the following: resume=/dev/sda2, where sda2 has to be changed for the name of your swap partition (the one you set up as the default one in the kernel configuration).

Finally, in order to suspend the whole system into the disk, you have to write the word "disk" into /sys/power/state. This operation will write the whole system in your swap partition and shut down the computer. The next time you boot, the system will appear as you left it the last time, including games, graphics, audio, network, etcetera. 

Hope it helps those that still can make work suspend to ram and disk...

++ Paps



Follow ups