Last active 1 day ago

suspend-then-hibernate.sh Raw
1#!/bin/bash
2### FROM BOOT DISK
3# remove cryptswap entry
4vi /etc/crypttab
5
6# remove swap from fstab
7vi /etc/fstab
8
9# reboot into firmware, select one time boot and choose USB live installer
10systemctl reboot --firmware
11
12### BOOT FROM USB LIVE INSTALLER POP!_OS
13# using gParted or GNOME Disks, remove your previous swap partition
14
15# using gParted or GNOME Disks, create a new swap partition at the end of your disk that is your total RAM + 2GB
16# I have 32GB of RAM, I created a 35GB swap partition
17
18# reboot back to boot disk
19systemctl reboot
20
21### FROM BOOT DISK
22# add swap partition to fstab >> '/dev/nvme0n1p4 swap swap defaults 0 0'
23vi /etc/fstab
24
25# enable swap
26swapon --all --verbose
27
28# add boot option for kernel to know where hibernation needs to be resumed from.
29blkid | grep swap
30kernelstub -a 'resume=UUID=f44f6cb9-8bab-4ab8-99fb-c409ad6e9668'
31
32# enable a suspend then hibernate, defaults to two hours of suspend2ram followed by a hibernation
33ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /etc/systemd/system/systemd-suspend.service