How to enable hibernate on ubuntu 20.04 LTS [duplicate]
How can I enable hibernate on fresh installed system if it's possible.
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=c14a936e-6c0f-4228-beec-c39bc515b157 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=1036-AA2D /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0I tried In /ect/default/grub - GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=c14a936e-6c0f-4228-beec-c39bc515b157", but this is not working. Thanks.
111 Answer
To enable Hibernation in 20.04:
Increase swapfile size to match RAM size up to 8GB.
Check the swap that is in use:
sudo swapon -sIf swap partition(s) are found:
sudo swapoff -a sudo nano -Bw /etc/fstabAdd
#before theUUIDof the swap partition(s):# UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none swap sw 0 0Add a line for the
swapfile, if one does not exist:swapfile none swap sw 0 0Create the
swapfile:sudo fallocate -l XG /swapfile*where
Xisswapfile's size in GB:sudo mkswap /swapfile sudo chmod 0600 /swapfile sudo swapon /swapfileReboot:
sudo reboot
Add resume location and offset to grub.cfg:
Edit
/etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX resume_offset=XXXXX"Use
UUIDfrom root.Use offset from:
sudo filefrag -v /swapfile |grep " 0:"| awk '{print $4}'Update GRUB:
sudo update-grubTest hibernation:
sudo systemctl hibernate
A hibernate button can be added using GNOME extensions.
Note that there is a slight possibility of getting holes in a swapfile when creating it with fallocate. /var/log/syslog can be searched for the phrase swapon: swapfile has holes to ensure there will be no data loss.
A swap file can alternatively be created using dd:
sudo dd if=/dev/zero of=/swapfile bs=1G count=8An error when using dd may overwrite your HDD.