2

Trying to enable hibernation on my laptop.

  1. There is only one single partition
  2. Swap memory seems to be much lower than the actual need based on RAM.
  3. Failed to increase swap space.
  4. ubuntu release 18.04.

What is the way out?

Some queries thatcan help you guys to help me.

$ free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        2.2G         11G        339M        2.0G         12G
Swap:          2.0G          0B        2.0G

The next was

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  1.8M  1.6G   1% /run
/dev/sda1       234G   19G  204G   9% /
tmpfs           7.8G   17M  7.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/loop0      141M  141M     0 100% /snap/gnome-3-26-1604/59
/dev/loop1       22M   22M     0 100% /snap/gnome-logs/31
/dev/loop2       13M   13M     0 100% /snap/gnome-characters/96
/dev/loop3      1.7M  1.7M     0 100% /snap/gnome-calculator/154
/dev/loop4       87M   87M     0 100% /snap/core/4650
/dev/loop6       21M   21M     0 100% /snap/gnome-logs/25
/dev/loop5      2.4M  2.4M     0 100% /snap/gnome-calculator/167
/dev/loop8      198M  198M     0 100% /snap/polarr/3
/dev/loop7      3.8M  3.8M     0 100% /snap/gnome-system-monitor/41
/dev/loop9       13M   13M     0 100% /snap/gnome-characters/86
/dev/loop10      13M   13M     0 100% /snap/gnome-characters/69
/dev/loop11     140M  140M     0 100% /snap/gnome-3-26-1604/64
/dev/loop12      79M   79M     0 100% /snap/vscode/37
/dev/loop14      15M   15M     0 100% /snap/gnome-logs/34
/dev/loop13      87M   87M     0 100% /snap/core/4486
/dev/loop15     3.4M  3.4M     0 100% /snap/gnome-system-monitor/36
/dev/loop16     2.4M  2.4M     0 100% /snap/gnome-calculator/170
/dev/loop17     3.8M  3.8M     0 100% /snap/gnome-system-monitor/39
tmpfs           1.6G   32K  1.6G   1% /run/user/1000

Now when I run

sudo fallocate -l 1G /swapfile

It given the error like so:

fallocate: fallocate failed: Text file busy

I was able to remove this by adding the command sudo swap-off

now a little more google search has led me to the following issues. 1) I tried to hibernate but the computer goes off and restarts immmediately without shutting down. Its like the monitor blinks off and beeps and comes back to life. 2) I read that SSD drive should not be used for Swap memory. It lowers the life of SSD drives.

  • 2
    Try to run sudo swapoff before increasing the swap size. – Pilot6 Jun 10 '18 at 16:01
  • 1
    Yup It did work. Thanks. and a lot of commands after that worked too... But suddenly little more google has got me to this link where it writes swap should not be used for SSD drives only the spinning drives. So then what is the way to enable hibernation on the computers with ssd drives :( – Nishant Sah Jun 10 '18 at 16:09
  • You can use swap on SSD. I do. – Pilot6 Jun 10 '18 at 16:10
  • okie. thanks I was reading some pages. It is so difficult to make an opinion with so many different views everywhere... – Nishant Sah Jun 10 '18 at 16:14
  • You can use swap on SSD drives. Just especially older SSDs would quickly wear out if you write to them often, and swapping generates many write operations especially on systems with few RAM. You have quite much RAM and therefore swap is unlikely to be used often (except once per hibernation then, of course) and if your SSD is rather modern, it also won't be that sensitive. However, I am not sure how well hibernating to a swap file works nowadays. In the not so far past, only hibernation to swap partitions was supported. – Byte Commander Jun 10 '18 at 16:14
6

You need to disable swap before you resize it. It can be done by

sudo swapoff

command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.