Hibernate or suspend to disk in computing can be known as powering down computer and retaining its state. In the hibernate state, the operating system save the contents of RAM into a hard disk or non-volatile things then power down the machine.
Sometimes when we seriously working on something suddenly a serious things occurs (like have to move to another place, need to do something important, etc.). Of course in this moment we doesn’t want to lose what we have done and have to keep our working state. When this things happen, we can use the hibernate function to retain our works which is still in RAM into a hard disk. After the serious things is finished we can get back to work and all the conditions of the computer will return exactly at the point of the hibernation.
To be able the hibernate function worked, you must have swap partition and is enabled. The swap partition is created when you asked to create partitions during the installation process of Fedora/Korora. The common way to determine how many partitions you need is by make 3 separate partitions. One is for / (root), the second partition is /home for your home directory and the last partition is /swap. The size of each partition is depends on what you want to do with your system. Normally, the / (root) partition can be in size of 40 GB which is more than enough, the /swap partition is 2 times of your RAM size, and the rest is for your /home partition.
Why only 3? In my opinion the answer is simple.
The / (root) partition is the place for all program and system configuration including the library files that needed by the system and applications that come with Fedora/Korora. The /home partition is a place for your home directory and your data including some application or specific desktop configuration files. The /swap partition is a place for swapping process or moving some application that runs in the memory into the swap partition to make more space in the memory when a new application is run and need more memory space.
By using 3 separate partition, when you want to use another Linux distribution or re-install the Fedora/Korora Linux because of something is happen and you doesn’t want to lose your data files, you only need to wipe and then install your Linux in the / (root) partition, so your data files is safe. That’s it.
To make the hibernate function run, make sure your swap partition is enabled in /etc/fstab (see the image below).
Then open your grub configuration file and add ‘resume=/dev/disk/by-uuid/3feee6f0-53bb-4f54-abf8-f09e3bce7a96‘ or if you remember where the swap partition is mounted you can use it like this ‘resume=/dev/sda3‘ (in my computer, the swap partition is mounted on /dev/sda3) in the GRUB_CMDLINE_LINUX options after or before the rhgb quiet value (see the image below). To make modify the grub configuration easy, use the grub-customizer applications. If you don’t have it, install it from the fedora repository by execute ‘sudo dnf install -y grub-customizer‘.
Don’t forget to save the changes you made and rebuild the grub again with command, grub2-mkconfig -o /boot/grub2/grub.cfg. If you use grub-customizer application, the rebuild process is done automatically with the save process. Then after rebooting your computer, you will have the hibernate button functioning or if you want to test the hibernate function, just execute this command in the terminal ‘systemctl hibernate‘ as root user or using sudo.