LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Hibernate (suspend to disk) breaks swap (http://www.linuxquestions.org/questions/linux-general-1/hibernate-suspend-to-disk-breaks-swap-625113/)

alienDog 03-02-2008 06:56 AM

Hibernate (suspend to disk) breaks swap
 
I've been trying to get hibernation to work on my ThinkPad R50. The machine seems to write the contents of the memory to the swap-partition and then power down exactly as it should, but when I switch the machine back on, it simply boots up again instead of resuming from the hibernation. The swap partition is trashed and I need to do mkswap /dev/[swap-partition] and then swapon -a to get it working again.

The machine has 512 MB of memory and the size of the swap if 1 GB.

dive 03-02-2008 08:11 AM

Do you pass 'resume = /dev/[swap]' to kernel in grub/lilo?

alienDog 03-04-2008 04:14 PM

Yep, there is:

append="resume2=swap:/dev/[swap] splash=silent quiet sysrq=1"

in lilo.conf

cgoetz 07-21-2008 02:32 AM

Working hibernation on Slackware 12.1
 
At first, I experienced also problems running s2disk (uwsusp) on Slackware 12.1 but looking further, I discovered that my swap device wasn't valid.

/etc/fstab
/dev/sda2 swap swap defaults 0 0
/dev/sda1 / reiserfs defaults 1 1
/dev/sda3 /mnt/sda3 reiserfs defaults 1 2
/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0
#/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0

This issue was fixed by running a check on the swap partition:
mkswap -c /dev/sda2

And hibernating to disk now works great !

Slackware is still there and remains worth-while

my s2disk script

#!/bin/bash
msd=$(cat /etc/suspend.conf |grep resume|sed -e "s/resume.*\/dev/\/dev/")
swt=$(swapon -s|grep $msd)
mrc="$?"
if [ "$swt" = "" ]; then {
echo -e "\nyour swap device seems to be incorrectlynot defined - please check /etc/fstab and /etc/suspend.conf !"
echo -e "you may try to fix this issue by running: mkswap -c $msd\n"
exit 0
}
fi
if [ "$mrc" = "0" ]; then {
echo -e "\nusing swap device $swt to suspend to disk ...\n"
echo " Going to suspend mode ... please wait."
echo "8" >/proc/sys/kernel/printk
echo "disk" >/sys/power/state
}
fi


-- cgoetz

alienDog 07-21-2008 09:25 AM

Still doesn't work for me. I think the problem is with lilo refusing to understand that the machine has to be resumed. Suspending seems to work fine.

--edit--

Oh god... all this time and the only problem was that there must not be the swap: in append string XD

It works if you put:

append="resume=/dev/[swap] splash=silent quiet sysrq=1"

in lilo.conf and run lilo


All times are GMT -5. The time now is 02:49 AM.