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