Benutzer-Werkzeuge

Webseiten-Werkzeuge


btrfs

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
btrfs [2016-04-12 22:50:02] – angelegt - Externe Bearbeitung 127.0.0.1btrfs [2024-07-13 03:28:41] (aktuell) – [Swap & Hibernate auf btrfs] david
Zeile 313: Zeile 313:
   - [[http://kofler.info/blog]]   - [[http://kofler.info/blog]]
   - [[http://www.pro-linux.de/]]   - [[http://www.pro-linux.de/]]
 +
 +
 +===== Swap & Hibernate auf btrfs =====
 +
 +Swap:
 +  * [[https://btrfs.readthedocs.io/en/latest/Swapfile.html]]
 +  * [[https://jwillikers.com/btrfs-swapfile]]
 +  * [[https://forums.fedoraforum.org/showthread.php?331916]]
 +
 +Sleep States:
 +  * [[https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate]]
 +  * [[https://wiki.debian.org/Suspend]]
 +  * [[https://wiki.debian.org/Hibernation]]
 +  * [[https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition]]
 +  * [[https://en.wikipedia.org/wiki/ACPI#Power_states]]
 +  * [[https://docs.kernel.org/admin-guide/pm/sleep-states.html]]
 +
 +Wenn der kernel im lockdown ist (z.B. secure boot), kann hibernate nicht genutzt werden:
 +  * [[https://wiki.debian.org/SecureBoot#Secure_Boot_limitations]]
 +  * [[https://lkml.iu.edu/hypermail/linux/kernel/1804.0/01607.html]]
 +
 +Getestet auf debian testing 13 (trixie).
 +
 +Empfehlung: nicht als skript, sondern interaktiv schritt für schritt ausführen!
 +
 +<code bash>
 +#!/usr/bin/env bash
 +
 +set -o errexit
 +set -o nounset
 +set -o pipefail
 +shopt -s inherit_errexit
 +
 +BTRFS_ROOT="/mnt/btrfs"
 +SUBVOL_SWAP="@swap"
 +SWAP="/swap"
 +
 +PARTUUID="$(findmnt / -no PARTUUID)"
 +# 736a6f95-a7ac-410f-8065-65e629101f86
 +
 +mkdir -p "${BTRFS_ROOT}"
 +mount -o subvolid=5 "/dev/disk/by-partuuid/${PARTUUID}" "${BTRFS_ROOT}"
 +btrfs subvolume create "${BTRFS_ROOT}/${SUBVOL_SWAP}"
 +chattr +C "${BTRFS_ROOT}/${SUBVOL_SWAP}"
 +chmod 700 "${BTRFS_ROOT}/${SUBVOL_SWAP}"
 +umount "${BTRFS_ROOT}"
 +
 +btrfs subvolume list /
 +
 +RAM_KIB="$(free -k --si | awk 'NR == 2 { print $2 }')"
 +
 +mkdir -p "${SWAP}"
 +chmod 700 "${SWAP}"
 +mount -o nodatacow,subvol="${SUBVOL_SWAP}" "/dev/disk/by-partuuid/${PARTUUID}" "${SWAP}"
 +btrfs filesystem mkswapfile -s "${RAM_KIB}k" "${SWAP}/swapfile"
 +chmod 600 "${SWAP}/swapfile"
 +
 +OFFSET="$(btrfs inspect-internal map-swapfile -r /swap/swapfile)"
 +# 6619444
 +
 +echo "PARTUUID=${PARTUUID} /swap btrfs defaults,nodatacow,subvol=@swap 0 0" | sudo tee -a /etc/fstab
 +echo "/swap/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab
 +
 +cat /etc/fstab
 +# PARTUUID=736a6f95-a7ac-410f-8065-65e629101f86 /swap btrfs defaults,subvol=@swap 0 0
 +# /swap/swapfile none swap defaults 0 0
 +
 +systemctl daemon-reload
 +swapon -a
 +swapon --show
 +
 +# add the following to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub
 +echo "resume=PARTUUID=${PARTUUID} resume_offset=${OFFSET}"
 +
 +cat /etc/default/grub
 +# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=PARTUUID=736a6f95-a7ac-410f-8065-65e629101f86 resume_offset=6619444"
 +
 +echo "RESUME=PARTUUID=${PARTUUID} resume_offset=${OFFSET}" | sudo tee /etc/initramfs-tools/conf.d/resume
 +
 +grub-mkconfig
 +update-initramfs -k all -u
 +
 +echo "vm.swappiness = 10" | tee /etc/sysctl.d/99-swappiness.conf
 +
 +reboot
 +</code>
 +
 +Folgende systemd services im nachhinein mit ''systemctl status'' untersuchen (siehe auch ''man systemd.special''):
 +  * ''swap.target''
 +  * ''sleep.target''
 +  * ''suspend.target''
 +  * ''hibernate.target''
 +  * ''suspend-then-hibernate.target''
 +  * ''hybrid-sleep.target''
  
  
/home/http/wiki/data/attic/btrfs.1460501402.txt · Zuletzt geändert: von 127.0.0.1