guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#59746] [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for


From: Ivan Vilata i Balaguer
Subject: [bug#59746] [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for hibernation, with an example.
Date: Thu, 1 Dec 2022 18:17:08 +0100

* 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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]