1

I am trying to increase the size of swap to get hibernation to working. I have followed the answer from another question but only achieved a partial success.

The volume is larger

# lsblk
...
nvme0n1               259:0    0 953.9G  0 disk  
├─nvme0n1p1           259:1    0   512M  0 part  /boot/efi
├─nvme0n1p2           259:2    0   1.7G  0 part  /boot
└─nvme0n1p3           259:3    0 951.7G  0 part  
  └─nvme0n1p3_crypt   253:0    0 951.7G  0 crypt 
    ├─vgubuntu-root   253:1    0 883.4G  0 lvm   /
    └─vgubuntu-swap_1 253:2    0    49G  0 lvm   [SWAP]

but the swap is not

# free -m
               total        used        free      shared  buff/cache   available
Mem:           31802        1831       27724         506        2247       29065
Swap:            975           0         975

while df shows something else still

# df -h /dev/mapper/vgubuntu-swap_1 
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev

I do not understand the disparity. How do I make swap match the volume size (ie. make it 48 or 49 GB)?

This is a fresh install of Ubuntu 22.04 with default encrypted LVM up until I started messing with the vgubuntu-swap_1 volume size.

1 Answers1

1

OK, the answer is that I'm a moron and didn't mkswap. Solution:

# swapoff -a

mkswap /dev/mapper/vgubuntu-swap_1

swapon -a

  • Increasing the volume size is a good option. An alternate option is to add another swap, for example a swap file or a second swap partition. If this is on a separate disk, it helps to also change the swap priorities so they are used in parallel rather than sequentially. – user10489 Jul 22 '22 at 11:31
  • You're human, not a moron, I would too expect this to work more out of the box. – jave.web Jun 05 '23 at 17:26