all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Vilata i Balaguer <ivan@selidor.net>
To: 59746@debbugs.gnu.org
Subject: [bug#59746] [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for hibernation, with an example.
Date: Thu, 1 Dec 2022 18:17:08 +0100	[thread overview]
Message-ID: <Y4jhfPnEfceDLD1/@sax> (raw)

[-- 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 --]

             reply	other threads:[~2022-12-01 17:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 17:17 Ivan Vilata i Balaguer [this message]
     [not found] ` <handler.59746.B.166991506631585.ack@debbugs.gnu.org>
2022-12-21 12:16   ` [bug#59746] [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for hibernation, with an example Ivan Vilata i Balaguer
2023-01-05 22:01     ` bug#59746: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4jhfPnEfceDLD1/@sax \
    --to=ivan@selidor.net \
    --cc=59746@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.