TOOL » LINUX » MANAGER
Power
Suspend to disk
The configuration is a two step process:
- Configure kernel parameters
- Configure initramfs
Configure kernel parameters
On SWAP partition
Get the UUID of the SWAP device:
shell
sudo blkidEdit the file /etc/default/grub by adding the following values to GRUB_CMDLINE_LINUX_DEFAULT (replace swap_device):
ini
resume=UUID=swap_deviceApply the changes with:
shell
grub-mkconfig -o /boot/grub/grub.cfgOn SWAP file
Consider a swap file at /swapfile. Get swap_device and swap_file_offset by running:
shell
findmnt -no UUID -T /swapfile
filefrag -v /swapfile | awk '{ if($1=="0:"){print substr($4, 1, length($4)-2)} }'Edit the file /etc/default/grub by adding the following values to GRUB_CMDLINE_LINUX_DEFAULT:
ini
resume=UUID=swap_device resume_offset=swap_file_offsetApply the changes with:
shell
grub-mkconfig -o /boot/grub/grub.cfgConfigure initramfs
Edit the file /etc/mkinitcpio.conf by adding resume to HOOKS as follows:
ini
HOOKS=(base udev autodetect modconf block filesystems keyboard resume fsck)Regenerate the initramfs:
shell
mkinitcpio -P