This guide is based on the hibernate article from the Arch wiki.
- edit
/etc/default/grub
and addresume
as well asresume_offset
kernel parametersresume=UUID=abcd-efgh
contains the UUID of the partition on which the swapfile resides. In most cases theswapfile
resides inroot
, to identify theroot
parition's UUID runblkid
orlsblk -O
.resume_offset=1234
is the offset of the swapfile from the partition start. The offset is the first entry in thephysical_offset
column of the output offilefrag -v /swapfile
.- update grub:
grub-mkconfig -o /boot/grub/grub.cfg
- example:
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=75972c96-f909-4419-aba4-80c1b74bd605 resume_offset=1492992"
- add the
resume
module hook to/etc/mkinitcpio.conf
:HOOKS="base udev resume autodetect ...
- rebuild the initramfs
mkinitcpio -p linux
- check if everything works:
systemctl hibernate
how to enable it with a swap partition?