(address . guix-patches@gnu.org)
* doc/guix.texi (Swap Space): Add a concise introduction to hibernation and
specifying a swap space to the kernel to make resume work. Mention space
requirements and the need of an offset for swap files (missing info on how to
obtain it, but at least hint on the needed kernel argument). Include a
trivial example on how to set up swap space for hibernation.
---
doc/guix.texi | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Toggle diff (59 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 47b805dc7f..76441fd4db 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -109,6 +109,7 @@
Copyright @copyright{} 2022 Simon Streit@*
Copyright @copyright{} 2022 (@*
Copyright @copyright{} 2022 John Kehayias@*
+Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -17072,6 +17073,14 @@ Swap Space
allocated at disk formatting time (logical volumes notwithstanding),
whereas files can be allocated and deallocated at any time.
+Also, a swap space is required in order to hibernate (suspend to disk) a
+system using the Linux kernel. The kernel needs to know about the swap
+space to be used to resume from hibernation on boot (via a kernel
+argument). When using a swap file, its offset in the device holding it
+also needs to be given to the kernel, but that value has to be updated
+if the file is recreated. Hibernation uses at most half the size of the
+RAM in the configured swap space.
+
Note that swap space is not zeroed on shutdown, so sensitive data (such
as passwords) may linger on it if it was paged out. As such, you should
consider having your swap reside on an encrypted device (@pxref{Mapped
@@ -17157,6 +17166,23 @@ Swap Space
file system mounted at @file{/btrfs}. Note how we use Guile's filter to
select the file system in an elegant fashion!
+@lisp
+(swap-devices
+ (list (swap-space
+ (target "/dev/mapper/my-swap")
+ (dependencies mapped-devices))))
+
+(kernel-arguments
+ (cons* "resume=/dev/mapper/my-swap"
+ %default-kernel-arguments))
+@end lisp
+
+Use the mapped device @file{/dev/mapper/my-swap} as swap space, and tell
+the kernel to use it for hibernation via the @code{resume} kernel
+argument (@pxref{operating-system Reference}, @code{kernel-arguments}).
+If a swap file was used, the @code{resume_offset} argument would also be
+needed.
+
@node User Accounts
@section User Accounts
base-commit: 5e03354ef535ab1e548f444ac0af0b645a4081de
--
2.38.1
--
Ivan Vilata i Balaguer -- https://elvil.net/
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEHpvwBPZcchIQr6TuPezBBfXdI4IFAmOI4ZQACgkQPezBBfXd
I4KS8g/8CSssMtgQMHMBb5ifmXY2Taw4/wfcKpz3CBWtv3mViqtA16J274CYMFfh
hpN7oh3Edqed9ZxlLE2K0H1+cZbFBNTYV5P0x0n5ZcsbA6tOsBI+XtN08Srl2SNs
BpEN8mcdRXqjpmAKLC4NFQDNUA85Ag24ltrNYiqnFzqGZvIRAHC0zorPj7VOTF9n
vOcJ8ijvQm6LCFALATuGzSWBmijVJEYxK0af6K5pw81YoJUdXmwLWT2Wpuoo1o5+
aEaEhkE6pjy/kHMxvhYktos+G9MPFdpgYTaXfjTgqpgg7xXE2w5v4CaGBwJUq+iF
8us8JxEJGOoIFuBtuWRQCZqE4FoD7v9KZgVEcQQD9cMwd3Lq+s7Xkru95SOgv7nR
MoA/DbDN7tI6s0pnOFgf3Lekzo1wafunkxPhL0V0PCeOBrmk8VzKTBH5xgigcQ6P
aiHys12jZDlAlh8kkV6qSFnDzS5ykt4WIBdKrEJXFj93eu/UCig3BWrurK5Du88q
V+cEDbKHtShyqgVVlZ0GwZ8gMbFYFCG1pCwtGeAO2Df/M6WLDGdBQGwCiusOFO2j
59J0PkWw/9NNoNUcgp3DeJCifFD/qBMm5A8x6kzvQrR+P+hRI6DqUkNqxSof34dG
HsWOMHkg18V/rd9Rwl07Jc/dua8lyyJP6MdUwV6Xd4Kdr3D7QDI=
=TfGp
-----END PGP SIGNATURE-----