# Hibernating to disk with more ram than swap

## jabol

Hi,

I've got a strange problem. I had 3GB swap and 1GB ram for quite a time and hibernation to disk worked well. Now, I've got 3GB swap and 3,1 GB ram (4actually, but only 3,1 are seen). Now, is it possible to hibernate to disk in this configuration? Does Linux only save used pages/segments or all of them? And what will happen if all of my ramspace is used? And... what will happen if all ramspace and additionaly some swapspace is used when hibernating?

Btw. can I hibernate to disk using not-swap partition?

Thanks for any input

----------

## bob doe

As far as I know, hibernation saves your entire RAM, be it used or not.  You dont have to save it to the swap partition you can save it to a file on your partition.  Depends on your kernel config.

As for your system only seeing three gigs of ram, trying changing your kernel from 4gb to (I think) 64gb, or whatever the next highest is.

----------

## jabol

How do I specify hibernation to a file (I'm using normal suspend, not suspend2, and gnome-power-manager as interface)? As to the problem of 3gb instead of 4gb I believe it's a hardware issue (I've already set high_mem to 64gb and it didn't help). 64bit livecd alsa sees only 3 gb, so I think it just can't get any better.

Does the hibernate partition have to be a swap partition?

----------

## bob doe

As far as I know, if you want to use a partition, it has to be swap.  A file can be customized in kernel with tuxonice (formerly suspend2) but using another method, Im unsure.

----------

## jabol

Well, it has to be suspend2, then. That makes  it for me.

I believe I'd just swap my /usr/portage and swap partitions (/usr/portage happens to be just the right size - 4mb bigger than my ram actually:) ).

Thanks for answer.

----------

## Roman_Gruber

hi

tuxonice is the newer version  of suspend2-sources

I never got suspend to file working. I tried it for months regularly. I have given up.

Suspending to swap works very well. General rule is to have double amount of swap as ram.

so if you have 4 gb of ram, u should have 8 gb of swap.

i dont know the upper limit of swap space.

nowadays harddiscs are so big, that 8 gb of swap shouldnt be a problem. u are on the save way and u can hibernate always then.

----------

## Evincar

Actually, and much to my shock, tuxonice suspends to RAM flawlessly out of the box. 

By the way, it has a nice compression feature, so even with a 1:1 RAM to swap, you are surely fine.

----------

## jabol

my hdd is 80gb, and it's a laptop. so it's not that easy.

----------

## bob doe

Evincar, could you give us (me) more info on suspend to ram?  I've found a shockingly small amount of information on it.  Everything I read is about suspend to disk.

----------

## x22

Hibernation saves only used pages, not whole RAM. 

The maximum size of suspend-to-disk image can be configured (both standard swsups and tuxonice allow it). 

Of course, it is always needed to have enough space to store all non-cached which are in RAM at the time of suspending.

----------

## Evincar

 *bob doe wrote:*   

> Evincar, could you give us (me) more info on suspend to ram?  I've found a shockingly small amount of information on it.  Everything I read is about suspend to disk.

 

Honestly, not a lot. I never had it working and when upgrading to tuxonice sources 2.6.24-r3 it "just worked", much to my shock. In case it is of any help, here you have the relevant section of .config, and the hibernate-ram.conf

```
# Power management options

#

CONFIG_PM=y

# CONFIG_PM_LEGACY is not set

# CONFIG_PM_DEBUG is not set

CONFIG_PM_SLEEP_SMP=y

CONFIG_PM_SLEEP=y

CONFIG_SUSPEND_SMP_POSSIBLE=y

CONFIG_SUSPEND=y

CONFIG_HIBERNATION_SMP_POSSIBLE=y

CONFIG_HIBERNATION=y

CONFIG_PM_STD_PARTITION="/dev/sda2"

CONFIG_TOI_CORE=y

#

# Image Storage (you need at least one allocator)

#

# CONFIG_TOI_FILE is not set

CONFIG_TOI_SWAP=y

#

# General Options

#

CONFIG_TOI_DEFAULT_PRE_HIBERNATE=""

CONFIG_TOI_DEFAULT_POST_HIBERNATE=""

CONFIG_TOI_CRYPTO=y

CONFIG_TOI_USERUI=y

CONFIG_TOI_USERUI_DEFAULT_PATH="/usr/local/sbin/tuxonice_fbsplash"

# CONFIG_TOI_KEEP_IMAGE is not set

CONFIG_TOI_REPLACE_SWSUSP=y

# CONFIG_TOI_CLUSTER is not set

CONFIG_TOI_CHECKSUM=y

CONFIG_TOI_DEFAULT_WAIT=25

# CONFIG_TOI_PAGEFLAGS_TEST is not set

CONFIG_TOI=y

CONFIG_ACPI=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_PROCFS=y

CONFIG_ACPI_PROCFS_POWER=y

CONFIG_ACPI_SYSFS_POWER=y

CONFIG_ACPI_PROC_EVENT=y

CONFIG_ACPI_AC=y

CONFIG_ACPI_BATTERY=y

CONFIG_ACPI_BUTTON=y

CONFIG_ACPI_FAN=y

# CONFIG_ACPI_DOCK is not set

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_HOTPLUG_CPU=y

CONFIG_ACPI_THERMAL=y

# CONFIG_ACPI_ASUS is not set

# CONFIG_ACPI_TOSHIBA is not set

# CONFIG_ACPI_CUSTOM_DSDT is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_SYSTEM=y

CONFIG_X86_PM_TIMER=y

CONFIG_ACPI_CONTAINER=y

# CONFIG_ACPI_SBS is not set

# CONFIG_APM is not set

```

```
# This file is used when suspending to RAM. Use the *-ram.conf files to add

# configuration options, or add them before the TryMethod lines in this file.

# Options are not case-sensitive.

# 

# See hibernate.conf(5) for help on the configuration items.

# save to both, RAM and disk

# (disabled by default, since it takes longer)

# TryMethod ususpend-both.conf

TryMethod ususpend-ram.conf

TryMethod sysfs-ram.conf

# The following vbetool settings help with a number of laptops

# EnableVbetool yes

# VbetoolPost yes

# Users with a Radeon graphics card may need to enable this line for

# suspend-to-ram, and install the radeontool program available from

# http://fdd.com/software/radeon/ or your distribution's package.

# 

 RadeonTool yes

# The following is needed for most old BIOS laptops

 AcpiVideoS3Bios yes

 AcpiVideoS3Mode yes
```

FWIW, I also have : "acpi_sleep=s3_bios,s3mode" in my kernel boot line.

----------

