Winston Hoy 已修改 4 years ago. 還原成這個修訂版本
1 file changed, 33 insertions
suspend-then-hibernate.sh(檔案已創建)
| @@ -0,0 +1,33 @@ | |||
| 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 | |
上一頁
下一頁