Page 1 of 1

[SOLVED] How hibernate to file. Swap?

Posted: 08 Jun 2014, 18:58
by Slaxmax
How hibernate to file. Swap?

I have tried but did not work
example
mkfileswap /mnt/sda2/swapfile.swap 6000

and activate it through rc.local:
swapon /mnt/sda2/swapfile.swap

I run free -m
shows the swap but not hibernate

thanks

Re: How hibernate to file. Swap?

Posted: 09 Jun 2014, 09:21
by fanthom
in order to return from hibernation you have to add 'resume=/dev/sdXY' cheatcode where /dev/SDXY is your swap partition.
when you are using swap file then you have to find it's location and provide additional cheatcode: 'resume_offset='

please follow these docs for details:
http://ubuntuforums.org/showthread.php?t=1042946
https://wiki.archlinux.org/index.php/Su ... _swap_file

note: i havent try this myself.

Re: How hibernate to file. Swap?

Posted: 09 Jun 2014, 19:26
by Slaxmax
Thanks fanthom
Works fine now!

1 - Make .swap file
example swap file 6GB:
mkfileswap /mnt/sda2/.swapfile.swap 6000

2 - Activate .swap file in rc.local
add this line
swapon /mnt/sda2/.swapfile.swap

3 - run command (example)

Code: Select all

root@porteus:/home/guest# filefrag -v /mnt/sda2/.swapfile.swap 
Filesystem type is: ef53
File size of /mnt/sda2/.swapfile.swap is 6291456000 (487424 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..   32767:   10940416..  10973183:  32768:
take offset number 10940416 in line 0

4 - Change porteus.cfg
add cheatcode
resume=/dev/sda2 resume_offset=10940416
example my porteus.cfg

Code: Select all

LABEL kde
MENU LABEL Graphics mode (KDE4)
KERNEL vmlinuz
APPEND initrd=initrd.xz fsck changes=/porteus resume=/dev/sda2 resume_offset=10940416
TEXT HELP
    Run Porteus the best way we can.
    Try to autoconfigure graphics
    card and use the maximum
    allowed resolution
ENDTEXT
reboot and test

Works fine! :Yahoo!:

One more time thanks fanthom :good: