User Tools

Site Tools


hibernate_from_a_non_activate_swapfile_from_btrfs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
hibernate_from_a_non_activate_swapfile_from_btrfs [2020/12/16 10:19] memeruizhibernate_from_a_non_activate_swapfile_from_btrfs [2020/12/17 13:02] memeruiz
Line 1: Line 1:
 ====== Hibernate from a non activate swapfile from btrfs ====== ====== Hibernate from a non activate swapfile from btrfs ======
 +
 +*** Important! *** This didn't work! It is not secure! When wiping happens, the file gets moved to another place by btrfs, then, this doesn't work for two reasons: 1) Wiping happens in other parts of the disk, and the offset changes and has to be updated in all configurations files after wiping everytime.
 +
 +* This was just a stupid experiment.
  
 ===== Create swapfile ===== ===== Create swapfile =====
Line 65: Line 69:
   * Modify /etc/default/grub with the corresponding resume and offset values:   * Modify /etc/default/grub with the corresponding resume and offset values:
  
-  GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=8f9ede3a-912f-40d6-9335-90ed3186e3e48f9ede3a-912f-40d6-9335-90ed3186e3e4 resume_offset=1121793 quiet btusb.enable_autosuspend=n"+  GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=8f9ede3a-912f-40d6-9335-90ed3186e3e4 resume_offset=1121793 quiet btusb.enable_autosuspend=n"
  
   * Activate the swap file   * Activate the swap file
Line 112: Line 116:
   echo "Hibernating"   echo "Hibernating"
   sleep 0.2   sleep 0.2
 +  xtrlock -b &
   sudo s2disk   sudo s2disk
   echo "Returning from Hibernate"   echo "Returning from Hibernate"
Line 119: Line 124:
   sleep 5   sleep 5
   echo "Wiping swapfile"   echo "Wiping swapfile"
-  sudo wipe -f -q -Q 1 /swap/swapfile+  #sudo wipe -k -f -q -Q 1 /swap/swapfile 
 +  sudo dd if=/dev/zero of=/swap/swapfile bs=1M count=24576 status=progress #reserve 24GB
   sync   sync
   sleep 1   sleep 1
Line 125: Line 131:
   sudo mkswap /swap/swapfile   sudo mkswap /swap/swapfile
   echo "All done, ready to hiberante again"   echo "All done, ready to hiberante again"
 +
 +===== References =====
 +
 +
 +https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file_on_Btrfs
 +
 +https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file
 +
 +https://wiki.archlinux.org/index.php/Swap#Swap_file_creationhttps://wiki.archlinux.org/index.php/Swap#Swap_file_creation
 +
 +https://askubuntu.com/questions/6769/hibernate-and-resume-from-a-swap-file
 +
 +https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition
 +
 +https://wiki.debian.org/Hibernation
 +
 +https://unix.stackexchange.com/questions/521686/using-swapfile-for-hibernation-with-btrfs-and-kernel-5-0-16-gentoohttps://unix.stackexchange.com/questions/521686/using-swapfile-for-hibernation-with-btrfs-and-kernel-5-0-16-gentoo
 +
 +
  
  
hibernate_from_a_non_activate_swapfile_from_btrfs.txt · Last modified: 2021/02/01 05:55 by 127.0.0.1