unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#59746] [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for hibernation, with an example.
@ 2022-12-01 17:17 Ivan Vilata i Balaguer
       [not found] ` <handler.59746.B.166991506631585.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Vilata i Balaguer @ 2022-12-01 17:17 UTC (permalink / raw)
  To: 59746

[-- Attachment #1: Type: text/plain, Size: 2694 bytes --]

* 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(+)

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/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-05 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 17:17 [bug#59746] [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for hibernation, with an example Ivan Vilata i Balaguer
     [not found] ` <handler.59746.B.166991506631585.ack@debbugs.gnu.org>
2022-12-21 12:16   ` Ivan Vilata i Balaguer
2023-01-05 22:01     ` bug#59746: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).