Hibernate your Ubuntu
Hibernating didn’t work on my laptop. Ubuntu said there was not enough swap space. Well, it was true, I only made a 1 GB swap partition while my laptop had 3 GB RAM.
I had an ext3 partition which was not completely full, there was 4 GB free space on it. First I made a backup of this partition to an external HDD. Then I resized this partition with gparted, cutting off 3.3 GB at the end of the partition. My laptop has 3 GB RAM so I made a swap partition that is a bit larger (just to be sure).
After that, following this SwapFaq guide, I could tell Ubuntu to use this new swap partition for hibernating.
Note that hibernating doesn’t work with swap files. You need a swap partition for that.
“The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible. swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache. The default setting in Ubuntu is swappiness=60.” (source)
Current swappinness value:
How to change the swappinness value:
sudo vi /etc/sysctl.conf
Then change this line (or add it to the end of the file if it doesn’t exist):
Save file and reboot.
Hibernate from command-line
I added a launcher to my Desktop with the command “