Ubuntu – Hibernation/swap partition

hibernatepartitioningswap

I'm trying to enable hibernation on my laptop, a Dell XPS-13 (with a 256 GB SSD mounted as an encrypted volume).

I was following the official documentation here and I attempted the "hibernation test" by executing sudo pm-hibernate from a command prompt. Needless to say it failed, in the sense that the screen went dark for a few seconds and then everything resumed as-was. The documentation mentioned checking whether the swap partition in "at least as large as available RAM" (in my case, 8 GB).

So I typed df and this is what I saw (I've made extensive use of tmps in my /etc/fstab to avoid needless grind on the SSD):

user@host:~$ df
Filesystem                  1K-blocks     Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-root 237978256 14144120 211722472   7% /
none                                4        0         4   0% /sys/fs/cgroup
udev                          3829132        4   3829128   1% /dev
tmpfs                         3844736     2060   3842676   1% /tmp
tmpfs                          768948     1324    767624   1% /run
none                             5120        0      5120   0% /run/lock
none                          3844736    32312   3812424   1% /run/shm
none                           102400       28    102372   1% /run/user    
tmpfs                         3844736        0   3844736   0% /var/spool
tmpfs                         3844736       24   3844712   1% /var/tmp
tmpfs                         3844736      936   3843800   1% /var/log
/dev/sda1                      240972    84550    143981  37% /boot
/home/user/.Private        237978256 14144120 211722472   7%  /home/user
user@host:~$ 

Am I right in my diagnosis that I have no swap partition at all??

(I have vm.swappiness set to 0, if I remember correctly, in case that's relevant in any way.)

If I'm right in my diagnosis, how do I go about creating one at this late moment in time?

Best Answer

Searching the internet helped me discover that sudo swapon -s will report whether a swapfile is active or not, and if so, where it is. It turns out that as I suspected I don't have one active, which is pretty surprising but explains a lot of things.

Now I will follow the procedure indicated here to enable one.