1

I am using ubuntu 20.04 on a machine with 16G RAM and 1T SSD. I used to have a swap partition of 20G and know how to hibernate with swap partition. But I found the partition never used in normal time. So I think it is unreasonable to preserve a swap only for hibernation and I deleted this partition and decided to hibernate with hibernation file. But I am stuck in doing this, even found some answer saying this is impossible. So is there any way to achieve hibernation without swap partition?

The following link would be helpful but I can not understand it fully, https://help.ubuntu.com/community/SwapFaq.

Simon
  • 419
  • 3
  • 13
  • 2
    If your "hibernate" wants to power off the memory, you'll have to use a swap file or swap partition, so the system can unhibernate from somewhere. – waltinator Jan 01 '21 at 04:10
  • 1
    You can use a swapfile, but method is a little different than with swap partition: https://askubuntu.com/questions/1290326/how-to-enable-hibernate-on-ubuntu-20-04-lts/1290338#1290338 – C.S.Cameron Jan 01 '21 at 04:31
  • @Simon: Your link does not mention the requirement for adding a `resume_offset` when hibernating from a swapfile. You cannot hibernate from a swapfile without it. – C.S.Cameron Jan 01 '21 at 07:43
  • 2
    Does this answer your question? [Hibernate and resume from a swap file](https://askubuntu.com/questions/6769/hibernate-and-resume-from-a-swap-file) – eddygeek Jun 01 '23 at 00:18

1 Answers1

1

For the FAQ you go down the the section "How do I add a swap file?". When you get the dd command need to multiply the count=# by 20 to get 20GiB of space initialized, so it would be 20971520. Once you have the swap file sorted out, you will need to edit the /etc/default/grub file to add resume=/mnt/20GiB.swap and resume_offset=file_offset. This thread has some good information and links: How to enable hibernate option in Ubuntu 20.04?

I hope this helps.