Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO for suspend to disk (hibernate) #4

Open
paigeadelethompson opened this issue Nov 27, 2024 · 1 comment
Open

TODO for suspend to disk (hibernate) #4

paigeadelethompson opened this issue Nov 27, 2024 · 1 comment

Comments

@paigeadelethompson
Copy link
Owner

It's necesarry to have a swapfile which apparently can all be done with just a swap file on BTRFS:

bash-5.2# cd /var/swap/
bash-5.2# lsattr 
---------------C------ ./swapfile
bash-5.2# 

However, it was not real obvious or easy to get this this to work correctly (you can only set NOCOW on a zero-length file which means you must first touch swapfile then chattr +C swapfile AND then fallocate -l 4g /var/swap/swapfile to specify the physical extents of the swap file,

  • mkswap /var/swap/swapfile
  • swapon /var/swap/swapfile
  • in /etc/fstab you specify: /var/swap/swapfile none swap 0 0
  • you need to get a UUID: findmnt -no UUID -T /var/swap/swapfile and specify in /boot/cmdline.txt the resume argument: resume=UUID=c1f08e11-c1de-4477-92b3-b2ba17c6eec4 and evidently this works but it still needs to be tested with Void's zzz package and associated user hooks
@paigeadelethompson
Copy link
Owner Author

paigeadelethompson commented Nov 27, 2024

This should also be set to zero to prevent pages from actually getting swapped:

➜  ~ sudo sysctl -a | grep swap
vm.swappiness = 0
➜  ~ 

default for it is 60, anyway this will require ensuring sysctl -f /etc/sysctl.conf is run at boot unless it can be overridden in the kernel build.. but it should probably just stay sysctl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant