Hibernation using full disk encryption

From Tom's notes
Jump to navigation Jump to search

A simple example with just an encrypted swap partition, this could also be part of LVM if you're careful to run everything LVM related in read-only.

To Hibernate:

cryptsetup luksOpen /dev/<swap> crypt
swapon -a
s2disk -P encrypt=N --resume_device=/dev/mapper/crypt

To resume: Make sure the initramfs has a /dev/snapshot. It can be created using

mknod /dev/snapshot c 10 231

If there's no snapshot device, resume will hang with message:

resume: libgcrypt version x.y.z

Open the encrypted swap and resume:

cryptsetup luksOpen /dev/<swap> crypt
resume --resume_device=/dev/mapper/crypt

On Gentoo these executables are installed using

emerge -v sys-power/suspend

The resume utility is automatically static-compiled.