Enabling Suspend Disk (Hibernation) on Fedora Desktop Systems with Full Disk Encryption
Hibernation, also known as suspend disk, is a power-saving state that allows a computer to save its current state to disk and then turn off the power completely. When the computer is turned back on, it resumes its previous state as if it had never been turned off. This feature is particularly useful for laptops, as it allows users to conserve battery life without losing their work.
Prerequisites
Before you can enable hibernation on a Fedora desktop system with full disk encryption, you need to ensure that your system meets the following requirements:
- Your computer must support hibernation.
- Your system must have enough free disk space to save the current state of your system to disk.
- Your system must be configured with full disk encryption.
Checking if Your Computer Supports Hibernation
To check if your computer supports hibernation, you can run the following command:
# cat /sys/power/state
If the output of this command includes the word disk, then your computer supports hibernation.
Checking if You Have Enough Free Disk Space
To check if you have enough free disk space to save the current state of your system to disk, you can run the following command:
# swapon --show
This command will display the amount of swap space that is currently available on your system. If the amount of swap space is less than the amount of RAM that your system has, then you may not have enough free disk space to save the current state of your system to disk.
Checking if Your System is Configured with Full Disk Encryption
To check if your system is configured with full disk encryption, you can run the following command:
# lsblk -f
If the root filesystem (/) is encrypted, then your system is configured with full disk encryption.
Enabling Hibernation
To enable hibernation on a Fedora desktop system with full disk encryption, you need to perform the following steps:
- Create a swap file that is at least as large as the amount of RAM that your system has. For example, if your system has 8 GB of RAM, then you need to create a swap file that is at least 8 GB in size. You can create a swap file by running the following command:
# fallocate -l 8G /swapfile
- Format the swap file as a swap device. You can format the swap file as a swap device by running the following command:
# mkswap /swapfile
- Add the swap file to the list of swap devices. You can add the swap file to the list of swap devices by running the following command:
# swapon /swapfile
- Edit the
/etc/default/grubfile to include theresumeparameter. Theresumeparameter specifies the device that the system should use to resume from hibernation. You can edit the/etc/default/grubfile by running the following command:
# vi /etc/default/grub
Add the following line to the GRUB_CMDLINE_LINUX parameter:
resume=UUID=
Replace with the UUID of the swap device. You can find the UUID of the swap device by running the following command:
# blkid | grep swapfile
- Update the GRUB bootloader. You can update the GRUB bootloader by running the following command:
# grub2-mkconfig -o /boot/grub2/grub.cfg
- Reboot your system. After you have completed the previous steps, you can reboot your system to enable hibernation. To reboot your system, run the following command:
# reboot
Resuming from Hibernation
To resume from hibernation, simply press the power button on your computer. Your system will resume from the saved state as if it had never been turned off.
In this article, we have covered the steps that are necessary to enable hibernation on a Fedora desktop system with full disk encryption. We have also discussed how to check if your computer supports hibernation, how to check if you have enough free disk space, and how to check if your system is configured with full disk encryption. Finally, we have provided step-by-step instructions for enabling hibernation and resuming from hibernation.
References
- Fedora Project. (2022). Hibernation. Retrieved from https://docs.fedoraproject.org/en-US/quick-docs/hibernation/
- Red Hat, Inc. (2021). Configuring Hibernation. Retrieved from https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/configuring-hibernation_configuring-basic-system-settings
- Arch Linux. (2022). Hibernation. Retrieved from https://wiki.archlinux.org/title/Hibernation