Enabling System Hibernate in Ubuntu
Introduction
Hubernation is a great tool you can use instead of turnin off your PC in order to speed up booting the computer next time you need it. The way it works is by writing all the RAM contents into your hard drive before sutting down. When the PC is started again, it reads those contents back and it likes you never left!
Setting Up SWAP
As your computer needs to wriite the contents of the RAM to you hard drive, you need to set up a specific place for this purpose. Although you can create a separate partition for it, it is far easier (and safer) to just create a special file for it. The size of this file must be at least as much as the amount of RAM you have on your system.
Here, you can change the name and location of the file /swapfile and its size. This example was for a 2 GB SWAP file (2 count of 1 GB segments) called /swapfile.
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
Finally, add this to your boot sequence by
and add the following line at the end as a separate line